public void execForAbonent(Abonent abonent) { Queue<Msg> messageQueue = messages.get(abonent.getAddress()); while (!messageQueue.isEmpty()) { Msg message = messageQueue.poll(); message.exec(abonent); } }
public void sendMessage(Msg message) { Queue<Msg> messageQueue = messages.get(message.getTo()); messageQueue.add(message); }