@Override public void start() throws JmsException { if (!verified) { verify(jmsFactory, "failed to get a JMSFactory"); verified = true; } if (!isRunning()) { // configure the container configure(); // start it super.start(); // initialize the container initialize(); } }
if (!isRunning()) { LOGGER.info("Connecting..."); start(); if (isRunning()) { for (int repReg = 1; repReg <= max; ++repReg) { LOGGER.info("Registration..."); if (isRegisteredWithDestination()) { LOGGER.info("Now GeoServer is registered with the destination"); return true; LOGGER.log( Level.SEVERE, "Registration aborted due to a connection problem"); stop(); LOGGER.info("Disconnected"); } else { stop(); LOGGER.info("Disconnected"); return false;
@PostConstruct private void init() { // change the default autostartup status to false setAutoStartup(false); // force no concurrent consumers setConcurrentConsumers(1); // set to topic setPubSubDomain(true); // set subscription durability setSubscriptionDurable(Boolean.parseBoolean(config.getConfiguration(TopicConfiguration.DURABLE_KEY).toString())); // set subscription ID setDurableSubscriptionName(config.getConfiguration(JMSConfiguration.INSTANCE_NAME_KEY).toString()); // times to test (connection) max = Integer.parseInt(config.getConfiguration(ConnectionConfiguration.CONNECTION_RETRY_KEY).toString()); // millisecs to wait between tests (connection) maxWait = Long.parseLong(config.getConfiguration(ConnectionConfiguration.CONNECTION_MAXWAIT_KEY).toString()); // check configuration for connection and try to start if needed // configure (needed by initializeBean) configure(); }
private void configure() { final Properties conf = config.getConfigurations(); // set destination setDestination(jmsFactory.getClientDestination(conf)); // use a CachingConnectionFactory setConnectionFactory(jmsFactory.getConnectionFactory(conf)); }
public void connectClient(final boolean connect) throws IOException { if (connect) { if (!container.isRunning()) { if (container.connect()) { if (container.isRunning()) { if (container.disconnect()) { config.putConfiguration( ConnectionConfiguration.CONNECTION_KEY,
/** * try to disconnect * * @return true if success */ public boolean disconnect() { if (isRunning()) { LOGGER.info("Disconnecting..."); stop(); for (int rep = 1; rep <= max; ++rep) { LOGGER.info("Unregistering..."); if (!isRunning()) { LOGGER.info("Succesfully un-registered from the destination topic"); LOGGER.warning("You will (probably) loose next incoming events from other instances!!! (depending on how you have configured the broker)"); return true; } LOGGER.info("Waiting for connection shutdown...(" + rep + "/" + max + ")"); try { Thread.sleep(maxWait); } catch (InterruptedException e) { LOGGER.log(Level.SEVERE,e.getLocalizedMessage(), e); } } } else { LOGGER.severe("Connection is already stopped"); } return false; }
@Override public void onApplicationEvent(ContextRefreshedEvent event) { if (event.getApplicationContext() == applicationContext) { final String startString = config .getConfiguration(ConnectionConfiguration.CONNECTION_KEY); if (startString != null && startString.equals(ConnectionConfigurationStatus.enabled.toString())) { if (!connect()) { if (LOGGER.isLoggable(Level.SEVERE)) { LOGGER.severe("Unable to connect to the broker, force connection status to disabled"); } // change configuration status config.putConfiguration(ConnectionConfiguration.CONNECTION_KEY, ConnectionConfigurationStatus.disabled.toString()); // store changes to the configuration try { config.storeConfig(); } catch (IOException e) { LOGGER.log(Level.SEVERE, e.getMessage(), e); } } } } } }
if (c.isRunning()) { fp.info("Disconnecting..."); if (c.disconnect()) { fp.info("Succesfully un-registered from the destination topic"); fp.warn("You will (probably) loose next incoming events from other instances!!! (depending on how you have configured the broker)"); if (c.connect()) { fp.info("Now GeoServer is registered with the destination"); connectionInfo.getModel().setObject(
/** * try to disconnect * * @return true if success */ public boolean disconnect() { if (isRunning()) { LOGGER.info("Disconnecting..."); stop(); for (int rep = 1; rep <= max; ++rep) { LOGGER.info("Unregistering..."); if (!isRunning()) { LOGGER.info("Succesfully un-registered from the destination topic"); LOGGER.warning( "You will (probably) loose next incoming events from other instances!!! (depending on how you have configured the broker)"); return true; } LOGGER.info("Waiting for connection shutdown...(" + rep + "/" + max + ")"); try { Thread.sleep(maxWait); } catch (InterruptedException e) { LOGGER.log(Level.SEVERE, e.getLocalizedMessage(), e); } } } else { LOGGER.severe("Connection is already stopped"); } return false; }
private void configure() { final Properties conf = config.getConfigurations(); // set destination setDestination(jmsFactory.getClientDestination(conf)); // use a CachingConnectionFactory setConnectionFactory(jmsFactory.getConnectionFactory(conf)); }
@Override public void onApplicationEvent(ContextRefreshedEvent event) { if (event.getApplicationContext() == applicationContext) { final String startString = config.getConfiguration(ConnectionConfiguration.CONNECTION_KEY); if (startString != null && startString.equals(ConnectionConfigurationStatus.enabled.toString())) { if (!connect()) { if (LOGGER.isLoggable(Level.SEVERE)) { LOGGER.severe( "Unable to connect to the broker, force connection status to disabled"); } // change configuration status config.putConfiguration( ConnectionConfiguration.CONNECTION_KEY, ConnectionConfigurationStatus.disabled.toString()); // store changes to the configuration try { config.storeConfig(); } catch (IOException e) { LOGGER.log(Level.SEVERE, e.getMessage(), e); } } } } } }
@PostConstruct private void init() { // change the default autostartup status to false setAutoStartup(false); // force no concurrent consumers setConcurrentConsumers(1); // set to topic setPubSubDomain(true); // set subscription durability setSubscriptionDurable( Boolean.parseBoolean( config.getConfiguration(TopicConfiguration.DURABLE_KEY).toString())); // set subscription ID setDurableSubscriptionName( config.getConfiguration(JMSConfiguration.INSTANCE_NAME_KEY).toString()); // times to test (connection) max = Integer.parseInt( config.getConfiguration(ConnectionConfiguration.CONNECTION_RETRY_KEY) .toString()); // millisecs to wait between tests (connection) maxWait = Long.parseLong( config.getConfiguration(ConnectionConfiguration.CONNECTION_MAXWAIT_KEY) .toString()); // check configuration for connection and try to start if needed // configure (needed by initializeBean) configure(); }
@Override public void start() throws JmsException { if (!verified) { verify(jmsFactory, "failed to get a JMSFactory"); verified = true; } if (!isRunning()) { // configure the container configure(); // start it super.start(); // initialize the container initialize(); } }
if (!isRunning()) { LOGGER.info("Connecting..."); start(); if (isRunning()) { for (int repReg = 1; repReg <= max; ++repReg) { LOGGER.info("Registration..."); if (isRegisteredWithDestination()) { LOGGER.info("Now GeoServer is registered with the destination"); return true; } else if (repReg == max) { LOGGER.log(Level.SEVERE,"Registration aborted due to a connection problem"); stop(); LOGGER.info("Disconnected"); } else { stop(); LOGGER.info("Disconnected"); return false;