public abstract class BaseIntraband extends java.lang.Object implements Intraband
Modifier and Type | Class and Description |
---|---|
protected static class |
BaseIntraband.SendSyncDatagramCompletionHandler |
Modifier and Type | Field and Description |
---|---|
protected java.util.concurrent.atomic.AtomicReference<DatagramReceiveHandler[]> |
datagramReceiveHandlersReference |
protected long |
defaultTimeout |
protected boolean |
open |
protected static java.util.EnumSet<CompletionHandler.CompletionType> |
REPLIED_ENUM_SET |
protected java.util.Map<java.lang.Long,Datagram> |
responseWaitingMap |
protected java.util.concurrent.atomic.AtomicLong |
sequenceIdGenerator |
protected java.util.NavigableMap<java.lang.Long,java.lang.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(java.nio.channels.ScatteringByteChannel scatteringByteChannel,
ChannelContext channelContext) |
protected boolean |
handleWriting(java.nio.channels.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,
java.util.EnumSet<CompletionHandler.CompletionType> completionTypes,
CompletionHandler<A> completionHandler) |
<A> void |
sendDatagram(RegistrationReference registrationReference,
Datagram datagram,
A attachment,
java.util.EnumSet<CompletionHandler.CompletionType> completionTypes,
CompletionHandler<A> completionHandler,
long timeout,
java.util.concurrent.TimeUnit timeUnit) |
Datagram |
sendSyncDatagram(RegistrationReference registrationReference,
Datagram datagram) |
Datagram |
sendSyncDatagram(RegistrationReference registrationReference,
Datagram datagram,
long timeout,
java.util.concurrent.TimeUnit timeUnit) |
DatagramReceiveHandler |
unregisterDatagramReceiveHandler(byte type) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
registerChannel, registerChannel
protected static final java.util.EnumSet<CompletionHandler.CompletionType> REPLIED_ENUM_SET
protected final java.util.concurrent.atomic.AtomicReference<DatagramReceiveHandler[]> datagramReceiveHandlersReference
protected final long defaultTimeout
protected volatile boolean open
protected final java.util.Map<java.lang.Long,Datagram> responseWaitingMap
protected final java.util.concurrent.atomic.AtomicLong sequenceIdGenerator
protected final java.util.NavigableMap<java.lang.Long,java.lang.Long> timeoutMap
public void close() throws java.lang.InterruptedException, java.io.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, java.util.EnumSet<CompletionHandler.CompletionType> completionTypes, CompletionHandler<A> completionHandler)
sendDatagram
in interface Intraband
public <A> void sendDatagram(RegistrationReference registrationReference, Datagram datagram, A attachment, java.util.EnumSet<CompletionHandler.CompletionType> completionTypes, CompletionHandler<A> completionHandler, long timeout, java.util.concurrent.TimeUnit timeUnit)
sendDatagram
in interface Intraband
public Datagram sendSyncDatagram(RegistrationReference registrationReference, Datagram datagram) throws java.lang.InterruptedException, java.io.IOException, java.util.concurrent.TimeoutException
sendSyncDatagram
in interface Intraband
java.lang.InterruptedException
java.io.IOException
java.util.concurrent.TimeoutException
public Datagram sendSyncDatagram(RegistrationReference registrationReference, Datagram datagram, long timeout, java.util.concurrent.TimeUnit timeUnit) throws java.lang.InterruptedException, java.io.IOException, java.util.concurrent.TimeoutException
sendSyncDatagram
in interface Intraband
java.lang.InterruptedException
java.io.IOException
java.util.concurrent.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 java.lang.InterruptedException, java.io.IOException, java.util.concurrent.TimeoutException
java.lang.InterruptedException
java.io.IOException
java.util.concurrent.TimeoutException
protected void ensureOpen()
protected long generateSequenceId()
protected void handleReading(java.nio.channels.ScatteringByteChannel scatteringByteChannel, ChannelContext channelContext)
protected boolean handleWriting(java.nio.channels.GatheringByteChannel gatheringByteChannel, ChannelContext channelContext)