@Override public void clearContext() { OperationContextImpl.clearContext(); }
@Override public void run() { try { // If any IO is done inside the callback, it needs to be done on a new context OperationContextImpl.clearContext(); task.done(); } finally { executorsPending.decrementAndGet(); } } });
@Before public void setUp() throws Exception { sendMsgCount = 0; testDir = temporaryFolder.getRoot().getAbsolutePath(); clearDataRecreateServerDirs(); OperationContextImpl.clearContext(); InVMRegistry.instance.clear(); // checkFreePort(TransportConstants.DEFAULT_PORT); }
private void cleanupPools() { OperationContextImpl.clearContext(); // We shutdown the global pools to give a better isolation between tests try { ServerLocatorImpl.clearThreadPools(); } catch (Throwable e) { log.info(threadDump(e.getMessage())); System.err.println(threadDump(e.getMessage())); } try { NettyConnector.clearThreadPools(); } catch (Exception e) { log.info(threadDump(e.getMessage())); System.err.println(threadDump(e.getMessage())); } }
OperationContextImpl.clearContext(); } finally { OperationContextImpl.clearContext();
private ActiveMQServer newActiveMQServer() throws Exception { OperationContextImpl.clearContext(); ActiveMQServer server = super.createServer(true, false); AddressSettings defaultSetting = new AddressSettings().setPageSizeBytes(10 * 1024).setMaxSizeBytes(20 * 1024); server.getAddressSettingsRepository().addMatch("#", defaultSetting); return server; }
@Test public void testSyncPage() throws Exception { Configuration config = createDefaultInVMConfig(); server = createServer(true, config, PagingTest.PAGE_SIZE, PagingTest.PAGE_MAX); server.start(); try { server.addAddressInfo(new AddressInfo(PagingTest.ADDRESS, RoutingType.ANYCAST)); server.createQueue(PagingTest.ADDRESS, RoutingType.ANYCAST, PagingTest.ADDRESS, null, true, false); final CountDownLatch pageUp = new CountDownLatch(0); final CountDownLatch pageDone = new CountDownLatch(1); OperationContext ctx = new DummyOperationContext(pageUp, pageDone); OperationContextImpl.setContext(ctx); PagingManager paging = server.getPagingManager(); PagingStore store = paging.getPageStore(ADDRESS); store.sync(); assertTrue(pageUp.await(10, TimeUnit.SECONDS)); assertTrue(pageDone.await(10, TimeUnit.SECONDS)); server.stop(); } finally { try { server.stop(); } catch (Throwable ignored) { } OperationContextImpl.clearContext(); } }
@Test public void testStart() throws Exception { ArrayList<String> connectors = new ArrayList<>(); connectors.add("invm"); ConnectionFactoryConfiguration cfg = new ConnectionFactoryConfigurationImpl().setName("tst").setConnectorNames(connectors).setBindings("tt"); jmsServer.createConnectionFactory(true, cfg, "tst"); assertNotNull(namingContext.lookup("tst")); jmsServer.removeConnectionFactoryFromBindingRegistry("tst"); try { namingContext.lookup("tst"); fail("failure expected"); } catch (NamingException excepted) { } jmsServer.stop(); OperationContextImpl.clearContext(); jmsServer.start(); try { namingContext.lookup("tst"); fail("failure expected"); } catch (NamingException excepted) { } }