Refine search
@Override public Statistics[] findStatisticsByTextId(String textId) { List<Statistics> hits = new ArrayList<Statistics>(); Iterator<Statistics> it = statsList.iterator(); while (it.hasNext()) { Statistics s = (Statistics) it.next(); if (s.getTextId().equals(textId)) { hits.add(s); } } Statistics[] result = new Statistics[hits.size()]; return (Statistics[]) hits.toArray(result); }
@Override public Statistics[] findStatisticsByType(StatisticsType type) { List<Statistics> hits = new ArrayList<Statistics>(); Iterator<Statistics> it = statsList.iterator(); while (it.hasNext()) { Statistics s = (Statistics) it.next(); if (type == s.getType()) { hits.add(s); } } Statistics[] result = new Statistics[hits.size()]; return (Statistics[]) hits.toArray(result); }
@Override public Statistics[] findStatisticsByNumericId(long numericId) { List<Statistics> hits = new ArrayList<Statistics>(); Iterator<Statistics> it = statsList.iterator(); while (it.hasNext()) { Statistics s = (Statistics) it.next(); if (numericId == s.getNumericId()) { hits.add(s); } } Statistics[] result = new Statistics[hits.size()]; return (Statistics[]) hits.toArray(result); }
public void removeLocator(final Class<? extends AssetLocator> locatorType, String rootPath){ ArrayList<ImplThreadLocal<AssetLocator>> locatorsToRemove = new ArrayList<ImplThreadLocal<AssetLocator>>(); Iterator<ImplThreadLocal<AssetLocator>> it = locatorsList.iterator(); while (it.hasNext()){ ImplThreadLocal locator = it.next(); if (locator.getPath().equals(rootPath) && locator.getTypeClass().equals(locatorType)){ //it.remove(); // copy on write list doesn't support iterator remove, // must use temporary list locatorsToRemove.add(locator); } } locatorsList.removeAll(locatorsToRemove); }
@Override public void stop() { if (jmdns != null) { for (Iterator<ServiceInfo> iter = serviceInfos.iterator(); iter.hasNext();) { ServiceInfo si = iter.next(); jmdns.unregisterService(si); } // Close it down async since this could block for a while. final JmDNS closeTarget = jmdns; Thread thread = new Thread() { @Override public void run() { try { if (JmDNSFactory.onClose(getLocalAddress())) { closeTarget.close(); }; } catch (IOException e) { LOG.debug("Error closing JmDNS {}. This exception will be ignored.", getLocalhost(), e); } } }; thread.setDaemon(true); thread.start(); jmdns = null; } }
protected void close(ConsumerId id) { for (Iterator<ActiveMQMessageConsumer> iter = consumers.iterator(); iter.hasNext();) { ActiveMQMessageConsumer c = iter.next(); if (c.getConsumerId().equals(id)) { try { c.close(); } catch (JMSException e) { LOG.warn("Exception closing consumer", e); } LOG.warn("Closed consumer on Command, " + id); break; } } }
@Override public void transportInterupted() { transportInterruptionProcessingComplete.set(1); for (Iterator<ActiveMQSession> i = this.sessions.iterator(); i.hasNext();) { ActiveMQSession s = i.next(); s.clearMessagesInProgress(transportInterruptionProcessingComplete); } for (ActiveMQConnectionConsumer connectionConsumer : this.connectionConsumers) { connectionConsumer.clearMessagesInProgress(transportInterruptionProcessingComplete); } if (transportInterruptionProcessingComplete.decrementAndGet() > 0) { if (LOG.isDebugEnabled()) { LOG.debug("transport interrupted - processing required, dispatchers: " + transportInterruptionProcessingComplete.get()); } signalInterruptionProcessingNeeded(); } for (Iterator<TransportListener> iter = transportListeners.iterator(); iter.hasNext();) { TransportListener listener = iter.next(); listener.transportInterupted(); } }
/** * @see #stop() * @param checkClosed <tt>true</tt> to check for already closed and throw {@link java.lang.IllegalStateException} if already closed, * <tt>false</tt> to skip this check * @throws JMSException if the JMS provider fails to stop message delivery due to some internal error. */ void doStop(boolean checkClosed) throws JMSException { if (checkClosed) { checkClosedOrFailed(); } if (started.compareAndSet(true, false)) { synchronized(sessions) { for (Iterator<ActiveMQSession> i = sessions.iterator(); i.hasNext();) { ActiveMQSession s = i.next(); s.stop(); } } } }
public void checkMessageListener() throws JMSException { if (messageListener != null) { throw new IllegalStateException("Cannot synchronously receive a message when a MessageListener is set"); } for (Iterator<ActiveMQMessageConsumer> i = consumers.iterator(); i.hasNext();) { ActiveMQMessageConsumer consumer = i.next(); if (consumer.hasMessageListener()) { throw new IllegalStateException("Cannot synchronously receive a message when a MessageListener is set"); } } }