private ArrayList<MessagesPane> getPanes( final AbstractDeliveringElement element, final AtomicReference<LinkedList<AbstractDeliveringElement>> releasedList) { if (element.getSpecific() != null) { ArrayList<MessagesPane> toRet = new ArrayList<MessagesPane>(); if (isMessagesPane(element.getSpecific())) { synchronized (this.blockedPanes) { BlockedPane blockedPane = releaseBlocked(element.getSpecific()); toRet.add(element.getSpecific()); if (blockedPane != null) { if (logger.isDebugEnabled()) { logger.debug("Setting release list size: " + blockedPane.get().size()); } releasedList.set(blockedPane.get()); } } } return toRet; } else { synchronized (this.blockedPanes) { if (this.blockedPanes.isEmpty()) { return new ArrayList<MessagesPane>(this.panes); } else { ArrayList<MessagesPane> toRet = new ArrayList<MessagesPane>(); for (MessagesPane pane : this.panes) { if (!processIsBlocked(element, pane)) { toRet.add(pane); } } return toRet; } } } }
/** * @param element * @param pane */ void deliver(AbstractDeliveringElement element, MessagesPane pane) { synchronized (this.blockedPanes) { element.setSpecific(pane); this.messagesQueue.put(element); } }