/** * Adds the synapse handlers to the inflow Dispatch phase and starts the listener manager if the * axis2 instance is created by the Synapse */ public void start() { // add the Synapse handlers if (configurationContext != null) { List<Phase> inflowPhases = configurationContext.getAxisConfiguration().getInFlowPhases(); for (Phase inPhase : inflowPhases) { // we are interested about the Dispatch phase in the inflow if (PhaseMetadata.PHASE_DISPATCH.equals(inPhase.getPhaseName())) { try { inPhase.addHandler(prepareSynapseDispatcher()); inPhase.addHandler(prepareMustUnderstandHandler()); } catch (PhaseException e) { handleFatal("Couldn't start Synapse, " + "Cannot add the required Synapse handlers", e); } } } } else { handleFatal("Couldn't start Synapse, ConfigurationContext not found"); } // if the axis2 instance is created by us, then start the listener manager if (serverConfigurationInformation.isCreateNewInstance()) { if (listenerManager != null) { listenerManager.start(); } else { handleFatal("Couldn't start Synapse, ListenerManager not found"); } /* if JMX Adapter has been configured and started, output usage information rather at the end of the startup process to make it more obvious */ if (jmxAdapter != null && jmxAdapter.isRunning()) { log.info( "Management using JMX available via: " + jmxAdapter.getJmxInformation().getJmxUrl()); } } }
/** * Starts the JMX Adaptor. * * @throws SynapseException if the JMX configuration is erroneous and/or the connector server * cannot be started */ private void startJmxAdapter() { Properties synapseProperties = SynapsePropertiesLoader.loadSynapseProperties(); JmxInformation jmxInformation = JmxInformationFactory.createJmxInformation( synapseProperties, serverConfigurationInformation.getHostName()); // Start JMX Adapter only if at least a JMX JNDI port is configured if (jmxInformation.getJndiPort() != -1) { jmxAdapter = new JmxAdapter(jmxInformation); jmxAdapter.start(); } }
/** Stops the JMX Adaptor. */ private void stopJmxAdapter() { if (jmxAdapter != null) { jmxAdapter.stop(); } }