public class GridNioSessionImpl extends Object implements GridNioSession
| Constructor and Description |
|---|
GridNioSessionImpl(GridNioFilterChain filterChain,
InetSocketAddress locAddr,
InetSocketAddress rmtAddr,
boolean accepted) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
accepted() |
<T> T |
addMeta(int key,
T val)
Adds metadata associated with specified key.
|
long |
bytesReceived()
Gets the total count of bytes received since the session was created.
|
void |
bytesReceived(int cnt)
Adds given amount ob bytes to the received bytes counter.
|
long |
bytesReceived0() |
long |
bytesSent()
Gets the total count of bytes sent since the session was created.
|
void |
bytesSent(int cnt)
Adds given amount of bytes to the sent bytes counter.
|
long |
bytesSent0() |
protected <T> GridNioFilterChain<T> |
chain() |
GridNioFuture<Boolean> |
close()
Performs a request for asynchronous session close.
|
boolean |
closed() |
long |
closeTime()
If session is closed, this method will return session close time returned by
System.currentTimeMillis(). |
long |
createTime()
Gets the time when the session was created.
|
GridNioRecoveryDescriptor |
inRecoveryDescriptor() |
void |
inRecoveryDescriptor(GridNioRecoveryDescriptor recoveryDesc) |
long |
lastReceiveTime()
Returns the time when last read activity was performed on this session.
|
long |
lastSendScheduleTime()
Returns time when last send was scheduled on this session.
|
long |
lastSendTime()
Returns time when last send activity was performed on this session.
|
InetSocketAddress |
localAddress()
Gets local address of this session.
|
<T> T |
meta(int key)
Gets metadata associated with specified key.
|
GridNioRecoveryDescriptor |
outRecoveryDescriptor() |
void |
outRecoveryDescriptor(GridNioRecoveryDescriptor recoveryDesc) |
GridNioFuture<?> |
pauseReads()
Pauses reads.
|
boolean |
readsPaused()
Checks whether reads are paused.
|
void |
readsPaused(boolean readsPaused) |
InetSocketAddress |
remoteAddress()
Gets address of remote peer on this session.
|
<T> T |
removeMeta(int key)
Removes metadata with the specified key.
|
void |
reset0() |
void |
resetSendScheduleTime()
Resets send schedule time to avoid multiple idle notifications.
|
GridNioFuture<?> |
resumeReads()
Resumes session reads.
|
GridNioFuture<?> |
send(Object msg)
Performs a request for asynchronous data send.
|
void |
sendNoFuture(Object msg,
IgniteInClosure<IgniteException> ackC) |
boolean |
setClosed()
Atomically moves this session into a closed state.
|
void |
systemMessage(Object msg) |
String |
toString() |
public GridNioSessionImpl(GridNioFilterChain filterChain, @Nullable InetSocketAddress locAddr, @Nullable InetSocketAddress rmtAddr, boolean accepted)
filterChain - Chain.locAddr - Local address.rmtAddr - Remote address.accepted - True if this session was initiated from remote host.public GridNioFuture<?> send(Object msg)
send in interface GridNioSessionmsg - Message to be sent. This message will be eventually passed in to a parser plugged
to the nio server.public void sendNoFuture(Object msg, IgniteInClosure<IgniteException> ackC) throws IgniteCheckedException
sendNoFuture in interface GridNioSessionmsg - Message to be sent.ackC - Optional closure invoked when ack for message is received.IgniteCheckedException - If failed.public GridNioFuture<?> resumeReads()
resumeReads in interface GridNioSessionpublic GridNioFuture<?> pauseReads()
pauseReads in interface GridNioSessionpublic GridNioFuture<Boolean> close()
close in interface GridNioSession@Nullable public InetSocketAddress localAddress()
localAddress in interface GridNioSessionnull if non-socket communication is used.@Nullable public InetSocketAddress remoteAddress()
remoteAddress in interface GridNioSessionnull if non-socket communication is used.public long bytesSent()
bytesSent in interface GridNioSessionpublic long bytesReceived()
bytesReceived in interface GridNioSessionpublic long bytesSent0()
public long bytesReceived0()
public void reset0()
public long createTime()
createTime in interface GridNioSessionSystem.currentTimeMillis().public long closeTime()
System.currentTimeMillis().
If session is not closed, this method will return 0.closeTime in interface GridNioSessionpublic long lastReceiveTime()
lastReceiveTime in interface GridNioSessionpublic long lastSendTime()
lastSendTime in interface GridNioSessionpublic long lastSendScheduleTime()
lastSendScheduleTime in interface GridNioSessionpublic <T> T meta(int key)
meta in interface GridNioSessionkey - Key to look up.null if meta was not found.public <T> T addMeta(int key,
@Nullable
T val)
addMeta in interface GridNioSessionkey - Metadata Key.val - Metadata value.null if no objects were associated.public <T> T removeMeta(int key)
removeMeta in interface GridNioSessionkey - Metadata key.null.public boolean accepted()
accepted in interface GridNioSessionTrue if this connection was initiated from remote node.protected <T> GridNioFilterChain<T> chain()
T - Chain type.public void bytesSent(int cnt)
Note that this method is designed to be called in one thread only.
cnt - Number of bytes sent.public void bytesReceived(int cnt)
Note that this method is designed to be called in one thread only.
cnt - Number of bytes received.public void resetSendScheduleTime()
public boolean setClosed()
True if session was moved to a closed state,
false if session was already closed.public boolean closed()
True if this session was closed.public void readsPaused(boolean readsPaused)
readsPaused - New reads paused flag.public boolean readsPaused()
GridNioSessionreadsPaused in interface GridNioSessionpublic void outRecoveryDescriptor(GridNioRecoveryDescriptor recoveryDesc)
outRecoveryDescriptor in interface GridNioSessionrecoveryDesc - Recovery descriptor.@Nullable public GridNioRecoveryDescriptor outRecoveryDescriptor()
outRecoveryDescriptor in interface GridNioSessionnull otherwise.public void inRecoveryDescriptor(GridNioRecoveryDescriptor recoveryDesc)
inRecoveryDescriptor in interface GridNioSessionrecoveryDesc - Recovery descriptor.@Nullable public GridNioRecoveryDescriptor inRecoveryDescriptor()
inRecoveryDescriptor in interface GridNioSessionnull otherwise.public void systemMessage(Object msg)
systemMessage in interface GridNioSessionmsg - System message to send.
Follow @ApacheIgnite
Ignite Fabric : ver. 2.2.0 Release Date : September 15 2017