public class JSpaceContainerImpl extends Object implements IJSpaceContainer, IJSpaceContainerAdmin
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.Modifier and Type | Class and Description |
---|---|
static class |
JSpaceContainerImpl.ContainerEntry |
Modifier and Type | Field and Description |
---|---|
static int |
RUNNING_STATUS |
static int |
SHUTDOWN_STATUS |
static int |
STARTING_STATUS |
Constructor and Description |
---|
JSpaceContainerImpl(LifeCycle lifeCycle,
String schemaName,
SpaceURL spaceURL,
Properties schemaProperties) |
Modifier and Type | Method and Description |
---|---|
IJSpace |
createSpace(String spaceName,
JSpaceAttributes spaceAttr)
Creates JSpace with unique space-name in this container and write the created space to
appropriate Storage Adapter.
|
void |
destroySpace(String spaceName)
Destroying certain space in JSpace container and close connection with Storage Adapters(if
opened).
|
IJSpace |
getClusteredSpace(String spaceName)
Returns a clustered proxy of the specified space.
|
ContainerConfig |
getConfig()
Get container configuration.
|
JSpaceContainerImpl.ContainerEntry |
getContainerEntry() |
IJSpaceContainer |
getContainerProxy() |
int |
getContainerStatus() |
TransactionManager |
getEmbeddedTransactionManager() |
String |
getName()
Returns name of container.
|
String |
getRuntimeConfigReport()
Returns runtime configuration report: dump of the overall system configurations (spaces,
container, cluster), system env, sys properties.
|
String |
getSchemaName() |
IJSpace |
getSpace(String spaceName)
Returns a proxy of the specified space.
|
IRemoteJSpaceAdmin |
getSpaceAdmin(String spaceName) |
String[] |
getSpaceNames()
Returns array of all JSpace names that exists in this JSpace container.
|
long |
getStartTime() |
SpaceURL |
getURL()
Returns the SpaceURL object which initialized that specific container instance.
|
void |
ping()
Checks whether the container is alive and accessible.
|
void |
setConfig(ContainerConfig config)
Set new container configuration.
|
void |
shutdown()
Shuts down this container.
|
void |
shutdownInternal() |
protected void |
unregister()
Release any remote objects associated with this
IJSpaceContainer . |
void |
updateContainerXMLTree(String spaceName,
JSpaceAttributes spaceAttr)
Building XML space tree inside [container-name].xml file.
|
public static final int STARTING_STATUS
public static final int RUNNING_STATUS
public static final int SHUTDOWN_STATUS
public JSpaceContainerImpl.ContainerEntry getContainerEntry()
public long getStartTime()
public String getRuntimeConfigReport()
IJSpaceContainerAdmin
getRuntimeConfigReport
in interface IJSpaceContainerAdmin
public IJSpaceContainer getContainerProxy()
protected void unregister()
IJSpaceContainer
.public IJSpace createSpace(String spaceName, JSpaceAttributes spaceAttr) throws CreateException, RemoteException
CreateException
will be throws. The created space will be registered with all
discovered Lookup Services in the network. Created space will added to XML file.spaceName
- Space name for creating.spaceAttr
- If spaceAttr.isPrivate == true this space will not register with
LookupService and Rmi registry.CreateException
- If this spaceName
already exists in JSpaceContainer,
during creating space in Storage Adapter or if spaceName
has same name as container Name.RemoteException
- Rmi remote exception.public void destroySpace(String spaceName) throws DestroyedFailedException, RemoteException
spaceName
- JSpace name.DestroyedFailedException
- During destroying JSpace in JSpace container.RemoteException
- Rmi remote exception.public String[] getSpaceNames() throws RemoteException
getSpaceNames
in interface IJSpaceContainer
RemoteException
- Rmi remote exception.public String getName()
getName
in interface IJSpaceContainerAdmin
getName
in interface IJSpaceContainer
public IJSpace getSpace(String spaceName) throws NoSuchNameException
IJSpaceContainer
getSpace
in interface IJSpaceContainer
spaceName
- the name of the space.NoSuchNameException
- if the specified space does not exist in this container.public IJSpace getClusteredSpace(String spaceName) throws NoSuchNameException
IJSpaceContainer
getClusteredSpace
in interface IJSpaceContainer
spaceName
- the name of the space.NoSuchNameException
- if the specified space does not exist in this container.public SpaceURL getURL() throws RemoteException
getURL
in interface IJSpaceContainer
RemoteException
IJSpaceContainer.getURL()
public void ping()
IJSpaceContainer
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");
}
ping
in interface IJSpaceContainer
public IRemoteJSpaceAdmin getSpaceAdmin(String spaceName) throws NoSuchNameException
NoSuchNameException
public void shutdown() throws RemoteException
IJSpaceContainer
shutdown
in interface IJSpaceContainer
RemoteException
- if a communication error occurspublic void shutdownInternal()
public int getContainerStatus()
public void updateContainerXMLTree(String spaceName, JSpaceAttributes spaceAttr)
spaceName
- JSpace name.spaceAttr
- JSpace attributes.public ContainerConfig getConfig() throws RemoteException
IJSpaceContainerAdmin
getConfig
in interface IJSpaceContainerAdmin
RemoteException
- Failed to retrieve container configuration.public void setConfig(ContainerConfig config) throws RemoteException
IJSpaceContainerAdmin
setConfig
in interface IJSpaceContainerAdmin
config
- The container config structure.RemoteException
- Failed to set new container configuration.public String getSchemaName()
public TransactionManager getEmbeddedTransactionManager()
Copyright © GigaSpaces.