Top Description Fields Constructors Methods
org.eclipse.persistence.sessions.coordination

public Class RemoteCommandManager

extends Object
implements CommandManager
Class Inheritance
All Implemented Interfaces
org.eclipse.persistence.sessions.coordination.CommandManager
Imports
java.net.InetAddress, org.eclipse.persistence.exceptions.RemoteCommandManagerException, org.eclipse.persistence.internal.helper.Helper, org.eclipse.persistence.internal.localization.LoggingLocalization, .TraceLocalization, org.eclipse.persistence.internal.sessions.AbstractSession, .DatabaseSessionImpl, .UnitOfWorkChangeSet, org.eclipse.persistence.internal.sessions.coordination.CommandPropagator, .RCMCommand, .RemoteConnection, org.eclipse.persistence.platform.server.ServerPlatform, org.eclipse.persistence.sessions.Session, .SessionProfiler, org.eclipse.persistence.sessions.coordination.rmi.RMITransportManager, org.eclipse.persistence.sessions.serializers.JavaSerializer, .Serializer

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.

Author
Steven Vo
Since
OracleAS TopLink 10g (9.0.4)
See Also
CommandManager, Command, CommandProcessor, CommandConverter, DiscoveryManager

Field Summary

Modifier and TypeField and Description
protected CommandConverter
commandConverter

Used for converting commands between EclipseLink Command and app command formats

protected CommandProcessor
commandProcessor

Invoked to process a command when it is received from the cluster

public static final boolean
public static final String
protected DiscoveryManager
discoveryManager

Manages the detection of new services as they join the cluster

protected boolean
isAsynchronous

Determines whether propagation should be synchronous or asynchronous

protected boolean
isEclipseLinkSession

Determines whether profiling command should be send

protected boolean
protected Serializer
serializer

Set the Serializer to use for serialization of commands.

protected ServerPlatform
serverPlatform

Uniquely identifies ServerPlatform in the cluster

protected ServiceId
serviceId

Uniquely identifies this service in the cluster

protected TransportManager
transportManager

Manages the transport level connections between command managers

Constructor Summary

AccessConstructor and Description
public
public
RemoteCommandManager(CommandProcessor commandProcessor, TransportManager transportManager)

Method Summary

Modifier and TypeMethod and Description
public String
getChannel()

Implements org.eclipse.persistence.sessions.coordination.CommandManager.getChannel.

PUBLIC: Return the service channel for this command manager.
public CommandConverter
getCommandConverter()

Implements org.eclipse.persistence.sessions.coordination.CommandManager.getCommandConverter.

PUBLIC: Return the converter instance used to convert between EclipseLink Command objects and an application command format.
public CommandProcessor
getCommandProcessor()

Implements org.eclipse.persistence.sessions.coordination.CommandManager.getCommandProcessor.

PUBLIC: Return the command processor that processes commands received from the cluster.
public DiscoveryManager
getDiscoveryManager()

Implements org.eclipse.persistence.sessions.coordination.CommandManager.getDiscoveryManager.

PUBLIC: Return the discovery manager that detects the arrival of new cluster members
public Serializer
getSerializer()

PUBLIC: Return the Serializer to use for serialization of commands.

public ServerPlatform
getServerPlatform()

INTERNAL: Return the serverPlatform that identifies the application server

public ServiceId
getServiceId()

INTERNAL: Return the service info that identifies this service instance

public TransportManager
getTransportManager()

Implements org.eclipse.persistence.sessions.coordination.CommandManager.getTransportManager.

PUBLIC: Return the transport manager that manages sending and receiving of remote commands.
public String
getUrl()

Implements org.eclipse.persistence.sessions.coordination.CommandManager.getUrl.

PUBLIC: Return the URL for this command manager.
public void
handleException(RuntimeException exception)

INTERNAL: Delegate to the command procesor to handle the exception.

public void
initialize()

Implements org.eclipse.persistence.sessions.coordination.CommandManager.initialize.

PUBLIC: Initialize the remote command manager.
public boolean
isCommandProcessorASession()

Implements org.eclipse.persistence.sessions.coordination.CommandManager.isCommandProcessorASession.

INTERNAL: Return whether this command manager should process profile commands
public boolean
isStopped()

PUBLIC: Indicates whether the RCM has been stopped: either initialize hasn't been called or shutdown has been called.

public void
logDebug(String message, Object[] args)

INTERNAL: Convenience logging methods.

public void
public void
logError(String message, Object[] args)

public void
logInfo(String message, Object[] args)

public void
logMessage(int logLevel, String message, Object[] args)

INTERNAL:

public void
logMessageWithoutLevelCheck(int logLevel, String message, Object[] args)

INTERNAL: Use this method in case the necessary logLevel has been confirmed by calling commandProcessor.shouldLogMessages method

public void
logWarning(String message, Object[] args)

public void
public void
newServiceDiscovered(ServiceId service)

INTERNAL: A new service has been detected by the discovery manager.

public void
processCommandFromRemoteConnection(byte[] commandBytes)

INTERNAL: Deserialize the command and execute it.

public void
processCommandFromRemoteConnection(Command command)

INTERNAL: Delegate to command processor

public void
propagateCommand(Object
An object representing a EclipseLink command
command
)

Implements org.eclipse.persistence.sessions.coordination.CommandManager.propagateCommand.

ADVANCED: Propagate a remote command to all remote RCM services participating in the EclipseLink cluster.
public void
replaceLocalHostIPAddress(String ipAddress)

ADVANCED: Allow user to replace the $HOST subString of the local host URL with the user user input at runtime.

public void
replaceTransportPortNumber(String portNumber)

ADVANCED: Allow user to replace the $PORT subString of the local host URL with the user user input at runtime.

public void
setChannel(String
The service channel subscribed to by this CommandManager
channel
)

Implements org.eclipse.persistence.sessions.coordination.CommandManager.setChannel.

ADVANCED: Set the service channel for this command manager.
public void
setCommandConverter(CommandConverter
The converter to be used by this CommandManager
newCommandConverter
)

Implements org.eclipse.persistence.sessions.coordination.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.
public void
setCommandProcessor(CommandProcessor
The intended processor of remote commands
newCommandProcessor
)

Implements org.eclipse.persistence.sessions.coordination.CommandManager.setCommandProcessor.

ADVANCED: Set the command processor that will be invoked to process commands.
public void
setSerializer(Serializer serializer)

PUBLIC: Set the Serializer to use for serialization of commands.

public void
setServerPlatform(ServerPlatform theServerPlatform)

PUBLIC: The ServerPlatform must be set manually when the RemoteCommandManager'CommandProcessor is not EclipseLink Session.

public void
setShouldPropagateAsynchronously(boolean asyncMode)

Implements org.eclipse.persistence.sessions.coordination.CommandManager.setShouldPropagateAsynchronously.

ADVANCED: Set whether this command manager should propagate commands synchronously or asynchronously.
public void
setTransportManager(TransportManager
An instance of the desired transport manager type
newTransportManager
)

Implements org.eclipse.persistence.sessions.coordination.CommandManager.setTransportManager.

ADVANCED: Set a specific transport manager to manage sending and receiving of remote commands.
public void
setUrl(String
The URL String for this CommandManager
url
)

Implements org.eclipse.persistence.sessions.coordination.CommandManager.setUrl.

ADVANCED: Set the URL for this command manager.
public boolean
public boolean
shouldLogMessage(int logLevel)

INTERNAL:

public boolean
public boolean
shouldPropagateAsynchronously()

Implements org.eclipse.persistence.sessions.coordination.CommandManager.shouldPropagateAsynchronously.

PUBLIC: Return whether this command manager should propagate commands synchronously or asynchronously.
public void
shutdown()

Implements org.eclipse.persistence.sessions.coordination.CommandManager.shutdown.

PUBLIC: Shut down the remote command manager.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

commandConverterback to summary
protected CommandConverter commandConverter

Used for converting commands between EclipseLink Command and app command formats

commandProcessorback to summary
protected CommandProcessor commandProcessor

Invoked to process a command when it is received from the cluster

DEFAULT_ASYNCHRONOUS_MODEback to summary
public static final boolean DEFAULT_ASYNCHRONOUS_MODE
DEFAULT_CHANNELback to summary
public static final String DEFAULT_CHANNEL
discoveryManagerback to summary
protected DiscoveryManager discoveryManager

Manages the detection of new services as they join the cluster

isAsynchronousback to summary
protected boolean isAsynchronous

Determines whether propagation should be synchronous or asynchronous

isEclipseLinkSessionback to summary
protected boolean isEclipseLinkSession

Determines whether profiling command should be send

isStoppedback to summary
protected boolean isStopped
serializerback to summary
protected Serializer serializer

Set the Serializer to use for serialization of commands.

serverPlatformback to summary
protected ServerPlatform serverPlatform

Uniquely identifies ServerPlatform in the cluster

serviceIdback to summary
protected ServiceId serviceId

Uniquely identifies this service in the cluster

transportManagerback to summary
protected TransportManager transportManager

Manages the transport level connections between command managers

Constructor Detail

RemoteCommandManagerback to summary
public RemoteCommandManager(CommandProcessor commandProcessor)
RemoteCommandManagerback to summary
public RemoteCommandManager(CommandProcessor commandProcessor, TransportManager transportManager)

Method Detail

getChannelback to summary
public String getChannel()

Implements org.eclipse.persistence.sessions.coordination.CommandManager.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.

Returns:String

Doc from org.eclipse.persistence.sessions.coordination.CommandManager.getChannel.

The service channel String subscribed to by this CommandManager

Annotations
@Override
getCommandConverterback to summary
public CommandConverter getCommandConverter()

Implements org.eclipse.persistence.sessions.coordination.CommandManager.getCommandConverter.

PUBLIC: Return the converter instance used to convert between EclipseLink Command objects and an application command format.

Returns:CommandConverter

Doc from org.eclipse.persistence.sessions.coordination.CommandManager.getCommandConverter.

The converter being used by this CommandManager

Annotations
@Override
getCommandProcessorback to summary
public CommandProcessor getCommandProcessor()

Implements org.eclipse.persistence.sessions.coordination.CommandManager.getCommandProcessor.

Doc from org.eclipse.persistence.sessions.coordination.CommandManager.getCommandProcessor.

PUBLIC: Return the command processor that processes commands received from the cluster.

Returns:CommandProcessor

An implementation instance of CommandProcessor

Annotations
@Override
getDiscoveryManagerback to summary
public DiscoveryManager getDiscoveryManager()

Implements org.eclipse.persistence.sessions.coordination.CommandManager.getDiscoveryManager.

PUBLIC: Return the discovery manager that detects the arrival of new cluster members

Returns:DiscoveryManager

Doc from org.eclipse.persistence.sessions.coordination.CommandManager.getDiscoveryManager.

The DiscoveryManager instance being used by this CommandManager

Annotations
@Override
getSerializerback to summary
public Serializer getSerializer()

PUBLIC: Return the Serializer to use for serialization of commands.

getServerPlatformback to summary
public ServerPlatform getServerPlatform()

INTERNAL: Return the serverPlatform that identifies the application server

getServiceIdback to summary
public ServiceId getServiceId()

INTERNAL: Return the service info that identifies this service instance

getTransportManagerback to summary
public TransportManager getTransportManager()

Implements org.eclipse.persistence.sessions.coordination.CommandManager.getTransportManager.

Doc from org.eclipse.persistence.sessions.coordination.CommandManager.getTransportManager.

PUBLIC: Return the transport manager that manages sending and receiving of remote commands.

Returns:TransportManager

The TransportManager instance being used by this CommandManager

Annotations
@Override
getUrlback to summary
public String getUrl()

Implements org.eclipse.persistence.sessions.coordination.CommandManager.getUrl.

PUBLIC: Return the URL for this command manager.

Returns:String

Doc from org.eclipse.persistence.sessions.coordination.CommandManager.getUrl.

The URL String for this CommandManager

Annotations
@Override
handleExceptionback to summary
public void handleException(RuntimeException exception)

INTERNAL: Delegate to the command procesor to handle the exception.

initializeback to summary
public void initialize()

Implements org.eclipse.persistence.sessions.coordination.CommandManager.initialize.

PUBLIC: Initialize the remote command manager. This will also trigger the DiscoveryManager to start establishing the EclipseLink cluster.

Annotations
@Override
isCommandProcessorASessionback to summary
public boolean isCommandProcessorASession()

Implements org.eclipse.persistence.sessions.coordination.CommandManager.isCommandProcessorASession.

INTERNAL: Return whether this command manager should process profile commands

Annotations
@Override
isStoppedback to summary
public boolean isStopped()

PUBLIC: Indicates whether the RCM has been stopped: either initialize hasn't been called or shutdown has been called.

logDebugback to summary
public void logDebug(String message, Object[] args)

INTERNAL: Convenience logging methods.

logDebugWithoutLevelCheckback to summary
public void logDebugWithoutLevelCheck(String message, Object[] args)
logErrorback to summary
public void logError(String message, Object[] args)
logInfoback to summary
public void logInfo(String message, Object[] args)
logMessageback to summary
public void logMessage(int logLevel, String message, Object[] args)

INTERNAL:

logMessageWithoutLevelCheckback to summary
public void logMessageWithoutLevelCheck(int logLevel, String message, Object[] args)

INTERNAL: Use this method in case the necessary logLevel has been confirmed by calling commandProcessor.shouldLogMessages method

logWarningback to summary
public void logWarning(String message, Object[] args)
logWarningWithoutLevelCheckback to summary
public void logWarningWithoutLevelCheck(String message, Object[] args)
newServiceDiscoveredback to summary
public void newServiceDiscovered(ServiceId service)

INTERNAL: A new service has been detected by the discovery manager. Take the appropriate action to connect to the service.

processCommandFromRemoteConnectionback to summary
public void processCommandFromRemoteConnection(byte[] commandBytes)

INTERNAL: Deserialize the command and execute it.

processCommandFromRemoteConnectionback to summary
public void processCommandFromRemoteConnection(Command command)

INTERNAL: Delegate to command processor

propagateCommandback to summary
public void propagateCommand(Object command)

Implements org.eclipse.persistence.sessions.coordination.CommandManager.propagateCommand.

ADVANCED: Propagate a remote command to all remote RCM services participating in the EclipseLink cluster.

Parameters
command:Object

An object representing a EclipseLink command

Annotations
@Override
replaceLocalHostIPAddressback to summary
public void replaceLocalHostIPAddress(String ipAddress)

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

replaceTransportPortNumberback to summary
public void replaceTransportPortNumber(String portNumber)

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

setChannelback to summary
public void setChannel(String channel)

Implements org.eclipse.persistence.sessions.coordination.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.

Parameters
channel:String

Doc from org.eclipse.persistence.sessions.coordination.CommandManager.setChannel.

The service channel subscribed to by this CommandManager

Annotations
@Override
setCommandConverterback to summary
public void setCommandConverter(CommandConverter newCommandConverter)

Implements org.eclipse.persistence.sessions.coordination.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.

Parameters
newCommandConverter:CommandConverter

Doc from org.eclipse.persistence.sessions.coordination.CommandManager.setCommandConverter.

The converter to be used by this CommandManager

Annotations
@Override
setCommandProcessorback to summary
public void setCommandProcessor(CommandProcessor newCommandProcessor)

Implements org.eclipse.persistence.sessions.coordination.CommandManager.setCommandProcessor.

Doc from org.eclipse.persistence.sessions.coordination.CommandManager.setCommandProcessor.

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.

Parameters
newCommandProcessor:CommandProcessor

The intended processor of remote commands

Annotations
@Override
setSerializerback to summary
public void setSerializer(Serializer serializer)

PUBLIC: Set the Serializer to use for serialization of commands.

setServerPlatformback to summary
public void setServerPlatform(ServerPlatform theServerPlatform)

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.

setShouldPropagateAsynchronouslyback to summary
public void setShouldPropagateAsynchronously(boolean asyncMode)

Implements org.eclipse.persistence.sessions.coordination.CommandManager.setShouldPropagateAsynchronously.

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.

Annotations
@Override
setTransportManagerback to summary
public void setTransportManager(TransportManager newTransportManager)

Implements org.eclipse.persistence.sessions.coordination.CommandManager.setTransportManager.

Doc from org.eclipse.persistence.sessions.coordination.CommandManager.setTransportManager.

ADVANCED: Set a specific transport manager to manage sending and receiving of remote commands.

Parameters
newTransportManager:TransportManager

An instance of the desired transport manager type

Annotations
@Override
setUrlback to summary
public void setUrl(String url)

Implements org.eclipse.persistence.sessions.coordination.CommandManager.setUrl.

ADVANCED: Set the URL for this command manager.

Parameters
url:String

Doc from org.eclipse.persistence.sessions.coordination.CommandManager.setUrl.

The URL String for this CommandManager

Annotations
@Override
shouldLogDebugMessageback to summary
public boolean shouldLogDebugMessage()
shouldLogMessageback to summary
public boolean shouldLogMessage(int logLevel)

INTERNAL:

shouldLogWarningMessageback to summary
public boolean shouldLogWarningMessage()
shouldPropagateAsynchronouslyback to summary
public boolean shouldPropagateAsynchronously()

Implements org.eclipse.persistence.sessions.coordination.CommandManager.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.

Annotations
@Override
shutdownback to summary
public void shutdown()

Implements org.eclipse.persistence.sessions.coordination.CommandManager.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.

Annotations
@Override