public abstract class AbstractEventSpace extends AbstractSpace implements EventSpace, SpaceWithParticipants
Modifier | Constructor and Description |
---|---|
|
AbstractEventSpace(spaceId : SpaceID,
participantListener : SpaceParticipantListener,
logger : LoggingService)
Constructor.
|
protected |
AbstractEventSpace(spaceId : SpaceID,
participantListener : SpaceParticipantListener,
loggingService : LoggingService,
strongRepository : ConcurrentMap<UUID,Participant>,
weakRepository : ConcurrentMap<UUID,Participant>)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
emit(eventSource : UUID,
event : Event,
scope : Scope<Address>)
Emits the event inside this space with the given scope.
|
protected void |
emitLocally(event : Event,
scope : Scope<? super Address>)
Do the emission of the event.
|
protected void |
ensureEventSource(eventSource : UUID,
event : Event)
Ensure that the given event has a source.
|
void |
forEachStrongParticipant(callback : (UUID)=>void)
Apply the given procedure to each of the strong participants.
|
void |
forEachStrongParticipant(callback : (UUID,Participant)=>void)
Apply the given procedure to each of the strong participants.
|
void |
forEachWeakParticipant(callback : (UUID)=>void)
Apply the given procedure to each of the weak participants.
|
void |
forEachWeakParticipant(callback : (UUID,Participant)=>void)
Apply the given procedure to each of the weak participants.
|
Address |
getAddress(id : UUID)
Returns the address of the agent identified by
id . |
EventTransportService |
getEventTransportService() |
EventListener |
getListenerFromStrongParticipant(target : UUID)
Replies the event listener with the given identifier into the registered strong participants.
|
Logger |
getLogger() |
int |
getNumberOfStrongParticipants()
Replies the number of strong participants to the space.
|
int |
getNumberOfWeakParticipants()
Replies the number of strong participants to the space.
|
ConcurrentLinkedDeque<Participant> |
getScopedParticipants(scope : Scope<? super Address>)
Replies the participants that matches the given scope.
|
SpaceParticipantListener |
getSpaceParticipantListener() |
boolean |
isPseudoEmpty(id : UUID)
Replies if the space is empty or the given identifier is associated to the only one participant to the space.
|
protected Address |
registerToSpace(entity : EventListener,
weakParticipant : boolean)
Register the specified entity on this space
|
void |
setEventTransportService(router : EventTransportService)
Set the event router.
|
protected Address |
unregisterFromSpace(entity : EventListener) |
fireDestroyableSpace, getSpaceID, setSpaceListenerIfNone, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
emit
getSpaceID, isPseudoEmpty
getSpaceID, isPseudoEmpty
isPseudoEmpty
public new
(spaceId : SpaceID,
participantListener : SpaceParticipantListener,
logger : LoggingService)
id
- identifier of the space.lockProvider
- the provider of synchronization locks.participantListener
- the platform listener on participant events.logger
- the logger service.protected new
(spaceId : SpaceID,
participantListener : SpaceParticipantListener,
loggingService : LoggingService,
strongRepository : ConcurrentMap<UUID,Participant>,
weakRepository : ConcurrentMap<UUID,Participant>)
id
- identifier of the space.lockProvider
- the provider of synchronization locks.participantListener
- the platform listener on participant events.logger
- the logger service.@Inject
public def
setEventTransportService(router : EventTransportService) : void
AbstractEventSpace
router
- the router.protected final def
registerToSpace(entity : EventListener,
weakParticipant : boolean) : Address
AbstractEventSpace
entity
- - the entity to be registeredweakParticipant
- - boolean specifying if the specified entity may prevent the space
from the destruction if it is the only remaining entity within this space.
A Weak participant will not prevent the space from begin destroyed if it is the only one staying in it, a Strong participant will prevent it.
A space containing only Weak participants will be destroyed by the SRE Kernelprotected final def
unregisterFromSpace(entity : EventListener) : Address
@Pure
public def
getAddress(id : UUID) : Address
EventSpace
id
.getAddress
in interface EventSpace
id
- the agent's id.public final def
emit(eventSource : UUID,
event : Event,
scope : Scope<Address>) : void
EventSpace
This function does not change the source of the event if it was set.
If the given event has no specified source, the emit function uses the
eventSource
parameter to set the source's address.
emit
in interface EventSpace
eventSource
- the sender of the event.event
- the event to emit in the space.scope
- the definition of the list of receivers of the event.protected def
ensureEventSource(eventSource : UUID,
event : Event) : void
AbstractEventSpace
eventSource
- the source of the event.event
- the event to emit.@Pure
public def
getScopedParticipants(scope : Scope<? super Address>) : ConcurrentLinkedDeque<Participant>
AbstractEventSpace
scope
- the scope.protected def
emitLocally(event : Event,
scope : Scope<? super Address>) : void
AbstractEventSpace
This function emits the event only on the internal event bus of the listeners.
This function launch a task for each matching listener.
event
- the event to emit.scope
- description of the scope of the event, i.e. the receivers of the event.@Pure
public def
getNumberOfStrongParticipants() : int
Space
getNumberOfStrongParticipants
in interface Space
@Pure
public def
getNumberOfWeakParticipants() : int
Space
getNumberOfWeakParticipants
in interface Space
@Pure
public def
isPseudoEmpty(id : UUID) : boolean
Space
isPseudoEmpty
in interface Space
id
- the identifier to test.true
if space if empty or the identifier is associated to the only one participant.public def
forEachStrongParticipant(callback : (UUID)=>void) : void
Space
forEachStrongParticipant
in interface Space
callback
- the lambda to invoke.public def
forEachWeakParticipant(callback : (UUID)=>void) : void
Space
forEachWeakParticipant
in interface Space
callback
- the lambda to invoke.public def
forEachStrongParticipant(callback : (UUID,Participant)=>void) : void
SpaceWithParticipants
forEachStrongParticipant
in interface SpaceWithParticipants
callback
- the lambda to invoke.public def
forEachWeakParticipant(callback : (UUID,Participant)=>void) : void
SpaceWithParticipants
forEachWeakParticipant
in interface SpaceWithParticipants
callback
- the lambda to invoke.@Pure
public def
getListenerFromStrongParticipant(target : UUID) : EventListener
SpaceWithParticipants
getListenerFromStrongParticipant
in interface SpaceWithParticipants
target
- the identifier of the event listener to search for.null
if there is no event listener found.@Pure
public def
getLogger() : Logger
@Pure
public def
getEventTransportService() : EventTransportService
@Pure
public def
getSpaceParticipantListener() : SpaceParticipantListener
Copyright © 2021 the original authors or authors.