Refine search
@After public void tearDown() throws Exception { brokerService.stop(); brokerService.waitUntilStopped(); }
@Override protected void tearDown() throws Exception { LOG.info("Closing down connection"); try { session.close(); session = null; } catch (Exception e) { LOG.info("Caught exception while closing resources."); } try { connection.close(); connection = null; } catch (Exception e) { LOG.info("Caught exception while closing resources."); } try { broker.stop(); broker.waitUntilStopped(); broker = null; } catch (Exception e) { LOG.info("Caught exception while shutting down the Broker", e); } LOG.info("Connection closed."); }
@After public void stopBroker() throws Exception { broker.stop(); broker.waitUntilStopped(); }
public void stop() { try { broker.stop(); broker.waitUntilStopped(); } catch (Exception e) { throw new RuntimeException(e); } }
@After public void stopBroker() throws Exception { if (brokerService != null) { brokerService.stop(); brokerService.waitUntilStopped(); brokerService = null; } } }
public synchronized void doStop() throws Exception { if (asyncStartup) { active.set(false); // ActiveMQ AMQPersistenceAdapter can hang, if we are still starting if (asyncStarted.getCount() > 0) { return; } } brokerService.stop(); brokerService.waitUntilStopped(); }
@Override synchronized public void deleted(String pid) { BrokerService broker = brokers.get(pid); if (broker == null) { return; } try { LOG.info("Stopping broker " + pid); broker.stop(); broker.waitUntilStopped(); } catch (Exception e) { LOG.error("Exception on stopping broker", e); } }
public void stop() { try { broker.stop(); broker.waitUntilStopped(); } catch (Exception e) { throw ExceptionUtil.rethrow(e); } } }
public void stopProvider () { BrokerService brokerService = getProvider(); try { if (brokerService != null) { brokerService.stop(); brokerService.waitUntilStopped(); } else { log.info("Could not stop ActiveMQ broker. It was never started"); } } catch (Exception e) { log.error("Failed to stop JMS Server", e); } }
@Override public void after() { try { m_broker.stop(); m_broker.waitUntilStopped(); } catch (Throwable e) { LOG.warn("An error occurred while stopping the broker.", e); } try { if (m_temporaryDirectory != null) { Files.walkFileTree(m_temporaryDirectory, new SimpleFileVisitor<Path>() { @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { Files.delete(file); return FileVisitResult.CONTINUE; } @Override public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException { Files.delete(dir); return FileVisitResult.CONTINUE; } }); } } catch (IOException e) { LOG.warn("An error occurred while deleting the temporary directory '{}'.", m_temporaryDirectory, e); } } }
@Override public void after() { try { m_broker.stop(); m_broker.waitUntilStopped(); } catch (Throwable e) { LOG.warn("An error occurred while stopping the broker.", e); } try { if (m_temporaryDirectory != null) { Files.walkFileTree(m_temporaryDirectory, new SimpleFileVisitor<Path>() { @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { Files.delete(file); return FileVisitResult.CONTINUE; } @Override public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException { Files.delete(dir); return FileVisitResult.CONTINUE; } }); } } catch (IOException e) { LOG.warn("An error occurred while deleting the temporary directory '{}'.", m_temporaryDirectory, e); } } }
public synchronized void doFail() { if (asyncStartup) { active.set(false); // ActiveMQ AMQPersistenceAdapter can hang, if we are still starting if (asyncStarted.getCount() > 0) { return; } } try { brokerService.stop(); brokerService.waitUntilStopped(); } catch (JMSException ignored) { // just a lame exception ActiveMQ likes to throw on shutdown if (!(ignored.getCause() instanceof TransportDisposedIOException)) { log.warn("Caught while closing due to failure: " + ignored, ignored); } } catch (Exception e) { log.warn("Caught while closing due to failure: " + e, e); } }
public void stopBroker(BrokerService broker) throws Exception { if (broker != null) { broker.stop(); broker.waitUntilStopped(); } }
@Given("^Stop Broker$") public void stop() { if (NO_EMBEDDED_SERVERS) { return; } logger.info("Stopping Broker instance ..."); try (final Suppressed<RuntimeException> s = Suppressed.withRuntimeException()) { // close all resources closables.values().stream().flatMap(values -> values.stream()).forEach(s::closeSuppressed); // shut down broker if (broker != null) { broker.stop(); broker.waitUntilStopped(); broker = null; } } catch (Exception e) { logger.error("Failed to stop Broker!"); e.printStackTrace(); } DatastoreMediator.getInstance().clearCache(); if (EXTRA_STARTUP_DELAY > 0) { try { Thread.sleep(Duration.ofSeconds(EXTRA_STARTUP_DELAY).toMillis()); } catch (InterruptedException e) { e.printStackTrace(); } } logger.info("Stopping Broker instance ... done!"); }
/** * Stop the embedded ActiveMQ broker, blocking until the broker has stopped. * * The broker will normally be stopped by JUnit using the after() method. This method allows the broker to * be stopped manually to support advanced testing scenarios. */ public void stop() { if (internalClient != null) { internalClient.stop(); internalClient = null; } if (!brokerService.isStopped()) { try { brokerService.stop(); } catch (Exception ex) { log.warn("Exception encountered stopping embedded ActiveMQ broker: {}" + this.getBrokerName(), ex); } } brokerService.waitUntilStopped(); }
private void stopImpl() throws Exception { super.stop(); final Collection<BrokerService> brokers = ActiveMQFactory.getBrokers(); final Iterator<BrokerService> it = brokers.iterator(); while (it.hasNext()) { final BrokerService bs = it.next(); try { bs.stop(); bs.waitUntilStopped(); } catch (final Throwable t) { //Ignore } it.remove(); } stopScheduler(); Logger.getInstance(LogCategory.OPENEJB_STARTUP, ActiveMQResourceAdapter.class).getChildLogger("service").info("Stopped ActiveMQ broker"); }
private void stopImpl() throws Exception { super.stop(); final Collection<BrokerService> brokers = ActiveMQFactory.getBrokers(); final Iterator<BrokerService> it = brokers.iterator(); while (it.hasNext()) { final BrokerService bs = it.next(); try { bs.stop(); bs.waitUntilStopped(); } catch (final Throwable t) { //Ignore } it.remove(); } stopScheduler(); Logger.getInstance(LogCategory.OPENEJB_STARTUP, ActiveMQResourceAdapter.class).getChildLogger("service").info("Stopped ActiveMQ broker"); }
private void doStop() { final ServerInfo s = server; // working with a volatile if (s != null) { try { s.getBroker().stop(); s.getBroker().waitUntilStopped(); if (!standalone || replicating) { // clear out the services as we are no longer alive discoveryAgent.setServices(new String[0]); } if (registerService) { osgiUnregister(s.getBroker()); } } catch (Throwable e) { LOG.debug("Exception on stop: " + e.getMessage(), e); } try { s.getContext().close(); } catch (Throwable e) { LOG.debug("Exception on close: " + e.getMessage(), e); } server = null; } }
private void doStop() { final ServerInfo s = server; // working with a volatile if (s != null) { try { s.getBroker().stop(); s.getBroker().waitUntilStopped(); if (!standalone || replicating) { // clear out the services as we are no longer alive discoveryAgent.setServices(new String[0]); } if (registerService) { osgiUnregister(s.getBroker()); } } catch (Throwable e) { LOG.debug("Exception on stop: " + e.getMessage(), e); } try { s.getContext().close(); } catch (Throwable e) { LOG.debug("Exception on close: " + e.getMessage(), e); } server = null; } }
protected void processStopAction(ActionRequest actionRequest, ActionResponse actionResponse) throws PortletException, IOException { //String sBrokerURI = actionRequest.getParameter("brokerURI"); String sBrokerName = actionRequest.getParameter("brokerName"); try { Map<String, BrokerServiceWrapper> brokerServices = getBrokerServices(); BrokerService brokerService = brokerServices.get(sBrokerName).getBrokerService(); if (!brokerService.isStarted()) { return; } brokerService.stop(); brokerService.waitUntilStopped(); if (brokerService.isStarted()) { throw new PortletException(getLocalizedString(actionRequest, "jmsmanager.broker.failStopBrokerNoReason", sBrokerName)); } addInfoMessage(actionRequest, getLocalizedString(actionRequest, "jmsmanager.broker.successStopBroker", sBrokerName)); } catch (PortletException e) { throw e; } catch (Exception e) { throw new PortletException(getLocalizedString(actionRequest, "jmsmanager.broker.failStopBroker", sBrokerName, e.getMessage())); } actionResponse.setRenderParameter("mode", "list"); }