Package org.apache.synapse
Class ServerManager
- java.lang.Object
-
- org.apache.synapse.ServerManager
-
public class ServerManager extends Object
This is the core class that starts up a Synapse instance. From the command line scripts synapse.sh and synapse-daemon.sh (though the wrapper.conf) the SynapseServer is invoked which in turn calls on this to start the instance When the WAR deployment is used, the SynapseStartUpServlet servlet calls on this class to initialize Synapse. This is the entry point for starting an Synapse instance. All the synapse related management operations are exposed through this class.
-
-
Constructor Summary
Constructors Constructor Description ServerManager()
Construct a server manager.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ServerState
endMaintenance()
Ends server maintenance resuming transport listeners, senders and tasks.ClassLoader
getClassLoader()
Returns the context class loader of the original thread.ServerConfigurationInformation
getServerConfigurationInformation()
Returns the ServerConfigurationInformation, if the system is initialized and if not a Runtime exception of typeSynapseException
will be thrownServerContextInformation
getServerContextInformation()
Returns the ServerContextInformation, if the system is initialized and if not a Runtime Exception of typeSynapseException
will be thrownServerState
getServerState()
Retrieves the state of the server.ServerState
init(ServerConfigurationInformation serverConfigurationInformation, ServerContextInformation serverContextInformation)
Initializes the server, if we need to create a new axis2 instance, calling this will create the new axis2 environment, but this won't start the transport listenersboolean
isInitialized()
Has server manager been initialized ?ServerState
shutdown()
Shuts down the Server instance.ServerState
start()
Starts the system, if the system is initialized, and if not a Runtime exception of typeSynapseException
will be thrownServerState
startMaintenance()
Put transport listeners and senders into maintenance mode.ServerState
stop()
Stops the system, if it is started and if not a Runtime exception of typeSynapseException
will be thrownServerState
stopGracefully(long maxWaitMillis)
Perform a graceful stop of Synapse.
-
-
-
Method Detail
-
init
public ServerState init(ServerConfigurationInformation serverConfigurationInformation, ServerContextInformation serverContextInformation)
Initializes the server, if we need to create a new axis2 instance, calling this will create the new axis2 environment, but this won't start the transport listeners- Parameters:
serverConfigurationInformation
- ServerConfigurationInformation instanceserverContextInformation
- ServerContextInformation instance- Returns:
- ServerState - State of the server which is
ServerState.INITIALIZED
, if successful
-
shutdown
public ServerState shutdown()
Shuts down the Server instance. If the Server is stopped this will shutdown the ServerManager, and if it is running (i.e. in the STARTED state) this will first stop the ServerManager and shutdown it in turn.- Returns:
- the state after the shutdown,
ServerState.UNDETERMINED
-
start
public ServerState start()
Starts the system, if the system is initialized, and if not a Runtime exception of typeSynapseException
will be thrown- Returns:
- the state of the server after starting, for a successful start
ServerState.STARTED
-
startMaintenance
public ServerState startMaintenance()
Put transport listeners and senders into maintenance mode.- Returns:
- the state of the server after maintenance request, for a successful execution
ServerState.MAINTENANCE
-
endMaintenance
public ServerState endMaintenance()
Ends server maintenance resuming transport listeners, senders and tasks.- Returns:
- the state of the server after maintenance request, for a successful execution
ServerState.MAINTENANCE
-
stop
public ServerState stop()
Stops the system, if it is started and if not a Runtime exception of typeSynapseException
will be thrown- Returns:
- the state of the system after stopping, which is
ServerState.STOPPED
for a successful stopping
-
stopGracefully
public ServerState stopGracefully(long maxWaitMillis)
Perform a graceful stop of Synapse. Before the instance is stopped it will be put to maintenance mode.- Parameters:
maxWaitMillis
- the maximum number of ms to wait until a graceful stop is achieved, before forcing a stop- Returns:
- if successful ServerState#STOPPED
- Throws:
SynapseException
-
getServerConfigurationInformation
public ServerConfigurationInformation getServerConfigurationInformation()
Returns the ServerConfigurationInformation, if the system is initialized and if not a Runtime exception of typeSynapseException
will be thrown- Returns:
- the configuration information of the initialized system
-
getServerContextInformation
public ServerContextInformation getServerContextInformation()
Returns the ServerContextInformation, if the system is initialized and if not a Runtime Exception of typeSynapseException
will be thrown- Returns:
- the context information of the initialized system
-
getClassLoader
public ClassLoader getClassLoader()
Returns the context class loader of the original thread.- Returns:
- the context class loader of the original thread.
-
isInitialized
public boolean isInitialized()
Has server manager been initialized ?- Returns:
- true if the server manager has been initialized by given required configuration information
-
getServerState
public ServerState getServerState()
Retrieves the state of the server.- Returns:
- the state of the server
-
-