public abstract class AbstractSystemAdapter extends AbstractPlatformConnectorComponent implements GeneratedDataReceivingComponent, TaskReceivingComponent
| Modifier and Type | Field and Description |
|---|---|
private Exception |
cause
The cause for an unusual termination.
|
private Semaphore |
causeMutex
Mutex used to manage access to the
cause object. |
private Semaphore |
currentlyProcessedMessages
Semaphore used to control the number of data messages that can be
processed in parallel.
|
private Semaphore |
currentlyProcessedTasks
Semaphore used to control the number of tasks that can be processed in
parallel.
|
protected RabbitQueue |
dataGen2SystemQueue
Queue from the data generator to this evaluation storage.
|
private static int |
DEFAULT_MAX_PARALLEL_PROCESSED_MESSAGES
Default value of the
maxParallelProcessedMsgs attribute. |
private static org.slf4j.Logger |
LOGGER |
private int |
maxParallelProcessedMsgs
The maximum number of incoming messages of a single queue that are
processed in parallel.
|
protected RabbitQueue |
system2EvalStoreQueue
Queue from the benchmarked system to this evaluation storage.
|
protected org.apache.jena.rdf.model.Model |
systemParamModel
The RDF model containing the system parameters.
|
protected RabbitQueue |
taskGen2SystemQueue
Queue from the task generator to this evaluation storage.
|
private Semaphore |
terminateMutex
Mutex used to wait for the terminate signal.
|
cmdChannel, cmdConnection, defaultContainerTypeconnectionFactory, dataConnection, NUMBER_OF_RETRIES_TO_CONNECT_TO_RABBIT_MQ, rabbitMQHostName, START_WAITING_TIME_BEFORE_RETRY| Constructor and Description |
|---|
AbstractSystemAdapter()
Constructor using the
DEFAULT_MAX_PARALLEL_PROCESSED_MESSAGES=
100. |
AbstractSystemAdapter(int maxParallelProcessedMsgs)
Constructor setting the maximum number of messages processed in parallel.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
init()
This method initializes the component.
|
void |
receiveCommand(byte command,
byte[] data)
This method is called if a command is received and might be interesting
for this particular component.
|
void |
run()
This method executes the component.
|
protected void |
sendResultToEvalStorage(String taskIdString,
byte[] data)
This method sends the given result data for the task with the given task
id to the evaluation storage.
|
protected void |
terminate(Exception cause)
Starts termination of the main thread of this system adapter.
|
addContainerObserver, createContainer, createDefaultRabbitQueue, stopContaineraddCommandHeaderId, createContainer, createContainer, handleCmd, sendToCmdQueue, sendToCmdQueue, sendToCmdQueuegenerateSessionQueueName, getHobbitSessionIdclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitreceiveGeneratedDatareceiveGeneratedTaskprivate static final org.slf4j.Logger LOGGER
private static final int DEFAULT_MAX_PARALLEL_PROCESSED_MESSAGES
maxParallelProcessedMsgs attribute.private Semaphore terminateMutex
private Exception cause
private Semaphore currentlyProcessedMessages
private Semaphore currentlyProcessedTasks
private final int maxParallelProcessedMsgs
protected RabbitQueue dataGen2SystemQueue
protected RabbitQueue taskGen2SystemQueue
protected RabbitQueue system2EvalStoreQueue
protected org.apache.jena.rdf.model.Model systemParamModel
public AbstractSystemAdapter()
DEFAULT_MAX_PARALLEL_PROCESSED_MESSAGES=
100.public AbstractSystemAdapter(int maxParallelProcessedMsgs)
maxParallelProcessedMsgs - The maximum number of incoming messages of a single queue that
are processed in parallel. Additional messages have to wait.public void init()
throws Exception
Componentinit in interface Componentinit in class AbstractCommandReceivingComponentException - if an error occurs during the initializationpublic void run()
throws Exception
Componentpublic void receiveCommand(byte command,
byte[] data)
CommandReceivingComponentreceiveCommand in interface CommandReceivingComponentreceiveCommand in class AbstractPlatformConnectorComponentcommand - the byte encoding the commanddata - additional data that was sent together with the commandprotected void sendResultToEvalStorage(String taskIdString, byte[] data) throws IOException
taskIdString - the id of the taskdata - the data of the taskIOException - if there is an error during the sendingprotected void terminate(Exception cause)
cause - the cause for an abortion of the process or {code null} if the
component should terminate in a normal way.public void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class AbstractCommandReceivingComponentIOExceptionCopyright © 2017. All rights reserved.