@Singleton public abstract class AbstractContextService extends AbstractSreService implements ContextService
This service is thread-safe.
Modifier | Constructor and Description |
---|---|
protected |
AbstractContextService(rootContext : Context)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
Context |
createContext(contextID : UUID,
defaultSpaceID : UUID,
owner : Agent)
Create a new context instance and register it into the internal repository.
|
Context |
createContextWithoutRegistration(contextID : UUID,
defaultSpaceID : UUID,
owner : Agent)
Create a new context instance and do not register it into the repository.
|
Context |
getContext(contextID : UUID)
Replies an existing context instance.
|
protected abstract ConcurrentHashMap<UUID,Context> |
getContextInternalStructure()
Replies the internal data structure for storing the contexts.
|
Context |
getRootContext()
Replies the root context.
|
protected abstract Context |
newContextInstance(contextID : UUID,
defaultSpaceID : UUID,
owner : Agent)
Create a context instance.
|
void |
onStart()
Do something when starting the service.
|
void |
onStop()
Do something when stopping the service.
|
Context |
removeContext(contextID : UUID)
Remove the context instance.
|
doStart, doStop
addListener, awaitRunning, awaitRunning, awaitTerminated, awaitTerminated, doCancelStart, failureCause, isRunning, notifyFailed, notifyStarted, notifyStopped, startAsync, state, stopAsync, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getAllContexts
protected new
(rootContext : Context)
rootContext
- the root context.lock
- is the lock that must be used by this service.public def
onStart() : void
AbstractSreService
This function is called from AbstractSreService.doStart()
onStart
in class AbstractSreService
public def
onStop() : void
AbstractSreService
This function is called from AbstractSreService.doStop()
onStop
in class AbstractSreService
protected abstract def
getContextInternalStructure() : ConcurrentHashMap<UUID,Context>
AbstractContextService
This function is not thread-safe.
public final def
createContextWithoutRegistration(contextID : UUID,
defaultSpaceID : UUID,
owner : Agent) : Context
ContextService
createContextWithoutRegistration
in interface ContextService
contextID
- the id of the context to create.defaultSpaceID
- the id of the default space of the context to create.owner
- is the owner of the context. If null
, the context is the root context.public final def
createContext(contextID : UUID,
defaultSpaceID : UUID,
owner : Agent) : Context
ContextService
createContext
in interface ContextService
contextID
- the id of the context to create.defaultSpaceID
- the id of the default space of the context to create.owner
- is the owner of the context. If null
, the context is the root context.public def
getContext(contextID : UUID) : Context
ContextService
getContext
in interface ContextService
contextID
- the id of the context to createnull
.public def
removeContext(contextID : UUID) : Context
ContextService
removeContext
in interface ContextService
contextID
- the id of the context to removenull
.protected abstract def
newContextInstance(contextID : UUID,
defaultSpaceID : UUID,
owner : Agent) : Context
AbstractContextService
contextID
- the identifier of the context.defaultSpaceId
- the identifier of the default space in the context.owner
- is the owner of the context. If null
, the context is the root context@Pure
public def
getRootContext() : Context
ContextService
getRootContext
in interface ContextService
Copyright © 2020 the original authors or authors.