Class BroadcastRemoteConnection
- java.lang.Object
-
- org.eclipse.persistence.internal.sessions.coordination.RemoteConnection
-
- org.eclipse.persistence.internal.sessions.coordination.broadcast.BroadcastRemoteConnection
-
- All Implemented Interfaces:
java.io.Serializable
- Direct Known Subclasses:
JMSTopicRemoteConnection
public abstract class BroadcastRemoteConnection extends RemoteConnection
Purpose: Base class extending RemoteConnection for broadcasting RCM protocols: JMS and Oc4jJGroups.
Description: Defines lifecycle states and most of the methods, as well as exception processing and info logging.
- Since:
- OracleAS TopLink 11g (11.1.1)
- Author:
- Andrei Ilitchev
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.StringdisplayStringprotected java.lang.Object[]infoprotected java.lang.Object[]infoExtprotected RemoteCommandManagerrcmprotected java.lang.Stringstatestatic java.lang.StringSTATE_ACTIVEstatic java.lang.StringSTATE_CLOSEDstatic java.lang.StringSTATE_CLOSINGprotected java.lang.StringtopicName-
Fields inherited from class org.eclipse.persistence.internal.sessions.coordination.RemoteConnection
serviceId
-
-
Constructor Summary
Constructors Constructor Description BroadcastRemoteConnection(RemoteCommandManager rcm)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected booleanareAllResourcesFreedOnClose()INTERNAL: Indicates whether all the resources used by connection are freed after close method returns.voidclose()INTERNAL: This method is called when connection in no longer used and it's resources should be freed.protected abstract voidcloseInternal()INTERNAL: This method is called by close method.protected voidcreateDisplayString()INTERNAL:java.lang.ObjectexecuteCommand(byte[] command)INTERNAL: Publish the remote command.java.lang.ObjectexecuteCommand(Command command)INTERNAL: Publish the remote command.protected abstract java.lang.ObjectexecuteCommandInternal(java.lang.Object command)INTERNAL: Publish the remote command.protected voidfailDeserializeMessage(java.lang.String messageId, java.lang.Exception exception)INTERNAL: Call this message in case there is failure to extract the object (to be passed to processReceivedObject) from the message.protected java.lang.Object[]getInfo()INTERNAL:protected java.lang.Object[]getInfoExt()INTERNAL:java.lang.StringgetState()INTERNAL: State of the connection.java.lang.StringgetTopicName()INTERNAL:booleanisActive()INTERNAL: Connection is open for business.booleanisClosed()INTERNAL: Connection is closed - all resources were freed.booleanisClosing()INTERNAL: close method has been called.protected voidlogDebugAfterPublish(java.lang.Object[] debugInfo, java.lang.String messageId)INTERNAL: Called from executeCommandInternal to log debugInfo right after sending the message.protected java.lang.Object[]logDebugBeforePublish(java.lang.String messageId)INTERNAL: Called from executeCommandInternal to log debugInfo right before sending the message.protected voidlogDebugOnReceiveMessage(java.lang.String messageId)INTERNAL: Called when a message is received to log debugInfo: { toString(), messageId }.protected voidprocessReceivedObject(java.lang.Object object, java.lang.String messageId)INTERNAL: Process the object extracted from the received message.protected booleanshouldCheckServiceId()INTERNAL: Return whether a BroadcastConnection should check a ServiceId against its own ServiceId to avoid the processing of Commands with the same ServiceId.java.lang.StringtoString()INTERNAL:-
Methods inherited from class org.eclipse.persistence.internal.sessions.coordination.RemoteConnection
getServiceId, setServiceId
-
-
-
-
Field Detail
-
rcm
protected RemoteCommandManager rcm
-
topicName
protected java.lang.String topicName
-
STATE_ACTIVE
public static final java.lang.String STATE_ACTIVE
- See Also:
- Constant Field Values
-
STATE_CLOSING
public static final java.lang.String STATE_CLOSING
- See Also:
- Constant Field Values
-
STATE_CLOSED
public static final java.lang.String STATE_CLOSED
- See Also:
- Constant Field Values
-
state
protected java.lang.String state
-
displayString
protected java.lang.String displayString
-
info
protected java.lang.Object[] info
-
infoExt
protected java.lang.Object[] infoExt
-
-
Constructor Detail
-
BroadcastRemoteConnection
public BroadcastRemoteConnection(RemoteCommandManager rcm)
-
-
Method Detail
-
executeCommand
public java.lang.Object executeCommand(Command command) throws CommunicationException
INTERNAL: Publish the remote command. The result of execution is returned. This method is used only by external (publishing) connection.- Specified by:
executeCommandin classRemoteConnection- Throws:
CommunicationException
-
executeCommand
public java.lang.Object executeCommand(byte[] command) throws CommunicationExceptionINTERNAL: Publish the remote command. The result of execution is returned. This method is used only by external (publishing) connection.- Specified by:
executeCommandin classRemoteConnection- Throws:
CommunicationException
-
executeCommandInternal
protected abstract java.lang.Object executeCommandInternal(java.lang.Object command) throws java.lang.ExceptionINTERNAL: Publish the remote command. The result of execution is returned. This method is used only by external (publishing) connection.- Throws:
java.lang.Exception
-
logDebugBeforePublish
protected java.lang.Object[] logDebugBeforePublish(java.lang.String messageId)
INTERNAL: Called from executeCommandInternal to log debugInfo right before sending the message. Returns array {toString(), messageId }. In case messageId is null returns getInfoExt() avoiding creation of a new array.
-
logDebugAfterPublish
protected void logDebugAfterPublish(java.lang.Object[] debugInfo, java.lang.String messageId)INTERNAL: Called from executeCommandInternal to log debugInfo right after sending the message. Only call this method in case logDebugBeforePublish returned non-null this is indication that debug logging is enabled. Pass to this method debugInfo returned by logDebugBeforePublish. Need to pass messageId only in case it has changed since logDebugBeforePublish: some broadcasting protocols (JMS) don't generate messageId until the message is published.
-
logDebugOnReceiveMessage
protected void logDebugOnReceiveMessage(java.lang.String messageId)
INTERNAL: Called when a message is received to log debugInfo: { toString(), messageId }. This method is used by local (listening) connection only.
-
processReceivedObject
protected void processReceivedObject(java.lang.Object object, java.lang.String messageId)INTERNAL: Process the object extracted from the received message. Pass to this method messageInfo created by logDebugOnReceiveMessage method. This method is used by local (listening) connection only.
-
failDeserializeMessage
protected void failDeserializeMessage(java.lang.String messageId, java.lang.Exception exception)INTERNAL: Call this message in case there is failure to extract the object (to be passed to processReceivedObject) from the message. Pass to this method debugInfo created by logDebugOnReceiveMessage method. This method is used by local (listening) connection only.
-
close
public void close()
INTERNAL: This method is called when connection in no longer used and it's resources should be freed. As soon as this method is called the state is CLOSING. Usually the state is CLOSED just before the method returns, but there are some special cases (see comment to areAllResourcesFreedOnClose method) when the state is still CLOSING after the method returns.- Overrides:
closein classRemoteConnection
-
getState
public java.lang.String getState()
INTERNAL: State of the connection.
-
isActive
public boolean isActive()
INTERNAL: Connection is open for business.
-
isClosing
public boolean isClosing()
INTERNAL: close method has been called.
-
isClosed
public boolean isClosed()
INTERNAL: Connection is closed - all resources were freed.
-
closeInternal
protected abstract void closeInternal() throws java.lang.ExceptionINTERNAL: This method is called by close method. This method usually (but not always see comment to areAllResourcesFreedOnClose method) frees all the resources.- Throws:
java.lang.Exception
-
getTopicName
public java.lang.String getTopicName()
INTERNAL:
-
getInfo
protected java.lang.Object[] getInfo()
INTERNAL:
-
getInfoExt
protected java.lang.Object[] getInfoExt()
INTERNAL:
-
areAllResourcesFreedOnClose
protected boolean areAllResourcesFreedOnClose()
INTERNAL: Indicates whether all the resources used by connection are freed after close method returns. Usually that's the case. However in case of local (listening) JMSTopicRemoteConnection close merely indicates to the listening thread that it should free TopicConnection and exit. Note that it may take a while: the listening thread waits until subscriber.receive method either returns a message or throws an exception.
-
toString
public java.lang.String toString()
INTERNAL:- Overrides:
toStringin classRemoteConnection
-
createDisplayString
protected void createDisplayString()
INTERNAL:
-
shouldCheckServiceId
protected boolean shouldCheckServiceId()
INTERNAL: Return whether a BroadcastConnection should check a ServiceId against its own ServiceId to avoid the processing of Commands with the same ServiceId.- Returns:
- boolean
-
-