Class RemoteCommandManager
- All Implemented Interfaces:
CommandManager
Purpose: Provide a CommandManager implementation for cache coordination.
Description: A RemoteCommandManager (or RCM) instance is the primary component of an RCM service instance. It manages the other components of the service, and directs the overall service operation. Its ServiceId uniquely distinguishes it from other service instances in the cluster.
Each RCM has a logical channel to which it subscribes and publishes. This channel determines which other instances in the cluster the service instance sends and receives remote commands to/from. All RCM's on the same channel should have the same discovery manager settings (be communicating on the same multicast) so that the discovery managers may be able to discover one another. RCM's on different channels may operate on the same or on different multicast groups.
An RCM instance knows about other instances in the cluster through its DiscoveryManager. Its TransportManager is responsible for setting up the connections to other instances once they are discovered.
An RCM is instructed to "propagate", or execute on all remote service instances in the cluster that subscribe to the same channel, a remote command by its CommandProcessor. Likewise, when an RCM receives a remote command to be executed then it passes the command off to the CommandProcessor for the processing of the command to occur. CommandProcessors pass commands to the RCM as an Object (in a format that may be specific to the application) and the RCM uses its CommandConverter to convert it to a EclipseLink Command object before sending the Command off to the cluster. Similarly, when a EclipseLink Command object is received then the RCM invokes its CommandConverter to convert the object into the application format that will be passed to the CommandProcessor to process the command.
- Since:
- OracleAS TopLink 10g (9.0.4)
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprotected CommandConverter
Used for converting commands between EclipseLink Command and app command formatsprotected CommandProcessor
Invoked to process a command when it is received from the clusterstatic final boolean
static final String
protected DiscoveryManager
Manages the detection of new services as they join the clusterprotected boolean
Determines whether propagation should be synchronous or asynchronousprotected boolean
Determines whether profiling command should be sendprotected boolean
protected Serializer
Set the Serializer to use for serialization of commands.protected ServerPlatform
Uniquely identifies ServerPlatform in the clusterprotected ServiceId
Uniquely identifies this service in the clusterprotected TransportManager
Manages the transport level connections between command managers -
Constructor Summary
ConstructorDescriptionRemoteCommandManager
(CommandProcessor commandProcessor) RemoteCommandManager
(CommandProcessor commandProcessor, TransportManager transportManager) -
Method Summary
Modifier and TypeMethodDescriptionPUBLIC: Return the service channel for this command manager.PUBLIC: Return the converter instance used to convert between EclipseLink Command objects and an application command format.PUBLIC: Return the command processor that processes commands received from the cluster.PUBLIC: Return the discovery manager that detects the arrival of new cluster membersPUBLIC: Return the Serializer to use for serialization of commands.INTERNAL: Return the serverPlatform that identifies the application serverINTERNAL: Return the service info that identifies this service instancePUBLIC: Return the transport manager that manages sending and receiving of remote commands.getUrl()
PUBLIC: Return the URL for this command manager.void
handleException
(RuntimeException exception) INTERNAL: Delegate to the command procesor to handle the exception.void
PUBLIC: Initialize the remote command manager.boolean
INTERNAL: Return whether this command manager should process profile commandsboolean
PUBLIC: Indicates whether the RCM has been stopped: either initialize hasn't been called or shutdown has been called.void
INTERNAL: Convenience logging methods.void
logDebugWithoutLevelCheck
(String message, Object[] args) void
void
void
logMessage
(int logLevel, String message, Object[] args) INTERNAL:void
logMessageWithoutLevelCheck
(int logLevel, String message, Object[] args) INTERNAL: Use this method in case the necessary logLevel has been confirmed by calling commandProcessor.shouldLogMessages methodvoid
logWarning
(String message, Object[] args) void
logWarningWithoutLevelCheck
(String message, Object[] args) void
newServiceDiscovered
(ServiceId service) INTERNAL: A new service has been detected by the discovery manager.void
processCommandFromRemoteConnection
(byte[] commandBytes) INTERNAL: Deserialize the command and execute it.void
INTERNAL: Delegate to command processorvoid
propagateCommand
(Object command) ADVANCED: Propagate a remote command to all remote RCM services participating in the EclipseLink cluster.void
replaceLocalHostIPAddress
(String ipAddress) ADVANCED: Allow user to replace the $HOST subString of the local host URL with the user user input at runtime.void
replaceTransportPortNumber
(String portNumber) ADVANCED: Allow user to replace the $PORT subString of the local host URL with the user user input at runtime.void
setChannel
(String channel) ADVANCED: Set the service channel for this command manager.void
setCommandConverter
(CommandConverter newCommandConverter) ADVANCED: Set the converter instance that will be invoked by this CommandProcessor to convert commands from their application command format into EclipseLink Command objects before being propagated to remote command manager services.void
setCommandProcessor
(CommandProcessor newCommandProcessor) ADVANCED: Set the command processor that will be invoked to process commands.void
setSerializer
(Serializer serializer) PUBLIC: Set the Serializer to use for serialization of commands.void
setServerPlatform
(ServerPlatform theServerPlatform) PUBLIC: The ServerPlatform must be set manually when the RemoteCommandManager'CommandProcessor is not EclipseLink Session.void
setShouldPropagateAsynchronously
(boolean asyncMode) ADVANCED: Set whether this command manager should propagate commands synchronously or asynchronously.void
setTransportManager
(TransportManager newTransportManager) ADVANCED: Set a specific transport manager to manage sending and receiving of remote commands.void
ADVANCED: Set the URL for this command manager.boolean
boolean
shouldLogMessage
(int logLevel) INTERNAL:boolean
boolean
PUBLIC: Return whether this command manager should propagate commands synchronously or asynchronously.void
shutdown()
PUBLIC: Shut down the remote command manager.
-
Field Details
-
DEFAULT_CHANNEL
- See Also:
-
DEFAULT_ASYNCHRONOUS_MODE
public static final boolean DEFAULT_ASYNCHRONOUS_MODE- See Also:
-
serviceId
Uniquely identifies this service in the cluster -
discoveryManager
Manages the detection of new services as they join the cluster -
transportManager
Manages the transport level connections between command managers -
commandProcessor
Invoked to process a command when it is received from the cluster -
commandConverter
Used for converting commands between EclipseLink Command and app command formats -
isAsynchronous
protected boolean isAsynchronousDetermines whether propagation should be synchronous or asynchronous -
isEclipseLinkSession
protected boolean isEclipseLinkSessionDetermines whether profiling command should be send -
serverPlatform
Uniquely identifies ServerPlatform in the cluster -
serializer
Set the Serializer to use for serialization of commands. -
isStopped
protected boolean isStopped
-
-
Constructor Details
-
RemoteCommandManager
-
RemoteCommandManager
-
-
Method Details
-
initialize
public void initialize()PUBLIC: Initialize the remote command manager. This will also trigger the DiscoveryManager to start establishing the EclipseLink cluster.- Specified by:
initialize
in interfaceCommandManager
-
isStopped
public boolean isStopped()PUBLIC: Indicates whether the RCM has been stopped: either initialize hasn't been called or shutdown has been called. -
shutdown
public void shutdown()PUBLIC: Shut down the remote command manager. This will also trigger the DiscoveryManager to stop. NOTE: Although this call initiates the shutdown process, no guarantees are made as to when it will actually complete.- Specified by:
shutdown
in interfaceCommandManager
-
propagateCommand
ADVANCED: Propagate a remote command to all remote RCM services participating in the EclipseLink cluster.- Specified by:
propagateCommand
in interfaceCommandManager
- Parameters:
command
- An object representing a EclipseLink command
-
processCommandFromRemoteConnection
public void processCommandFromRemoteConnection(byte[] commandBytes) INTERNAL: Deserialize the command and execute it. -
processCommandFromRemoteConnection
INTERNAL: Delegate to command processor -
getCommandProcessor
Description copied from interface:CommandManager
PUBLIC: Return the command processor that processes commands received from the cluster.- Specified by:
getCommandProcessor
in interfaceCommandManager
- Returns:
- An implementation instance of CommandProcessor
-
setCommandProcessor
Description copied from interface:CommandManager
ADVANCED: Set the command processor that will be invoked to process commands. EclipseLink applications can implement this interface in order to receive remote commands from a EclipseLink cluster.- Specified by:
setCommandProcessor
in interfaceCommandManager
- Parameters:
newCommandProcessor
- The intended processor of remote commands
-
getTransportManager
Description copied from interface:CommandManager
PUBLIC: Return the transport manager that manages sending and receiving of remote commands.- Specified by:
getTransportManager
in interfaceCommandManager
- Returns:
- The TransportManager instance being used by this CommandManager
-
setTransportManager
Description copied from interface:CommandManager
ADVANCED: Set a specific transport manager to manage sending and receiving of remote commands.- Specified by:
setTransportManager
in interfaceCommandManager
- Parameters:
newTransportManager
- An instance of the desired transport manager type
-
handleException
INTERNAL: Delegate to the command procesor to handle the exception. -
newServiceDiscovered
INTERNAL: A new service has been detected by the discovery manager. Take the appropriate action to connect to the service. -
getDiscoveryManager
PUBLIC: Return the discovery manager that detects the arrival of new cluster members- Specified by:
getDiscoveryManager
in interfaceCommandManager
- Returns:
- The DiscoveryManager instance being used by this CommandManager
-
getCommandConverter
PUBLIC: Return the converter instance used to convert between EclipseLink Command objects and an application command format.- Specified by:
getCommandConverter
in interfaceCommandManager
- Returns:
- The converter being used by this CommandManager
-
setCommandConverter
ADVANCED: Set the converter instance that will be invoked by this CommandProcessor to convert commands from their application command format into EclipseLink Command objects before being propagated to remote command manager services. The converter will also be invoked to convert EclipseLink Command objects into application format before being sent to the CommandProcessor for execution.- Specified by:
setCommandConverter
in interfaceCommandManager
- Parameters:
newCommandConverter
- The converter to be used by this CommandManager
-
shouldLogMessage
public boolean shouldLogMessage(int logLevel) INTERNAL: -
shouldLogDebugMessage
public boolean shouldLogDebugMessage() -
shouldLogWarningMessage
public boolean shouldLogWarningMessage() -
logMessage
INTERNAL: -
logMessageWithoutLevelCheck
INTERNAL: Use this method in case the necessary logLevel has been confirmed by calling commandProcessor.shouldLogMessages method -
logDebug
INTERNAL: Convenience logging methods. -
logDebugWithoutLevelCheck
-
logInfo
-
logWarning
-
logWarningWithoutLevelCheck
-
logError
-
getServiceId
INTERNAL: Return the service info that identifies this service instance -
getChannel
PUBLIC: Return the service channel for this command manager. All command managers with the same service channel will send and receive commands from each other. Commands sent on other service channels will not be exchanged with this command manager.- Specified by:
getChannel
in interfaceCommandManager
- Returns:
- The service channel String subscribed to by this CommandManager
-
setChannel
ADVANCED: Set the service channel for this command manager. All command managers with the same service channel will send and receive commands from each other. Commands sent on other service channels will not be exchanged with this command manager.- Specified by:
setChannel
in interfaceCommandManager
- Parameters:
channel
- The service channel subscribed to by this CommandManager
-
isCommandProcessorASession
public boolean isCommandProcessorASession()INTERNAL: Return whether this command manager should process profile commands- Specified by:
isCommandProcessorASession
in interfaceCommandManager
-
getUrl
PUBLIC: Return the URL for this command manager.- Specified by:
getUrl
in interfaceCommandManager
- Returns:
- The URL String for this CommandManager
-
setUrl
ADVANCED: Set the URL for this command manager.- Specified by:
setUrl
in interfaceCommandManager
- Parameters:
url
- The URL String for this CommandManager
-
shouldPropagateAsynchronously
public boolean shouldPropagateAsynchronously()PUBLIC: Return whether this command manager should propagate commands synchronously or asynchronously. If set to synchronous propagation then propagateCommand() will not return to the caller until the command has been executed on all of the services in the cluster. In asynchronous mode the command manager will create a separate thread for each of the remote service executions, and then promptly return to the caller.- Specified by:
shouldPropagateAsynchronously
in interfaceCommandManager
-
setShouldPropagateAsynchronously
public void setShouldPropagateAsynchronously(boolean asyncMode) ADVANCED: Set whether this command manager should propagate commands synchronously or asynchronously. If set to synchronous propagation then propagateCommand() will not return to the caller until the command has been executed on all of the services in the cluster. In asynchronous mode the command manager will create a separate thread for each of the remote service executions, and then promptly return to the caller.- Specified by:
setShouldPropagateAsynchronously
in interfaceCommandManager
-
replaceLocalHostIPAddress
ADVANCED: Allow user to replace the $HOST subString of the local host URL with the user user input at runtime. By default, EclipseLink will try to discovery the local host IP and may fail due to security or network restrictions. In this case, user can call this API to specify the IP address or host name during pre-login session event or before session login. Example: If input is 145.23.127.79, the local host URL of ormi://$HOST:2971:/app_name will become ormi://145.23.127.79:2971:/app_name -
replaceTransportPortNumber
ADVANCED: Allow user to replace the $PORT subString of the local host URL with the user user input at runtime. In this case, user can call this API to specify the port number for a specific transport during pre-login session event or before session login. Example: If input is 7799, the local host URL of ormi://145.23.127.79:$PORT/app_name will become ormi://145.23.127.79:7799/app_name -
getServerPlatform
INTERNAL: Return the serverPlatform that identifies the application server -
setServerPlatform
PUBLIC: The ServerPlatform must be set manually when the RemoteCommandManager'CommandProcessor is not EclipseLink Session. When the CommandProcessor is a EclipseLink Session, the ServerPlatform is automatically gotten from the Session. -
getSerializer
PUBLIC: Return the Serializer to use for serialization of commands. -
setSerializer
PUBLIC: Set the Serializer to use for serialization of commands.
-