Class SharedExecutorProtocolHolderFactory
java.lang.Object
pt.unl.fct.di.novasys.babel2.core.SharedExecutorProtocolHolderFactory
- All Implemented Interfaces:
BabelProtocolHolderFactory
public final class SharedExecutorProtocolHolderFactory
extends Object
implements BabelProtocolHolderFactory
Factory for creating
SharedExecutorProtocolHolder instances that share a common
fixed thread pool executor.-
Constructor Summary
ConstructorsConstructorDescriptionSharedExecutorProtocolHolderFactory(int numberOfThreads, int processBeforeYield, boolean stopAfterException, int maxQueueCapacity) Constructs a factory with a shared thread pool and protocol execution parameters. -
Method Summary
Modifier and TypeMethodDescriptioncreateInstance(BabelProtocol protocol, Set<ProtocolExtension<? extends BabelProtocol>> extensions) Creates a newBabelProtocolHolderwrapping the given protocol and extensions.
-
Constructor Details
-
SharedExecutorProtocolHolderFactory
public SharedExecutorProtocolHolderFactory(int numberOfThreads, int processBeforeYield, boolean stopAfterException, int maxQueueCapacity) Constructs a factory with a shared thread pool and protocol execution parameters.- Parameters:
numberOfThreads- the number of worker threads in the shared poolprocessBeforeYield- maximum number of events a protocol may process before yielding the worker threadstopAfterException- whether to halt the holder if an uncaught exception is thrownmaxQueueCapacity- the maximum capacity of each protocol's event queue
-
-
Method Details
-
createInstance
public BabelProtocolHolder createInstance(BabelProtocol protocol, Set<ProtocolExtension<? extends BabelProtocol>> extensions) Description copied from interface:BabelProtocolHolderFactoryCreates a newBabelProtocolHolderwrapping the given protocol and extensions.- Specified by:
createInstancein interfaceBabelProtocolHolderFactory- Parameters:
protocol- the protocol instance to wrapextensions- the set of protocol extensions configured for the protocol- Returns:
- a new
BabelProtocolHoldermanaging the protocol
-