List of usage examples for java.util.concurrent ConcurrentLinkedQueue ConcurrentLinkedQueue
public ConcurrentLinkedQueue()
From source file:com.sun.socialsite.web.listeners.SessionListener.java
public static void addListener(HttpSession session, Object listener) { Collection<Object> listenersForSession = listenersMap.get(session); if (listenersForSession == null) { listenersMap.putIfAbsent(session, new ConcurrentLinkedQueue<Object>()); listenersForSession = listenersMap.get(session); }// w w w .j av a2 s . c om listenersForSession.add(listener); log.debug(String.format("addListener(%s, %s): listenersForSession.size=%d", session, listener, listenersForSession.size())); }
From source file:com.net.monitor.LocalVPNService.java
@Override public void onCreate() { super.onCreate(); isRunning = true;/*from w ww . j a v a2 s .co m*/ setupVPN(); try { udpSelector = Selector.open(); tcpSelector = Selector.open(); deviceToNetworkUDPQueue = new ConcurrentLinkedQueue<>(); deviceToNetworkTCPQueue = new ConcurrentLinkedQueue<>(); networkToDeviceQueue = new ConcurrentLinkedQueue<>(); executorService = Executors.newFixedThreadPool(10); executorService.submit(new UDPInput(networkToDeviceQueue, udpSelector)); executorService.submit(new UDPOutput(deviceToNetworkUDPQueue, udpSelector, this)); executorService.submit(new TCPInput(networkToDeviceQueue, tcpSelector)); for (int i = 0; i < VpnConfig.TCP_OUT_THREAD_NUM; i++) { executorService .submit(new TCPOutput(deviceToNetworkTCPQueue, networkToDeviceQueue, tcpSelector, this)); } // executorService.submit(new VpnRead(vpnInterface.getFileDescriptor(), // deviceToNetworkUDPQueue, deviceToNetworkTCPQueue)); // executorService.submit(new VpnWrite(vpnInterface.getFileDescriptor(), networkToDeviceQueue)); executorService.submit(new VpnRunable(vpnInterface.getFileDescriptor(), deviceToNetworkUDPQueue, deviceToNetworkTCPQueue, networkToDeviceQueue)); LocalBroadcastManager.getInstance(this) .sendBroadcast(new Intent(BROADCAST_VPN_STATE).putExtra("running", true)); Log.i(TAG, "Started"); } catch (IOException e) { // TODO: Here and elsewhere, we should explicitly notify the user of any errors // and suggest that they stop the service, since we can't do it ourselves Log.e(TAG, "Error starting service", e); cleanup(); } }
From source file:com.microsoft.windowsazure.mobileservices.zumoe2etestapp.framework.TestGroup.java
public TestGroup(String name) { mName = name;//from w w w .j av a 2s. com mStatus = TestStatus.NotRun; mTestCases = new ArrayList<TestCase>(); mSourceMap = new HashMap<String, String>(); mTestRunQueue = new ConcurrentLinkedQueue<TestCase>(); mNewTestRun = false; }
From source file:xyz.hexene.localvpn.LocalVPNService.java
@Override public void onCreate() { super.onCreate(); isRunning = true;/*from w w w . j a v a 2s. c om*/ setupVPN(); try { udpSelector = Selector.open(); tcpSelector = Selector.open(); deviceToNetworkUDPQueue = new ConcurrentLinkedQueue<>(); deviceToNetworkTCPQueue = new ConcurrentLinkedQueue<>(); networkToDeviceQueue = new ConcurrentLinkedQueue<>(); executorService = Executors.newFixedThreadPool(5); executorService.submit(new UDPInput(networkToDeviceQueue, udpSelector)); executorService.submit(new UDPOutput(deviceToNetworkUDPQueue, udpSelector, this)); executorService.submit(new TCPInput(networkToDeviceQueue, tcpSelector)); executorService.submit(new TCPOutput(deviceToNetworkTCPQueue, networkToDeviceQueue, tcpSelector, this)); executorService.submit(new VPNRunnable(vpnInterface.getFileDescriptor(), deviceToNetworkUDPQueue, deviceToNetworkTCPQueue, networkToDeviceQueue)); LocalBroadcastManager.getInstance(this) .sendBroadcast(new Intent(BROADCAST_VPN_STATE).putExtra("running", true)); Log.i(TAG, "Started"); } catch (IOException e) { // TODO: Here and elsewhere, we should explicitly notify the user of any errors // and suggest that they stop the service, since we can't do it ourselves Log.e(TAG, "Error starting service", e); cleanup(); } }
From source file:JMeter.plugins.functional.samplers.geoevent.WsListener.java
public WsListener(String idFieldName, Messages messages) { this.idFieldName = idFieldName; ids = new ConcurrentLinkedQueue<Integer>(); ready = false;/*from w w w .j a v a 2 s .co m*/ this.messages = messages; }
From source file:io.pravega.controller.eventProcessor.impl.SerializedRequestHandler.java
@Override public final CompletableFuture<Void> process(final T streamEvent) { CompletableFuture<Void> result = new CompletableFuture<>(); Work work = new Work(streamEvent, System.currentTimeMillis(), result); String key = streamEvent.getKey(); final ConcurrentLinkedQueue<Work> queue; synchronized (lock) { if (workers.containsKey(key)) { workers.get(key).add(work);//from w w w. ja v a 2 s . c o m queue = null; } else { queue = new ConcurrentLinkedQueue<>(); queue.add(work); workers.put(key, queue); } } if (queue != null) { executor.execute(() -> run(key, queue)); } return result; }
From source file:ru.anr.base.tests.TestJmsOperations.java
/** * Getting stored queue (or creating a new one in storage) * /* w ww. j a v a 2 s .c om*/ * @param destination * Destination to use * @return Mock queue instance */ private java.util.Queue<Object> getQueue(Object destination) { Assert.notNull(destination, "Destination is null"); String key = destination.toString(); java.util.Queue<Object> q = queueMap.get(key); if (q == null) { q = new ConcurrentLinkedQueue<>(); queueMap.put(key, q); } return q; }
From source file:com.joshlong.esb.springintegration.modules.net.feed.FeedReaderMessageSource.java
public FeedReaderMessageSource() { syndFeeds = new ConcurrentLinkedQueue<SyndFeed>(); }
From source file:hosts.file.localvpn.LocalVPNService.java
@Override public void onCreate() { super.onCreate(); localVPNService = this; isRunning = true;//from w w w . jav a 2 s. c o m setupVPN(); try { udpSelector = Selector.open(); tcpSelector = Selector.open(); deviceToNetworkUDPQueue = new ConcurrentLinkedQueue<>(); deviceToNetworkTCPQueue = new ConcurrentLinkedQueue<>(); networkToDeviceQueue = new ConcurrentLinkedQueue<>(); executorService = Executors.newFixedThreadPool(5); executorService.submit(new UDPInput(networkToDeviceQueue, udpSelector)); executorService.submit(new UDPOutput(deviceToNetworkUDPQueue, udpSelector, this)); executorService.submit(new TCPInput(networkToDeviceQueue, tcpSelector)); executorService.submit(new TCPOutput(deviceToNetworkTCPQueue, networkToDeviceQueue, tcpSelector, this)); executorService.submit(new VPNRunnable(vpnInterface.getFileDescriptor(), deviceToNetworkUDPQueue, deviceToNetworkTCPQueue, networkToDeviceQueue)); LocalBroadcastManager.getInstance(this) .sendBroadcast(new Intent(BROADCAST_VPN_STATE).putExtra("running", true)); Log.i(TAG, "Started"); } catch (IOException e) { // TODO: Here and elsewhere, we should explicitly notify the user of any errors // and suggest that they stop the service, since we can't do it ourselves Log.e(TAG, "Error starting service", e); cleanup(); } }
From source file:com.mindquarry.desktop.event.EventBus.java
/** * Private constructor because of singleton pattern. */ private EventBus() { registeredListeners = new ConcurrentLinkedQueue<EventListener>(); }