Class AbstractThreadedQueuingConnector<O,I,CO,CI,M extends ModelAccess>
java.lang.Object
de.iip_ecosphere.platform.connectors.AbstractConnector<O,I,CO,CI>
de.iip_ecosphere.platform.connectors.AbstractThreadedConnector<O,I,CO,CI,M>
de.iip_ecosphere.platform.connectors.AbstractThreadedQueuingConnector<O,I,CO,CI,M>
- Type Parameters:
O- the output type from the underlying machine/platformI- the input type to the underlying machine/platformCO- the output type of the connectorCI- the input type of the connectorM- the model access type of the connector
- All Implemented Interfaces:
Connector<O,,I, CO, CI> EventHandlingConnector,AbstractModelAccess.NotificationChangedListener
public abstract class AbstractThreadedQueuingConnector<O,I,CO,CI,M extends ModelAccess>
extends AbstractThreadedConnector<O,I,CO,CI,M>
Queues incoming data for sequential delayed processing. Further, provides a reusable base for connectors that
require a
ModelAccess instance per calling thread.
Call startQueueProcessing() in AbstractConnector.connectImpl(ConnectorParameter) and stopQueueProcessing()
in AbstractConnector.disconnectImpl().- Author:
- Holger Eichelberger, SSE
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate classProcesses the queue.Nested classes/interfaces inherited from class de.iip_ecosphere.platform.connectors.AbstractConnector
AbstractConnector.BasicAdapterProvider -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final SharedBuffer<CI> private final AbstractThreadedQueuingConnector<O,I, CO, CI, M>.QueueProcessor Fields inherited from class de.iip_ecosphere.platform.connectors.AbstractConnector
DEFAULT_CHANNEL -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractThreadedQueuingConnector(AdapterSelector<O, I, CO, CI> selector, ProtocolAdapter<O, I, CO, CI>... adapter) Creates an instance and installs the protocol adapter(s).protectedAbstractThreadedQueuingConnector(ProtocolAdapter<O, I, CO, CI>... adapter) Creates an instance and installs the protocol adapter(s) with a default selector for the first adapter. -
Method Summary
Modifier and TypeMethodDescriptionprivate voidThe original implementation ofwrite(Object), overwritten for queuing in this class.protected voidStarts queue processing.protected voidStops queue processing.voidWrites the givendatato the underlying machine/platform.Methods inherited from class de.iip_ecosphere.platform.connectors.AbstractThreadedConnector
configureAdapter, connect, getCleanupPeriod, getModelAccess, getModelAccess, getModelAccessSupplier, setCleanupPeriod, setModelAccessSupplier, uninstallPollTaskMethods inherited from class de.iip_ecosphere.platform.connectors.AbstractConnector
checkCache, configureModelAccess, connectImpl, createTlsContext, disconnect, disconnectImpl, dispose, doPolling, enableNotifications, enablePolling, error, getCachingStrategy, getCachingStrategyCls, getConnectorInputType, getConnectorOutputType, getConnectorParameter, getInitCachingStrategyCls, getInstanceIdentification, getProtocolInputType, getProtocolOutputType, getSelector, getStorageValue, initializeModelAccess, initSelector, installPollTask, isPolling, notificationsChanged, notifyDataTimeDifference, notifyReconfigured, read, received, received, request, request, setDataTimeDifference, setDataTimeDifferenceProvider, setInstanceIdentification, setReceptionCallback, setStorageValue, trigger, trigger, useTls, writeImplMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface de.iip_ecosphere.platform.connectors.Connector
createSharedSpace, disconnectSafe, enabledEncryption, enableSharedSpace, enumerateFields, enumerateFields, setReceptionCallbackSafe, supportedEncryptionMethods inherited from interface de.iip_ecosphere.platform.connectors.events.EventHandlingConnector
getName
-
Field Details
-
queue
-
queueProcessor
private final AbstractThreadedQueuingConnector<O,I, queueProcessorCO, CI, M extends ModelAccess>.QueueProcessor
-
-
Constructor Details
-
AbstractThreadedQueuingConnector
Creates an instance and installs the protocol adapter(s) with a default selector for the first adapter. For integration compatibility, connector constructors are supposed to accept a var-arg parameter for adapters.- Parameters:
adapter- the protocol adapter(s)- Throws:
IllegalArgumentException- ifadapteris null or empty or adapters are null- See Also:
-
AbstractThreadedQueuingConnector
@SafeVarargs protected AbstractThreadedQueuingConnector(AdapterSelector<O, I, CO, CI> selector, ProtocolAdapter<O, I, CO, CI>... adapter) Creates an instance and installs the protocol adapter(s). For integration compatibility, connector constructors are supposed to accept a var-arg parameter for adapters.- Parameters:
selector- the adapter selector (null leads to a default selector for the first adapter)adapter- the protocol adapter(s)- Throws:
IllegalArgumentException- ifadapteris null or empty or adapters are null- See Also:
-
-
Method Details
-
startQueueProcessing
protected void startQueueProcessing()Starts queue processing. If not called, data is queued but not processed. -
stopQueueProcessing
protected void stopQueueProcessing()Stops queue processing. -
write
Description copied from interface:ConnectorWrites the givendatato the underlying machine/platform. -
origWrite
The original implementation ofwrite(Object), overwritten for queuing in this class. Writes the givendatato the underlying machine/platform.- Parameters:
data- the data to send tostream- Throws:
IOException- in case that problems during the connection happens
-