Package org.eclipse.ecf.provider.generic
Class SOContainer
java.lang.Object
org.eclipse.ecf.core.AbstractContainer
org.eclipse.ecf.provider.generic.SOContainer
- All Implemented Interfaces:
org.eclipse.core.runtime.IAdaptable,IContainer,IIdentifiable,IReliableContainer,ISharedObjectContainer
- Direct Known Subclasses:
ClientSOContainer,ServerSOContainer
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ISharedObjectContainerConfigstatic final Stringstatic final Stringprotected org.eclipse.ecf.provider.generic.SOContainerGMMprotected booleanprotected ThreadGroupprotected ISharedObjectPolicyprotected ISynchAsynchEventHandlerprotected SOManagerprotected ISharedObjectMessageSerializerprotected ThreadGroup -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanaddNewRemoteMember(ID memberID, Object data) protected ISharedObjectContainerTransactionaddSharedObject0(ID id, ISharedObject s, Map props) protected voidaddSharedObjectAndWait(ID id, ISharedObject s, Map properties) protected ISharedObjectContainerTransactionaddSharedObjectWrapper(SOWrapper wrapper) protected booleanaddToLoading(org.eclipse.ecf.provider.generic.SOContainer.LoadingSharedObject lso) protected ObjectcheckRemoteCreate(ID fromID, ID toID, ReplicaSharedObjectDescription desc) Check remote creation of shared objects.abstract voidconnect(ID groupID, IConnectContext connectContext) Connect to a target remote process or process group.protected MapcreateContainerPropertiesForSharedObject(ID sharedObjectID) protected SOConfigcreateRemoteSharedObjectConfig(ID fromID, ReplicaSharedObjectDescription sd, ISharedObject obj) protected SOContextcreateRemoteSharedObjectContext(SOConfig soconfig, IQueueEnqueue queue) protected SOWrapperprotected SOConfigcreateSharedObjectConfig(ID id, ISharedObject obj, Map props) protected SOContextcreateSharedObjectContext(SOConfig soconfig, IQueueEnqueue queue) protected SOWrappercreateSharedObjectWrapper(ID id, ISharedObject s, Map props) protected voidprotected ObjectdefaultDeserializeSharedObjectMessage(byte[] bytes) protected byte[]defaultSerializeSharedObjectMessage(ID sharedObjectID, Object message) static ContainerMessagedeserializeContainerMessage(byte[] bytes) protected ObjectdeserializeSharedObjectMessage(byte[] bytes) protected booleandestroySharedObject(ID sharedObjectID) abstract voidDisconnect.protected voiddisconnect(IConnection conn) voiddispose()Dispose this IContainer instance.protected voidfireDelegateContainerEvent(IContainerEvent containerEvent) protected final voidforward(ID fromID, ID toID, ContainerMessage data) protected abstract voidforwardExcluding(ID from, ID excluding, ContainerMessage data) protected abstract voidforwardToRemote(ID from, ID to, ContainerMessage data) getAdapter(Class adapter) This specialization of IAdaptable.getAdapter() returns additional services supported by this container.protected Object[]protected String[]protected ClassLoaderprotected ClassLoaderabstract IDGet the target ID that this container instance has connected to.Get the Namespace for creating a targetID suitable for use as the first parameter in subsequent calls toIContainer.connect(ID, IConnectContext).ID[]Get the current membership of the joined group.protected ObjectgetID()Return the ID for this 'identifiable' object.protected abstract IDgetIDForConnection(IAsynchConnection connection) protected intprotected ThreadgetNewSharedObjectThread(ID sharedObjectID, Runnable runnable) protected longprotected ID[]protected ISynchAsynchEventHandlerprotected ISharedObjectgetSharedObject(ID id) protected ID[]Get SharedObjectManager for this containerprotected ISharedObjectMessageSerializerprotected SOWrapperprotected voidhandleAsynchIOException(IOException except, AsynchEvent e) protected voidprotected voidprotected voidhandleLeave(ID leftID, IConnection conn) protected abstract voidprotected voidprotected voidprotected voidprotected voidprotected abstract voidprotected booleanabstract booleanprotected ISharedObjectprotected voidprotected voidnotifySharedObjectActivated(ID sharedObjectID) protected voidnotifySharedObjectDeactivated(ID sharedObjectID) protected static voidprintToSystemError(String message, Throwable t) protected voidprocessAsynch(AsynchEvent event) protected abstract voidprocessDisconnect(DisconnectEvent event) protected Serializableprotected abstract voidprotected voidremoveFromLoading(ID id) protected booleanremoveRemoteMember(ID remoteMember) protected ISharedObjectremoveSharedObject(ID id) protected voidsendCreate(ID sharedObjectID, ID toContainerID, SharedObjectDescription sd) protected voidsendCreateResponse(ID homeID, ID sharedObjectID, Throwable t, long identifier) protected voidsendCreateResponseSharedObjectMessage(ID toContainerID, ID fromSharedObject, Throwable t, long ident) protected ID[]sendCreateSharedObjectMessage(ID toContainerID, SharedObjectDescription sd) protected voidsendDispose(ID toContainerID, ID sharedObjectID) protected voidsendDisposeSharedObjectMessage(ID toContainerID, ID fromSharedObject) protected voidsendMessage(ID toContainerID, ID sharedObjectID, Object message) protected voidsendMessage(ContainerMessage data) protected voidsendSharedObjectMessage(ID toContainerID, ID fromSharedObject, Serializable data) static byte[]serialize(Serializable obj) protected byte[]serializeSharedObjectMessage(ID sharedObjectID, Object message) protected voidsetMaxGroupMembers(int max) protected voidvoidSet the shared object message serializer.protected voidtraceStack(String msg, Throwable e) protected ContainerMessageprotected booleanverifySharedObjectMessageTarget(ID containerID) protected booleanMethods inherited from class org.eclipse.ecf.core.AbstractContainer
addListener, fireContainerEvent, getPasswordFromConnectContext, removeListenerMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.eclipse.ecf.core.IContainer
addListener, removeListener
-
Field Details
-
DEFAULT_OBJECT_ARG_KEY
-
DEFAULT_OBJECT_ARGTYPES_KEY
-
config
-
groupManager
protected org.eclipse.ecf.provider.generic.SOContainerGMM groupManager -
isClosing
protected boolean isClosing -
loadingThreadGroup
-
policy
-
receiver
-
-
Constructor Details
-
Method Details
-
getID
Description copied from interface:IIdentifiableReturn the ID for this 'identifiable' object. The returned ID should be unique within its namespace. May returnnull.- Specified by:
getIDin interfaceIIdentifiable- Returns:
- the ID for this identifiable object. May return
null.
-
connect
public abstract void connect(ID groupID, IConnectContext connectContext) throws ContainerConnectException Description copied from interface:IContainerConnect to a target remote process or process group. The target identified by the first parameter (targetID) is connected the implementation class. If authentication information is required, the required information is given via via the second parameter (connectContext). Callers note that depending upon the provider implementation this method may block. It is suggested that callers use a separate thread to call this method. This method provides an implementation independent way for container implementations to connect, authenticate, and communicate with a remote service or group of services. Providers are responsible for implementing this operation in a way appropriate to the given remote service (or group) via expected protocol.- Specified by:
connectin interfaceIContainer- Parameters:
groupID- the ID of the remote server or group to connect to. SeeIContainer.getConnectNamespace()for a explanation of the constraints upon this parameter.connectContext- any required context to allow this container to authenticate. May benullif underlying provider does not have any authentication requirements for connection.- Throws:
ContainerConnectException- thrown if communication cannot be established with remote service. Causes can include network connection failure, authentication failure, server error, or if container is already connected.
-
getConnectedID
Description copied from interface:IContainerGet the target ID that this container instance has connected to. Returns null if not connected.- Specified by:
getConnectedIDin interfaceIContainer- Returns:
- ID of the target we are connected to. Returns
nullif container not connected.
-
disconnect
public abstract void disconnect()Description copied from interface:IContainerDisconnect. This operation will disconnect the local container instance from any previously joined target or group. Subsequent calls to getConnectedID() will returnnull.- Specified by:
disconnectin interfaceIContainer
-
getConnectNamespace
Description copied from interface:IContainerGet the Namespace for creating a targetID suitable for use as the first parameter in subsequent calls toIContainer.connect(ID, IConnectContext). If this method returnsnull, then it means thatnullis expected as a valid parameter in subsequent calls toIContainer.connect(ID, IConnectContext). If this method returns a non-nullNamespace, then thetargetIDparameter inIContainer.connect(ID, IConnectContext)must be non-nullinstance created of the returned Namespace.- Specified by:
getConnectNamespacein interfaceIContainer- Returns:
- Namespace the namespace associated with subsequent calls to
IContainer.connect(ID, IConnectContext). Ifnull, then thetargetIDinstances passed toIContainer.connect(ID, IConnectContext)may benull. If notnull, thentargetIDinstances passed toIContainer.connect(ID, IConnectContext)must be instances of the returned Namespace.
-
dispose
public void dispose()Description copied from interface:IContainerDispose this IContainer instance. The container instance will be made inactive after the completion of this method and will be unavailable for subsequent usage.- Specified by:
disposein interfaceIContainer- Overrides:
disposein classAbstractContainer
-
getAdapter
Description copied from interface:IContainerThis specialization of IAdaptable.getAdapter() returns additional services supported by this container. A container that supports additional services over and above the methods onIContainershould return them using this method. It is recommended that clients use this method rather than instanceof checks and downcasts to find out about the capabilities of a specific container.Typically, after obtaining an IContainer, a client would use this method as a means to obtain a more meaningful interface to the container. This interface may or may not extend IContainer. For example, a client could use the following code to obtain an instance of ISharedObjectContainer:
IContainer newContainer = ContainerFactory.createContainer(type); ISharedObjectContainer soContainer = (ISharedObjectContainer) newContainer .getAdapter(ISharedObjectContainer.class); if (soContainer == null) throw new ContainerCreateException(message);Implementations of this method should delegate to
IAdapterManager.loadAdapter()if the service cannot be provided directly to ensure extensibility by third-party plug-ins.- Specified by:
getAdapterin interfaceorg.eclipse.core.runtime.IAdaptable- Specified by:
getAdapterin interfaceIContainer- Overrides:
getAdapterin classAbstractContainer- Parameters:
adapter- the service type to look up- Returns:
- the service instance castable to the given class, or
nullif this container does not support the given service
-
getGroupMemberIDs
Description copied from interface:IReliableContainerGet the current membership of the joined group. This method will accurately report the current group membership of the connected group.- Specified by:
getGroupMemberIDsin interfaceIReliableContainer- Returns:
- ID[] the IDs of the current group membership
-
getConfig
-
isGroupManager
public abstract boolean isGroupManager()- Specified by:
isGroupManagerin interfaceIReliableContainer- Returns:
- true if this IReliableContainer instance is in the 'manager' role for the group, false otherwise.
-
addNewRemoteMember
-
debug
-
traceStack
-
forward
- Throws:
IOException
-
forwardExcluding
protected abstract void forwardExcluding(ID from, ID excluding, ContainerMessage data) throws IOException - Throws:
IOException
-
forwardToRemote
- Throws:
IOException
-
serialize
- Throws:
IOException
-
getClassLoaderForContainer
-
getGroupMembershipLock
-
getMaxGroupMembers
protected int getMaxGroupMembers() -
getNextSequenceNumber
protected long getNextSequenceNumber() -
deserializeContainerMessage
- Throws:
IOException
-
printToSystemError
- Parameters:
message- messaget- exception to print to system error- Since:
- 2.0
-
getOtherMemberIDs
-
getReceiver
-
getMessageReceiver
- Returns:
- ISynchAsyncEventHandler message receiver
- Since:
- 4.7
-
handleAsynchIOException
-
handleCreateMessage
- Throws:
IOException
-
handleCreateResponseMessage
- Throws:
IOException
-
handleLeaveGroupMessage
- Parameters:
mess- leave group message
-
handleUnidentifiedMessage
- Parameters:
mess- message- Throws:
IOException- not thrown by this implementation.
-
handleViewChangeMessage
- Throws:
IOException
-
isClosing
protected boolean isClosing() -
disconnect
-
handleLeave
-
moveFromLoadingToActive
-
validateContainerMessage
-
processAsynch
- Parameters:
event- event- Throws:
IOException- not thrown by this implementation.
-
getIDForConnection
-
processDisconnect
-
processSynch
- Throws:
IOException
-
queueContainerMessage
- Throws:
IOException
-
removeFromLoading
-
removeRemoteMember
-
sendCreateResponse
protected void sendCreateResponse(ID homeID, ID sharedObjectID, Throwable t, long identifier) throws IOException - Throws:
IOException
-
sendDispose
- Throws:
IOException
-
sendMessage
- Throws:
IOException
-
sendMessage
- Throws:
IOException
-
setMaxGroupMembers
protected void setMaxGroupMembers(int max) -
fireDelegateContainerEvent
- Parameters:
containerEvent- container event