Package pt.unl.fct.di.novasys.babel.core
Class GenericProtocol
java.lang.Object
pt.unl.fct.di.novasys.babel.core.GenericProtocol
- Direct Known Subclasses:
PhiTest.PhiProto
,TimerProto
An abstract class that represent a generic protocol
This class handles all interactions required by protocols
Users should extend this class to implement their protocols
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionGenericProtocol
(String protoName, short protoId) Create a generic protocol with the provided name and numeric identifier and network serviceGenericProtocol
(String protoName, short protoId, BlockingQueue<InternalEvent> policy) Creates a generic protocol with the provided name and numeric identifier and the given event queue policy. -
Method Summary
Modifier and TypeMethodDescriptionfinal short
Returns the numeric identifier of the protocolfinal String
Returns the name of the protocolabstract void
init
(Properties props) Initializes the protocol with the given propertiesfinal void
start()
Start the execution thread of the protocol
-
Constructor Details
-
GenericProtocol
Creates a generic protocol with the provided name and numeric identifier and the given event queue policy.Event queue policies can be defined to specify handling events in desired orders: Eg. If multiple events are inside the queue, then timers are always processes first than any other event in the queue.
- Parameters:
protoName
- the protocol nameprotoId
- the protocol numeric identifierpolicy
- the queue policy to use
-
GenericProtocol
Create a generic protocol with the provided name and numeric identifier and network serviceThe internal event queue is defined to have a FIFO policy on all events
- Parameters:
protoName
- name of the protocolprotoId
- numeric identifier
-
-
Method Details
-
getProtoId
public final short getProtoId()Returns the numeric identifier of the protocol- Returns:
- numeric identifier
-
getProtoName
Returns the name of the protocol- Returns:
- name
-
init
Initializes the protocol with the given properties- Parameters:
props
- properties- Throws:
HandlerRegistrationException
IOException
-
start
public final void start()Start the execution thread of the protocol -
getMetrics
-