Package jadex.platform.service.daemon
Class DaemonService
- java.lang.Object
-
- jadex.platform.service.daemon.DaemonService
-
- All Implemented Interfaces:
IDaemonService
public class DaemonService extends java.lang.Object implements IDaemonService
The daemon service.
-
-
Field Summary
Fields Modifier and Type Field Description protected IInternalAccess
agent
The agent.protected java.util.Map<java.lang.String,Future<IComponentIdentifier>>
futures
The futures waiting for starting platforms.protected java.util.List<IRemoteChangeListener<IComponentIdentifier>>
listeners
The listeners.protected java.util.Map<IComponentIdentifier,java.lang.Process>
platforms
The started platforms.-
Fields inherited from interface jadex.bridge.service.types.daemon.IDaemonService
ADDED, REMOVED
-
-
Constructor Summary
Constructors Constructor Description DaemonService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IFuture<java.lang.Void>
addChangeListener(IRemoteChangeListener<IComponentIdentifier> listener)
Add a change listener.protected IFuture<StartOptions>
adjustOptions(StartOptions opt)
Create or adjust options (e.g.IFuture<java.util.Set<IComponentIdentifier>>
getPlatforms()
Get the component identifiers of all (managed) platforms.protected void
messageReceived(IComponentIdentifier cid, java.lang.String pid)
Called from agent when a handshake message is recieved.protected void
notifyListeners(ChangeEvent<IComponentIdentifier> event)
Notify the listeners.IFuture<java.lang.Void>
removeChangeListener(IRemoteChangeListener<IComponentIdentifier> listener)
Remove a change listener.IFuture<java.lang.Void>
shutdownPlatform(IComponentIdentifier cid)
Shutdown a platform.void
start()
Start the service.IFuture<java.lang.Void>
startPlatform(StartOptions options)
Start a platform using a configuration.IFuture<java.lang.Void>
startPlatform(StartOptions options, long wait)
Start a platform using a configuration.IFuture<IComponentIdentifier>
startPlatformAndWait(StartOptions options)
Start a platform using a configuration.
-
-
-
Field Detail
-
agent
protected IInternalAccess agent
The agent.
-
platforms
protected java.util.Map<IComponentIdentifier,java.lang.Process> platforms
The started platforms.
-
futures
protected java.util.Map<java.lang.String,Future<IComponentIdentifier>> futures
The futures waiting for starting platforms.
-
listeners
protected java.util.List<IRemoteChangeListener<IComponentIdentifier>> listeners
The listeners.
-
-
Method Detail
-
start
public void start()
Start the service.
-
messageReceived
protected void messageReceived(IComponentIdentifier cid, java.lang.String pid)
Called from agent when a handshake message is recieved.
-
startPlatform
public IFuture<java.lang.Void> startPlatform(StartOptions options)
Start a platform using a configuration. Performs no checking if the new platform runs.- Specified by:
startPlatform
in interfaceIDaemonService
- Parameters:
options
- The start arguments.
-
startPlatform
public IFuture<java.lang.Void> startPlatform(StartOptions options, long wait)
Start a platform using a configuration. Wait for some time to check if the platform doesn't fail. Only detects, if the new platform process exits during that time.- Specified by:
startPlatform
in interfaceIDaemonService
- Parameters:
options
- The start arguments.
-
startPlatformAndWait
public IFuture<IComponentIdentifier> startPlatformAndWait(StartOptions options)
Start a platform using a configuration. Wait for successful handshake and return the component identifier of the new platform. Successful handshake means that the init phase of the new platform, including starting of initial components, has completed successfully.- Specified by:
startPlatformAndWait
in interfaceIDaemonService
- Parameters:
opt
- The start arguments.
-
adjustOptions
protected IFuture<StartOptions> adjustOptions(StartOptions opt)
Create or adjust options (e.g. fill in classpath) if necessary.
-
shutdownPlatform
public IFuture<java.lang.Void> shutdownPlatform(IComponentIdentifier cid)
Shutdown a platform.- Specified by:
shutdownPlatform
in interfaceIDaemonService
- Parameters:
cid
- The platform id.
-
getPlatforms
public IFuture<java.util.Set<IComponentIdentifier>> getPlatforms()
Get the component identifiers of all (managed) platforms.- Specified by:
getPlatforms
in interfaceIDaemonService
- Returns:
- Collection of platform ids.
-
addChangeListener
public IFuture<java.lang.Void> addChangeListener(IRemoteChangeListener<IComponentIdentifier> listener)
Add a change listener.- Specified by:
addChangeListener
in interfaceIDaemonService
- Parameters:
listener
- The change listener.
-
removeChangeListener
public IFuture<java.lang.Void> removeChangeListener(IRemoteChangeListener<IComponentIdentifier> listener)
Remove a change listener.- Specified by:
removeChangeListener
in interfaceIDaemonService
- Parameters:
listener
- The change listener.
-
notifyListeners
protected void notifyListeners(ChangeEvent<IComponentIdentifier> event)
Notify the listeners.
-
-