public abstract class BaseIntraband extends Object implements Intraband
Modifier and Type | Class and Description |
---|---|
protected static class |
BaseIntraband.SendSyncDatagramCompletionHandler |
Modifier and Type | Field and Description |
---|---|
protected AtomicReference<DatagramReceiveHandler[]> |
datagramReceiveHandlersReference |
protected long |
defaultTimeout |
protected boolean |
open |
protected static EnumSet<CompletionHandler.CompletionType> |
REPLIED_ENUM_SET |
protected Map<Long,Datagram> |
responseWaitingMap |
protected AtomicLong |
sequenceIdGenerator |
protected NavigableMap<Long,Long> |
timeoutMap |
Constructor and Description |
---|
BaseIntraband(long defaultTimeout) |
Modifier and Type | Method and Description |
---|---|
protected void |
addResponseWaitingDatagram(Datagram requestDatagram) |
protected void |
cleanUpTimeoutResponseWaitingDatagrams() |
void |
close() |
protected abstract void |
doSendDatagram(RegistrationReference registrationReference,
Datagram datagram) |
protected Datagram |
doSendSyncDatagram(RegistrationReference registrationReference,
Datagram datagram,
long timeout) |
protected void |
ensureOpen() |
protected long |
generateSequenceId() |
DatagramReceiveHandler[] |
getDatagramReceiveHandlers() |
protected void |
handleReading(ScatteringByteChannel scatteringByteChannel,
ChannelContext channelContext) |
protected boolean |
handleWriting(GatheringByteChannel gatheringByteChannel,
ChannelContext channelContext) |
boolean |
isOpen() |
DatagramReceiveHandler |
registerDatagramReceiveHandler(byte type,
DatagramReceiveHandler datagramReceiveHandler) |
protected Datagram |
removeResponseWaitingDatagram(Datagram responseDatagram) |
void |
sendDatagram(RegistrationReference registrationReference,
Datagram datagram) |
<A> void |
sendDatagram(RegistrationReference registrationReference,
Datagram datagram,
A attachment,
EnumSet<CompletionHandler.CompletionType> completionTypes,
CompletionHandler<A> completionHandler) |
<A> void |
sendDatagram(RegistrationReference registrationReference,
Datagram datagram,
A attachment,
EnumSet<CompletionHandler.CompletionType> completionTypes,
CompletionHandler<A> completionHandler,
long timeout,
TimeUnit timeUnit) |
Datagram |
sendSyncDatagram(RegistrationReference registrationReference,
Datagram datagram) |
Datagram |
sendSyncDatagram(RegistrationReference registrationReference,
Datagram datagram,
long timeout,
TimeUnit timeUnit) |
DatagramReceiveHandler |
unregisterDatagramReceiveHandler(byte type) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
registerChannel, registerChannel
protected static final EnumSet<CompletionHandler.CompletionType> REPLIED_ENUM_SET
protected final AtomicReference<DatagramReceiveHandler[]> datagramReceiveHandlersReference
protected final long defaultTimeout
protected volatile boolean open
protected final Map<Long,Datagram> responseWaitingMap
protected final AtomicLong sequenceIdGenerator
protected final NavigableMap<Long,Long> timeoutMap
public void close() throws InterruptedException, IOException
public DatagramReceiveHandler[] getDatagramReceiveHandlers()
getDatagramReceiveHandlers
in interface Intraband
public DatagramReceiveHandler registerDatagramReceiveHandler(byte type, DatagramReceiveHandler datagramReceiveHandler)
registerDatagramReceiveHandler
in interface Intraband
public void sendDatagram(RegistrationReference registrationReference, Datagram datagram)
sendDatagram
in interface Intraband
public <A> void sendDatagram(RegistrationReference registrationReference, Datagram datagram, A attachment, EnumSet<CompletionHandler.CompletionType> completionTypes, CompletionHandler<A> completionHandler)
sendDatagram
in interface Intraband
public <A> void sendDatagram(RegistrationReference registrationReference, Datagram datagram, A attachment, EnumSet<CompletionHandler.CompletionType> completionTypes, CompletionHandler<A> completionHandler, long timeout, TimeUnit timeUnit)
sendDatagram
in interface Intraband
public Datagram sendSyncDatagram(RegistrationReference registrationReference, Datagram datagram) throws InterruptedException, IOException, TimeoutException
sendSyncDatagram
in interface Intraband
InterruptedException
IOException
TimeoutException
public Datagram sendSyncDatagram(RegistrationReference registrationReference, Datagram datagram, long timeout, TimeUnit timeUnit) throws InterruptedException, IOException, TimeoutException
sendSyncDatagram
in interface Intraband
InterruptedException
IOException
TimeoutException
public DatagramReceiveHandler unregisterDatagramReceiveHandler(byte type)
unregisterDatagramReceiveHandler
in interface Intraband
protected void addResponseWaitingDatagram(Datagram requestDatagram)
protected void cleanUpTimeoutResponseWaitingDatagrams()
protected abstract void doSendDatagram(RegistrationReference registrationReference, Datagram datagram)
protected Datagram doSendSyncDatagram(RegistrationReference registrationReference, Datagram datagram, long timeout) throws InterruptedException, IOException, TimeoutException
InterruptedException
IOException
TimeoutException
protected void ensureOpen()
protected long generateSequenceId()
protected void handleReading(ScatteringByteChannel scatteringByteChannel, ChannelContext channelContext)
protected boolean handleWriting(GatheringByteChannel gatheringByteChannel, ChannelContext channelContext)