Package com.j_spaces.core
Class JSpaceContainerImpl
java.lang.Object
com.j_spaces.core.JSpaceContainerImpl
- All Implemented Interfaces:
IJSpaceContainerAdmin,IJSpaceContainer,Remote
A J-Space Server is a physical process (JVM) that has a J-Space Container instance. A J-Space
container manages the life cycle of J-Space instances. Life cycle operations include creation,
destruction and even moving a J-Space from one container to another. The J-Space container is a
remote object that implements the
IJSpaceContainer interface. A J-Space instance is
an instance of SpaceInternal, which implements the remote interface
ISpaceInternal. Each J-Space in a container has a unique name. This name can be used
after creation to receive a reference to the specific J-Space. The container is also responsible
for registering its J-Spaces in the lookup services in the environment and maintaining the leases
it receives. It is listening to new lookup services entering the environment and makes sure its
J-Spaces are registered to these lookup managers too. The container keeps a map between spaces
names and spaces attributes. All of the container information is kept in a persistent storage,
which is an XML file, under the [J-Spaces-Home]/config directory. The name of the container is
determined by a property in the JSpaces.properties file. The default is the name of the machine
J-Spaces is installed on. Using shutdown function container terminate LookupManager
and close space connection versus Storage adapters. A J-Space container may be launched as a
Unicast remote object or as an Activatable remote object.- Version:
- 1.0
- Author:
- Igor Goldenberg
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final int -
Constructor Summary
ConstructorsConstructorDescriptionJSpaceContainerImpl(LifeCycle lifeCycle, String schemaName, SpaceURL spaceURL, Properties schemaProperties) -
Method Summary
Modifier and TypeMethodDescriptioncreateSpace(String spaceName, JSpaceAttributes spaceAttr) Creates JSpace with unique space-name in this container and write the created space to appropriate Storage Adapter.voiddestroySpace(String spaceName) Destroying certain space in JSpace container and close connection with Storage Adapters(if opened).booleangetClusteredSpace(String spaceName) Returns a clustered proxy of the specified space.Get container configuration.intgetName()Returns name of container.Returns runtime configuration report: dump of the overall system configurations (spaces, container, cluster), system env, sys properties.Returns a proxy of the specified space.getSpaceAdmin(String spaceName) String[]Returns array of all JSpace names that exists in this JSpace container.longgetURL()Returns the SpaceURL object which initialized that specific container instance.inthashCode()static voidvoidping()Checks whether the container is alive and accessible.voidsetConfig(ContainerConfig config) Set new container configuration.voidshutdown()Shuts down this container.voidprotected voidRelease any remote objects associated with thisIJSpaceContainer.voidupdateContainerXMLTree(String spaceName, JSpaceAttributes spaceAttr) Building XML space tree inside [container-name].xml file.
-
Field Details
-
STARTING_STATUS
public static final int STARTING_STATUS- See Also:
-
RUNNING_STATUS
public static final int RUNNING_STATUS- See Also:
-
SHUTDOWN_STATUS
public static final int SHUTDOWN_STATUS- See Also:
-
-
Constructor Details
-
Method Details
-
getContainerEntry
-
getStartTime
public long getStartTime() -
initSecurity
public static void initSecurity() -
getRuntimeConfigReport
Description copied from interface:IJSpaceContainerAdminReturns runtime configuration report: dump of the overall system configurations (spaces, container, cluster), system env, sys properties.- Specified by:
getRuntimeConfigReportin interfaceIJSpaceContainerAdmin- Returns:
- runtime configuration report
-
getContainerProxy
-
unregister
protected void unregister()Release any remote objects associated with thisIJSpaceContainer. -
createSpace
public IJSpace createSpace(String spaceName, JSpaceAttributes spaceAttr) throws CreateException, RemoteException Creates JSpace with unique space-name in this container and write the created space to appropriate Storage Adapter. If space already exists in this containerCreateExceptionwill be throws. The created space will be registered with all discovered Lookup Services in the network. Created space will added to XML file.- Parameters:
spaceName- Space name for creating.spaceAttr- If spaceAttr.isPrivate == true this space will not register with LookupService and Rmi registry.- Returns:
- IJSpace Return collocated space if spaceAttr.isPrivate == true. If spaceAttr == null or spaceAttr.isPrivate == false return standard proxy.
- Throws:
CreateException- If thisspaceNamealready exists in JSpaceContainer, during creating space in Storage Adapter or ifspaceNamehas same name as container Name.RemoteException- Rmi remote exception.
-
destroySpace
Destroying certain space in JSpace container and close connection with Storage Adapters(if opened). This destroyed space will be unregistered with all Lookup Services on which was registered. Destroyed space will removed from XML file.- Parameters:
spaceName- JSpace name.- Throws:
DestroyedFailedException- During destroying JSpace in JSpace container.RemoteException- Rmi remote exception.
-
getSpaceNames
Returns array of all JSpace names that exists in this JSpace container.- Specified by:
getSpaceNamesin interfaceIJSpaceContainer- Returns:
- String[] All JSpace names that exists in this JSpace container.
- Throws:
RemoteException- Rmi remote exception.
-
getName
Returns name of container.- Specified by:
getNamein interfaceIJSpaceContainer- Specified by:
getNamein interfaceIJSpaceContainerAdmin- Returns:
- the name of this container.
-
getSpace
Description copied from interface:IJSpaceContainerReturns a proxy of the specified space.- Specified by:
getSpacein interfaceIJSpaceContainer- Parameters:
spaceName- the name of the space.- Returns:
- IJSpace space proxy.
- Throws:
NoSuchNameException- if the specified space does not exist in this container.
-
getClusteredSpace
Description copied from interface:IJSpaceContainerReturns a clustered proxy of the specified space.- Specified by:
getClusteredSpacein interfaceIJSpaceContainer- Parameters:
spaceName- the name of the space.- Returns:
- IJSpace clustered space proxy.
- Throws:
NoSuchNameException- if the specified space does not exist in this container.
-
getURL
Returns the SpaceURL object which initialized that specific container instance.
Note that the SpaceURL object contains importent information on the space and container configuration/setup such as the space url used, the space/container/cluster schema used and other attributes. The IJSpace keeps also its reference of the SpaceURL which loanched the space.- Specified by:
getURLin interfaceIJSpaceContainer- Returns:
- SpaceURL Returns the SpaceURL object which initialized that specific space instance.
- Throws:
RemoteException- See Also:
-
ping
public void ping()Description copied from interface:IJSpaceContainerChecks whether the container is alive and accessible.IJSpaceContainer aContainer = (IJSpaceContainer)SpaceFinder.find("jini://lookup-host/container-name"); try{ aContainer.ping(); System.out.println("Container alive"); } catch (java.rmi.RemoteException re) { System.out.println("Container unreachable"); }- Specified by:
pingin interfaceIJSpaceContainer
-
getSpaceAdmin
- Throws:
NoSuchNameException
-
shutdown
Description copied from interface:IJSpaceContainerShuts down this container. This also involves unregistering all registered spaces from Lookup services and closing connections to storage adapters.- Specified by:
shutdownin interfaceIJSpaceContainer- Throws:
RemoteException- if a communication error occurs
-
shutdownInternal
public void shutdownInternal() -
getContainerStatus
public int getContainerStatus() -
updateContainerXMLTree
Building XML space tree inside [container-name].xml file.- Parameters:
spaceName- JSpace name.spaceAttr- JSpace attributes.
-
getConfig
Description copied from interface:IJSpaceContainerAdminGet container configuration.- Specified by:
getConfigin interfaceIJSpaceContainerAdmin- Returns:
- ContainerConfig The container config structure.
- Throws:
RemoteException- Failed to retrieve container configuration.
-
setConfig
Description copied from interface:IJSpaceContainerAdminSet new container configuration.- Specified by:
setConfigin interfaceIJSpaceContainerAdmin- Parameters:
config- The container config structure.- Throws:
RemoteException- Failed to set new container configuration.
-
getSchemaName
- Returns:
- The requested schema name, to be used as the space/container configuration template.
-
getEmbeddedTransactionManager
-
equals
-
hashCode
public int hashCode()
-