Пример #1
0
 public boolean addMessage(Message m) {
   if (restriction.can(m.getOwner())) {
     synchronized (messagesQueue) {
       messagesQueue.add(m);
     }
     return true;
   } else return false;
 }
Пример #2
0
 public ConnectionStatus connectUser(User u) {
   // Success
   if (restriction.can(u)) {
     users.add(u);
     return ConnectionStatus.SUCCESS;
   } else { // Fail
     return ConnectionStatus.FAIL;
   }
 }