io.sarl.sre.janus
Class Kernel
@javax.inject.Singleton
class Kernel
extends java.lang.Object
This class represents the Kernel of the SRE platform.

The Kernel is a singleton.

The Kernel is assimilated to an agent that is omniscient and distributed other the network. It is containing all the other agents.
Maven Group Identifier:
io.sarl.sre.janus
Maven Artifact Identifier:
janus.kernel
Property Summary
Modifier and type Property and description
SreConfig configuration
java.util.logging.Logger logger
Replies the logger used by the kernel.
AgentContext rootContext
Replies the SRE context of the kernel.
Nested Type Summary
Modifier and type Type and description
protected class Kernel.AsynchronousKernelStoppingListener
Asynchronous listener on platform events.
Constructor Summary
Constructor and description
new(Provider<T>,Provider<T>,Provider<T>,Provider<T>)
Constructs a SRE kernel.
Action Summary
Modifier and type Action and description
protected AsynchronousKernelStoppingListener createKernelListener
Create an instance of the kernel event listener.
SreConfig getConfiguration
java.util.logging.Logger getLogger
Replies the logger used by the kernel.
AgentContext getRootContext
Replies the SRE context of the kernel.
S getService(Class<T>)
Replies a kernel service that is alive.
boolean isRunning
Replies if the kernel is running or not.
void shutdown([int])
Shutdown the kernel.
void spawn(Class<T>,Object*)
Spawn an agent of the given type, and pass the parameters to its initialization function.
void spawn(int,Class<T>,Object*)
Spawn agents of the given type, and pass the parameters to its initialization function.
void spawn(UUID,Class<T>,Object*)
Spawn an agent of the given type, and pass the parameters to its initialization function.
Property Details
configuration
val configuration : SreConfig

This property is an alias for the action: getConfiguration

logger
val logger : java.util.logging.Logger
Replies the logger used by the kernel.

This function replies the logger of the logging service. If this service is down, null is replied.

This property is an alias for the action: getLogger

Returns:
the logger of the kernel.
rootContext
val rootContext : AgentContext
Replies the SRE context of the kernel.

This property is an alias for the action: getRootContext

Returns:
the context for the kernel.
Constructor Details
new(Provider<T>,Provider<T>,Provider<T>,Provider<T>)
new(Provider<T>,Provider<T>,Provider<T>,Provider<T>)
Constructs a SRE kernel.
Parameters:
serviceManager - is the instance of the service manager that must be used by the kernel. The service manager must already have registered services inside itself.
exceptionHandler - is the handler of the uncaught exceptions.
configuration - is the provider of SRE configuration.
factories - is the provider of the factories tool.
Action Details
createKernelListener
protected def createKernelListener : AsynchronousKernelStoppingListener
Create an instance of the kernel event listener.
Returns:
the listener instance.
Since:
0.8.0
getConfiguration
def getConfiguration : SreConfig
getLogger
def getLogger : java.util.logging.Logger
Replies the logger used by the kernel.

This function replies the logger of the logging service. If this service is down, null is replied.
Returns:
the logger of the kernel.
getRootContext
def getRootContext : AgentContext
Replies the SRE context of the kernel.
Returns:
the context for the kernel.
getService(Class<T>)
def getService(Class<T>) : S

with S extends org.arakhne.afc.services.IService

Replies a kernel service that is alive.
Parameters:
<S> - - type of the type to reply.
type - type of the type to reply.
Returns:
the service, or null .
isRunning
def isRunning : boolean
Replies if the kernel is running or not.

The kernel is running if at least one agent is alive.
Returns:
true if the kernel is running; false otherwise.
shutdown([int])
def shutdown([int])
Shutdown the kernel.
Parameters:
timeout - the maximum amount of milliseconds to wait for the shutdown. If the provided value is strictly positive, it is the number of milliseconds to wait for the termination of the shutdown. If the provided value is equal to 0, the function returns as soon as the shutdown process is launch (no waiting for the termination of the shutdown). If the value is strictly negative, the function waits forever for the termination of the shutdown process. The default value is -1.
Since:
0.10
spawn(Class<T>,Object*)
def spawn(Class<T>,Object*)
Spawn an agent of the given type, and pass the parameters to its initialization function.
Parameters:
agent - the type of the agent to spawn.
arguments - the list of the parameters to pass to the agent initialization function.
spawn(int,Class<T>,Object*)
def spawn(int,Class<T>,Object*)
Spawn agents of the given type, and pass the parameters to its initialization function.
Parameters:
nbAgents - the number of agents to spawn.
agent - the type of the agents to spawn.
params - the list of the parameters to pass to the agent initialization function.
spawn(UUID,Class<T>,Object*)
def spawn(UUID,Class<T>,Object*)
Spawn an agent of the given type, and pass the parameters to its initialization function.
Parameters:
agentID - the identifier of the agent to spawn. If null the identifier is randomly selected.
agent - the type of the agent to spawn.
params - the list of the parameters to pass to the agent initialization function.