Java Code Examples for org.apache.activemq.artemis.core.server.ActiveMQServer#getScheduledPool()
The following examples show how to use
org.apache.activemq.artemis.core.server.ActiveMQServer#getScheduledPool() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OpenWireProtocolManager.java From activemq-artemis with Apache License 2.0 | 6 votes |
public OpenWireProtocolManager(OpenWireProtocolManagerFactory factory, ActiveMQServer server) { this.factory = factory; this.server = server; this.wireFactory = new OpenWireFormatFactory(); // preferred prop, should be done via config wireFactory.setCacheEnabled(false); advisoryProducerId.setConnectionId(ID_GENERATOR.generateId()); scheduledPool = server.getScheduledPool(); this.wireFormat = (OpenWireFormat) wireFactory.createWireFormat(); final ClusterManager clusterManager = this.server.getClusterManager(); ClusterConnection cc = clusterManager.getDefaultConnection(null); if (cc != null) { cc.addClusterTopologyListener(this); } }
Example 2
Source File: FederatedQueueConsumerImpl.java From activemq-artemis with Apache License 2.0 | 5 votes |
public FederatedQueueConsumerImpl(Federation federation, ActiveMQServer server, Transformer transformer, FederatedConsumerKey key, FederationUpstream upstream, ClientSessionCallback clientSessionCallback) { this.federation = federation; this.server = server; this.key = key; this.transformer = transformer; this.upstream = upstream; this.scheduledExecutorService = server.getScheduledPool(); this.clientSessionCallback = clientSessionCallback; }
Example 3
Source File: ActiveMQServerImplTest.java From activemq-artemis with Apache License 2.0 | 5 votes |
@Test public void testScheduledPoolGC() throws Exception { ActiveMQServer server = createServer(false); server.start(); Runnable scheduledRunnable = new Runnable() { @Override public void run() { Assert.fail(); } }; WeakReference<Runnable> scheduledRunnableRef = new WeakReference<>(scheduledRunnable); ScheduledExecutorService scheduledPool = server.getScheduledPool(); ScheduledFuture scheduledFuture = scheduledPool.schedule(scheduledRunnable, 5000, TimeUnit.MILLISECONDS); Assert.assertFalse(scheduledFuture.isCancelled()); Assert.assertTrue(scheduledFuture.cancel(true)); Assert.assertTrue(scheduledFuture.isCancelled()); Assert.assertNotEquals(null, scheduledRunnableRef.get()); scheduledRunnable = null; forceGC(); Assert.assertEquals(null, scheduledRunnableRef.get()); server.stop(); }
Example 4
Source File: FederationDownstream.java From activemq-artemis with Apache License 2.0 | 4 votes |
public FederationDownstream(ActiveMQServer server, Federation federation, String name, FederationDownstreamConfiguration config, final FederationConnection connection) { super(server, federation, name, config, connection); this.config = config; this.scheduledExecutorService = server.getScheduledPool(); }