Module org.refcodes.io.ext.observer
Package org.refcodes.io.ext.observer
Class ObservableConnectionTransmitter<DATA extends Serializable,CON>
java.lang.Object
org.refcodes.io.ext.observer.ObservableConnectionTransmitter<DATA,CON>
- Type Parameters:
DATA- The type of the datagram to be operated with.CON- The type of the connection to be used.
- All Implemented Interfaces:
Flushable,org.refcodes.component.Closable,org.refcodes.component.Closable.CloseAutomaton,org.refcodes.component.ClosedAccessor,org.refcodes.component.Component,org.refcodes.component.ConnectableComponent,org.refcodes.component.ConnectableComponent.ConnectableAutomaton,org.refcodes.component.ConnectionComponent<CON>,org.refcodes.component.ConnectionComponent.ConnectionAutomaton<CON>,org.refcodes.component.ConnectionOpenable<CON>,org.refcodes.component.ConnectionOpenable.ConnectionOpenAutomaton<CON>,org.refcodes.component.ConnectionStatusAccessor,org.refcodes.component.Destroyable,org.refcodes.component.Flushable,org.refcodes.component.OpenedAccessor,org.refcodes.io.ConnectionDatagramsTransmitter<DATA,,CON> org.refcodes.io.DatagramSource<DATA>,org.refcodes.io.DatagramsSource<DATA>,org.refcodes.io.DatagramsTransmitter<DATA>,org.refcodes.io.DatagramTransmitter<DATA>,org.refcodes.io.Transmittable,org.refcodes.observer.Observable<org.refcodes.component.ext.observer.ConnectionObserver<CON>>
public class ObservableConnectionTransmitter<DATA extends Serializable,CON>
extends Object
implements org.refcodes.io.ConnectionDatagramsTransmitter<DATA,CON>, org.refcodes.observer.Observable<org.refcodes.component.ext.observer.ConnectionObserver<CON>>, org.refcodes.component.Component
The
ObservableConnectionTransmitter extends the
ConnectionDatagramsTransmitter with ConnectionObserver
functionality.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.refcodes.component.Closable
org.refcodes.component.Closable.CloseAutomaton, org.refcodes.component.Closable.CloseBuilder<B extends org.refcodes.component.Closable.CloseBuilder<B>>Nested classes/interfaces inherited from interface org.refcodes.component.ClosedAccessor
org.refcodes.component.ClosedAccessor.ClosedMutator, org.refcodes.component.ClosedAccessor.ClosedPropertyNested classes/interfaces inherited from interface org.refcodes.component.ConnectableComponent
org.refcodes.component.ConnectableComponent.ConnectableAutomatonNested classes/interfaces inherited from interface org.refcodes.component.ConnectionComponent
org.refcodes.component.ConnectionComponent.ConnectionAutomaton<CON extends Object>, org.refcodes.component.ConnectionComponent.ConnectionComponentBuilder<CON extends Object,B extends org.refcodes.component.ConnectionComponent.ConnectionComponentBuilder<CON, B>> Nested classes/interfaces inherited from interface org.refcodes.component.ConnectionOpenable
org.refcodes.component.ConnectionOpenable.ConnectionOpenAutomaton<CON extends Object>, org.refcodes.component.ConnectionOpenable.ConnectionOpenBuilder<CON extends Object,B extends org.refcodes.component.ConnectionOpenable.ConnectionOpenBuilder<CON, B>> Nested classes/interfaces inherited from interface org.refcodes.component.ConnectionStatusAccessor
org.refcodes.component.ConnectionStatusAccessor.ConnectionStatusMutator, org.refcodes.component.ConnectionStatusAccessor.ConnectionStatusPropertyNested classes/interfaces inherited from interface org.refcodes.component.Destroyable
org.refcodes.component.Destroyable.DestroyAutomatonNested classes/interfaces inherited from interface org.refcodes.component.Flushable
org.refcodes.component.Flushable.FlushBuilder<B extends org.refcodes.component.Flushable.FlushBuilder<B>>Nested classes/interfaces inherited from interface org.refcodes.component.OpenedAccessor
org.refcodes.component.OpenedAccessor.OpenedMutator, org.refcodes.component.OpenedAccessor.OpenedProperty -
Constructor Summary
ConstructorsConstructorDescriptionObservableConnectionTransmitter(org.refcodes.io.ConnectionDatagramsTransmitter<DATA, CON> aConnectionSender) Constructs aObservableConnectionTransmitterwith the given attributes.ObservableConnectionTransmitter(org.refcodes.io.ConnectionDatagramsTransmitter<DATA, CON> aConnectionSender, CON aSource) Constructs aObservableConnectionTransmitterwith the given attributes.ObservableConnectionTransmitter(org.refcodes.io.ConnectionDatagramsTransmitter<DATA, CON> aConnectionSender, CON aSource, ExecutorService aExecutorService, org.refcodes.controlflow.ExecutionStrategy aExecutionStrategy) Constructs aObservableConnectionTransmitterwith the given attributes.ObservableConnectionTransmitter(org.refcodes.io.ConnectionDatagramsTransmitter<DATA, CON> aConnectionSender, ExecutorService aExecutorService, org.refcodes.controlflow.ExecutionStrategy aExecutionStrategy) Constructs aObservableConnectionTransmitterwith the given attributes.ObservableConnectionTransmitter(org.refcodes.io.ConnectionDatagramsTransmitter<DATA, CON> aConnectionSender, org.refcodes.observer.EventMetaData aEventMetaData) Constructs aObservableConnectionTransmitterwith the given attributes.ObservableConnectionTransmitter(org.refcodes.io.ConnectionDatagramsTransmitter<DATA, CON> aConnectionSender, org.refcodes.observer.EventMetaData aEventMetaData, CON aSource) Constructs aObservableConnectionTransmitterwith the given attributes.ObservableConnectionTransmitter(org.refcodes.io.ConnectionDatagramsTransmitter<DATA, CON> aConnectionSender, org.refcodes.observer.EventMetaData aEventMetaData, CON aSource, ExecutorService aExecutorService, org.refcodes.controlflow.ExecutionStrategy aExecutionStrategy) Constructs aObservableConnectionTransmitterwith the given attributes.ObservableConnectionTransmitter(org.refcodes.io.ConnectionDatagramsTransmitter<DATA, CON> aConnectionSender, org.refcodes.observer.EventMetaData aEventMetaData, ExecutorService aExecutorService, org.refcodes.controlflow.ExecutionStrategy aExecutionStrategy) Constructs aObservableConnectionTransmitterwith the given attributes. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voiddestroy()voidflush()org.refcodes.component.ConnectionStatusbooleanhasObserver(org.refcodes.component.ext.observer.ConnectionObserver<CON> aObserver) booleanbooleanisClosed()booleanisOpenable(CON aConnection) booleanisOpened()voidbooleansubscribeObserver(org.refcodes.component.ext.observer.ConnectionObserver<CON> aObserver) voidbooleanunsubscribeObserver(org.refcodes.component.ext.observer.ConnectionObserver<CON> aObserver) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.refcodes.component.Closable
closeIn, closeQuietly, closeUncheckedMethods inherited from interface org.refcodes.component.ConnectionOpenable
openUncheckedMethods inherited from interface org.refcodes.io.DatagramsSource
transmitMethods inherited from interface org.refcodes.io.DatagramsTransmitter
transmitMethods inherited from interface org.refcodes.component.Flushable
flushUnchecked, isFlushable
-
Constructor Details
-
ObservableConnectionTransmitter
public ObservableConnectionTransmitter(org.refcodes.io.ConnectionDatagramsTransmitter<DATA, CON> aConnectionSender) Constructs aObservableConnectionTransmitterwith the given attributes.- Parameters:
aConnectionSender- TheConnectionDatagramsTransmitterto which the connection method calls are to be delegated to.
-
ObservableConnectionTransmitter
public ObservableConnectionTransmitter(org.refcodes.io.ConnectionDatagramsTransmitter<DATA, CON> aConnectionSender, CON aSource) Constructs aObservableConnectionTransmitterwith the given attributes.- Parameters:
aConnectionSender- TheConnectionDatagramsTransmitterto which the connection method calls are to be delegated to.aSource- The source instance to be used when firing events in case the source is to be different from this class' instance.
-
ObservableConnectionTransmitter
public ObservableConnectionTransmitter(org.refcodes.io.ConnectionDatagramsTransmitter<DATA, CON> aConnectionSender, org.refcodes.observer.EventMetaData aEventMetaData) Constructs aObservableConnectionTransmitterwith the given attributes.- Parameters:
aConnectionSender- TheConnectionDatagramsTransmitterto which the connection method calls are to be delegated to.aEventMetaData- TheEventMetaDatato be used when firing events in case theEventMetaDatais to be different from the auto-generatedEventMetaData.
-
ObservableConnectionTransmitter
public ObservableConnectionTransmitter(org.refcodes.io.ConnectionDatagramsTransmitter<DATA, CON> aConnectionSender, org.refcodes.observer.EventMetaData aEventMetaData, CON aSource) Constructs aObservableConnectionTransmitterwith the given attributes.- Parameters:
aConnectionSender- TheConnectionDatagramsTransmitterto which the connection method calls are to be delegated to.aEventMetaData- TheEventMetaDatato be used when firing events in case theEventMetaDatais to be different from the auto-generatedEventMetaData.aSource- The source instance to be used when firing events in case the source is to be different from this class' instance.
-
ObservableConnectionTransmitter
public ObservableConnectionTransmitter(org.refcodes.io.ConnectionDatagramsTransmitter<DATA, CON> aConnectionSender, ExecutorService aExecutorService, org.refcodes.controlflow.ExecutionStrategy aExecutionStrategy) Constructs aObservableConnectionTransmitterwith the given attributes.- Parameters:
aConnectionSender- TheConnectionDatagramsTransmitterto which the connection method calls are to be delegated to.aExecutorService- The executor service to be used when firingActionEventinstances in multiple threads (if null then a default one is used).aExecutionStrategy- TheExecutionStrategyto be used when firingActionEventinstance (if null then the defaultExecutionStrategy.SEQUENTIALis used).
-
ObservableConnectionTransmitter
public ObservableConnectionTransmitter(org.refcodes.io.ConnectionDatagramsTransmitter<DATA, CON> aConnectionSender, CON aSource, ExecutorService aExecutorService, org.refcodes.controlflow.ExecutionStrategy aExecutionStrategy) Constructs aObservableConnectionTransmitterwith the given attributes.- Parameters:
aConnectionSender- TheConnectionDatagramsTransmitterto which the connection method calls are to be delegated to.aSource- The source instance to be used when firing events in case the source is to be different from this class' instance.aExecutorService- The executor service to be used when firingActionEventinstances in multiple threads (if null then a default one is used).aExecutionStrategy- TheExecutionStrategyto be used when firingActionEventinstance (if null then the defaultExecutionStrategy.SEQUENTIALis used).
-
ObservableConnectionTransmitter
public ObservableConnectionTransmitter(org.refcodes.io.ConnectionDatagramsTransmitter<DATA, CON> aConnectionSender, org.refcodes.observer.EventMetaData aEventMetaData, ExecutorService aExecutorService, org.refcodes.controlflow.ExecutionStrategy aExecutionStrategy) Constructs aObservableConnectionTransmitterwith the given attributes.- Parameters:
aConnectionSender- TheConnectionDatagramsTransmitterto which the connection method calls are to be delegated to.aEventMetaData- TheEventMetaDatato be used when firing events in case theEventMetaDatais to be different from the auto-generatedEventMetaData.aExecutorService- The executor service to be used when firingActionEventinstances in multiple threads (if null then a default one is used).aExecutionStrategy- TheExecutionStrategyto be used when firingActionEventinstance (if null then the defaultExecutionStrategy.SEQUENTIALis used).
-
ObservableConnectionTransmitter
public ObservableConnectionTransmitter(org.refcodes.io.ConnectionDatagramsTransmitter<DATA, CON> aConnectionSender, org.refcodes.observer.EventMetaData aEventMetaData, CON aSource, ExecutorService aExecutorService, org.refcodes.controlflow.ExecutionStrategy aExecutionStrategy) Constructs aObservableConnectionTransmitterwith the given attributes.- Parameters:
aConnectionSender- TheConnectionDatagramsTransmitterto which the connection method calls are to be delegated to.aEventMetaData- TheEventMetaDatato be used when firing events in case theEventMetaDatais to be different from the auto-generatedEventMetaData.aSource- The source instance to be used when firing events in case the source is to be different from this class' instance.aExecutorService- The executor service to be used when firingActionEventinstances in multiple threads (if null then a default one is used).aExecutionStrategy- TheExecutionStrategyto be used when firingActionEventinstance (if null then the defaultExecutionStrategy.SEQUENTIALis used).
-
-
Method Details
-
isClosed
public boolean isClosed()- Specified by:
isClosedin interfaceorg.refcodes.component.ClosedAccessor
-
isOpened
public boolean isOpened()- Specified by:
isOpenedin interfaceorg.refcodes.component.ConnectionStatusAccessor- Specified by:
isOpenedin interfaceorg.refcodes.component.OpenedAccessor
-
getConnectionStatus
public org.refcodes.component.ConnectionStatus getConnectionStatus()- Specified by:
getConnectionStatusin interfaceorg.refcodes.component.ConnectionStatusAccessor
-
flush
- Specified by:
flushin interfaceorg.refcodes.io.DatagramTransmitter<DATA extends Serializable>- Specified by:
flushin interfaceFlushable- Specified by:
flushin interfaceorg.refcodes.component.Flushable- Throws:
IOException
-
close
- Specified by:
closein interfaceorg.refcodes.component.Closable- Throws:
IOException
-
open
- Specified by:
openin interfaceorg.refcodes.component.ConnectionOpenable<DATA extends Serializable>- Throws:
IOException
-
transmit
- Specified by:
transmitin interfaceorg.refcodes.io.DatagramSource<DATA extends Serializable>- Specified by:
transmitin interfaceorg.refcodes.io.DatagramsSource<DATA extends Serializable>- Throws:
IOException
-
isClosable
public boolean isClosable()- Specified by:
isClosablein interfaceorg.refcodes.component.Closable.CloseAutomaton
-
isOpenable
- Specified by:
isOpenablein interfaceorg.refcodes.component.ConnectionOpenable.ConnectionOpenAutomaton<DATA extends Serializable>
-
hasObserver
- Specified by:
hasObserverin interfaceorg.refcodes.observer.Observable<DATA extends Serializable>
-
subscribeObserver
public boolean subscribeObserver(org.refcodes.component.ext.observer.ConnectionObserver<CON> aObserver) - Specified by:
subscribeObserverin interfaceorg.refcodes.observer.Observable<DATA extends Serializable>
-
unsubscribeObserver
public boolean unsubscribeObserver(org.refcodes.component.ext.observer.ConnectionObserver<CON> aObserver) - Specified by:
unsubscribeObserverin interfaceorg.refcodes.observer.Observable<DATA extends Serializable>
-
destroy
public void destroy()- Specified by:
destroyin interfaceorg.refcodes.component.Destroyable
-