Class BusImplementation
java.lang.Object
org.palladiosimulator.analyzer.slingshot.eventdriver.internal.BusImplementation
- All Implemented Interfaces:
Bus
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
acceptEvents
(boolean accept) Sets whether events can be posted to this bus or not.void
Closes the registration of subscribers.The unique identifer of this bus.void
Posts an event and calls each handler that are subscribed to, if the interceptors allow that.void
Registers an object that contains method annotated bySubscribe
annotations.<T> void
register
(Subscriber<T> subscriber) Registers a subscriber for the event of typeT
.void
unregister
(Object object) Unregisters either an object containing subscriber methods, or a certain subscriber through the name.
-
Constructor Details
-
BusImplementation
-
BusImplementation
public BusImplementation()
-
-
Method Details
-
getIdentifier
Description copied from interface:Bus
The unique identifer of this bus. This can be generated or provided by the user.- Specified by:
getIdentifier
in interfaceBus
- Returns:
- The unique identifier.
-
register
Description copied from interface:Bus
Registers a subscriber for the event of typeT
. The subscriber holds a name that is used to identify it and later be unsubscribed again usingBus.unregister(Object)
. -
register
Description copied from interface:Bus
Registers an object that contains method annotated bySubscribe
annotations. This object must also be annotated withOnEvent
s to be correctly registered. The id of these subscribers will be the full canonical name of the method (including the name of the class). -
unregister
Description copied from interface:Bus
Unregisters either an object containing subscriber methods, or a certain subscriber through the name. That is, theobject
parameter can be an arbitrary object of subscriber methods, or of typeString
that identifies a certain subscriber. Afterwards, those affected subscribers will be ignored upon the respective events.- Specified by:
unregister
in interfaceBus
- Parameters:
object
- The object holding the subscriber methods OR the id of the subscriber as a String.
-
post
Description copied from interface:Bus
Posts an event and calls each handler that are subscribed to, if the interceptors allow that. -
closeRegistration
public void closeRegistration()Description copied from interface:Bus
Closes the registration of subscribers. After this method is called, it is not possible to register new objects.- Specified by:
closeRegistration
in interfaceBus
-
acceptEvents
public void acceptEvents(boolean accept) Description copied from interface:Bus
Sets whether events can be posted to this bus or not.- Specified by:
acceptEvents
in interfaceBus
- Parameters:
accept
- A flag saying whether events can be posted here. Iftrue
, then events can be posted (default behavior). Iffalse
, events are not allowed to be posted here until it is opened again.
-