public boolean addMessage(Message m) { if (restriction.can(m.getOwner())) { synchronized (messagesQueue) { messagesQueue.add(m); } return true; } else return false; }
public ConnectionStatus connectUser(User u) { // Success if (restriction.can(u)) { users.add(u); return ConnectionStatus.SUCCESS; } else { // Fail return ConnectionStatus.FAIL; } }