Package org.hobbit.core.components
Class AbstractEvaluationStorage
java.lang.Object
org.hobbit.core.components.AbstractComponent
org.hobbit.core.components.AbstractCommandReceivingComponent
org.hobbit.core.components.AbstractPlatformConnectorComponent
org.hobbit.core.components.AbstractEvaluationStorage
- All Implemented Interfaces:
Closeable,AutoCloseable,CommandReceivingComponent,Component,ExpectedResponseReceivingComponent,PlatformConnector,ResponseReceivingComponent
- Direct Known Subclasses:
InMemoryEvaluationStore
public abstract class AbstractEvaluationStorage
extends AbstractPlatformConnectorComponent
implements ResponseReceivingComponent, ExpectedResponseReceivingComponent
This abstract class implements basic functions that can be used to implement
a task generator.
- Author:
- Michael Röder (roeder@informatik.uni-leipzig.de)
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected com.rabbitmq.client.ChannelChannel on which the acknowledgements are send.private static final intDefault value of themaxParallelProcessedMsgsattribute.private static final byte[]The empty response that is sent if an error occurs.protected RabbitQueueThe incoming queue from the evaluation module.private static final org.slf4j.Loggerprivate final intThe maximum number of incoming messages of a single queue that are processed in parallel.static final byteIf a request contains this iterator ID, a new iterator is created and its first result as well as its Id are returned.static final Stringprotected List<Iterator<? extends ResultPair>>Iterators that have been started.protected DataReceiverThe incoming queue from the system.protected DataReceiverThe incoming queue from the task generator.private SemaphoreMutex used to wait for the termination signal.Fields inherited from class org.hobbit.core.components.AbstractCommandReceivingComponent
cmdChannel, cmdQueueFactory, cmdResponseTimeout, DEFAULT_CMD_RESPONSE_TIMEOUT, defaultContainerType, gson, reportUnhandledExceptionsFields inherited from class org.hobbit.core.components.AbstractComponent
configuration, connectionFactory, incomingDataQueueFactory, NUMBER_OF_RETRIES_TO_CONNECT_TO_RABBIT_MQ, outgoingDataQueuefactory, rabbitMQHostName, START_WAITING_TIME_BEFORE_RETRY -
Constructor Summary
ConstructorsConstructorDescriptionConstructor using theDEFAULT_MAX_PARALLEL_PROCESSED_MESSAGES= 50.AbstractEvaluationStorage(int maxParallelProcessedMsgs) Constructor setting the maximum number of messages processed in parallel. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()protected abstract Iterator<? extends ResultPair>Creates a new iterator that iterates over the response pairs.voidinit()This method initializes the component.voidreceiveCommand(byte command, byte[] data) This method is called if a command is received and might be interesting for this particular component.voidrun()This method executes the component.Methods inherited from class org.hobbit.core.components.AbstractPlatformConnectorComponent
addContainerObserver, createContainer, getFactoryForIncomingCmdQueues, getFactoryForIncomingDataQueues, getFactoryForOutgoingCmdQueues, getFactoryForOutgoingDataQueues, stopContainerMethods inherited from class org.hobbit.core.components.AbstractCommandReceivingComponent
addCommandHeaderId, createContainer, createContainer, createContainer, createContainerAsync, createContainerAsync, extendContainerEnvVariables, getCmdResponseTimeout, handleCmd, handleCmd, isReportUnhandledExceptions, reportAndWrap, reportError, reportErrorSavely, reportExceptionSavely, reportUnhandledExceptionSavely, sendToCmdQueue, sendToCmdQueue, sendToCmdQueue, setCmdResponseTimeout, setReportUnhandledExceptionsMethods inherited from class org.hobbit.core.components.AbstractComponent
createConnection, generateSessionQueueName, getConfiguration, getHobbitSessionId, setConfigurationMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.hobbit.core.components.Component
setConfigurationMethods inherited from interface org.hobbit.core.components.ExpectedResponseReceivingComponent
receiveExpectedResponseDataMethods inherited from interface org.hobbit.core.components.ResponseReceivingComponent
receiveResponseData
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
RECEIVE_TIMESTAMP_FOR_SYSTEM_RESULTS_KEY
- See Also:
-
NEW_ITERATOR_ID
public static final byte NEW_ITERATOR_IDIf a request contains this iterator ID, a new iterator is created and its first result as well as its Id are returned.- See Also:
-
EMPTY_RESPONSE
private static final byte[] EMPTY_RESPONSEThe empty response that is sent if an error occurs. -
DEFAULT_MAX_PARALLEL_PROCESSED_MESSAGES
private static final int DEFAULT_MAX_PARALLEL_PROCESSED_MESSAGESDefault value of themaxParallelProcessedMsgsattribute.- See Also:
-
terminationMutex
Mutex used to wait for the termination signal. -
maxParallelProcessedMsgs
private final int maxParallelProcessedMsgsThe maximum number of incoming messages of a single queue that are processed in parallel. Additional messages have to wait. -
resultPairIterators
Iterators that have been started. -
taskResultReceiver
The incoming queue from the task generator. -
systemResultReceiver
The incoming queue from the system. -
evalModule2EvalStoreQueue
The incoming queue from the evaluation module. -
ackChannel
protected com.rabbitmq.client.Channel ackChannelChannel on which the acknowledgements are send.
-
-
Constructor Details
-
AbstractEvaluationStorage
public AbstractEvaluationStorage()Constructor using theDEFAULT_MAX_PARALLEL_PROCESSED_MESSAGES= 50. -
AbstractEvaluationStorage
public AbstractEvaluationStorage(int maxParallelProcessedMsgs) Constructor setting the maximum number of messages processed in parallel.- Parameters:
maxParallelProcessedMsgs- The maximum number of incoming messages of a single queue that are processed in parallel. Additional messages have to wait.
-
-
Method Details
-
init
Description copied from interface:ComponentThis method initializes the component.- Specified by:
initin interfaceComponent- Overrides:
initin classAbstractCommandReceivingComponent- Throws:
Exception- if an error occurs during the initialization
-
createIterator
Creates a new iterator that iterates over the response pairs.- Returns:
- a new iterator or null if an error occurred
-
run
Description copied from interface:ComponentThis method executes the component. -
receiveCommand
public void receiveCommand(byte command, byte[] data) Description copied from interface:CommandReceivingComponentThis method is called if a command is received and might be interesting for this particular component.- Specified by:
receiveCommandin interfaceCommandReceivingComponent- Overrides:
receiveCommandin classAbstractPlatformConnectorComponent- Parameters:
command- the byte encoding the commanddata- additional data that was sent together with the command
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classAbstractCommandReceivingComponent- Throws:
IOException
-