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 GridNioSession
msg
- 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 GridNioSession
msg
- Message to be sent.ackC
- Optional closure invoked when ack for message is received.IgniteCheckedException
- If failed.public GridNioFuture<?> resumeReads()
resumeReads
in interface GridNioSession
public GridNioFuture<?> pauseReads()
pauseReads
in interface GridNioSession
public GridNioFuture<Boolean> close()
close
in interface GridNioSession
@Nullable public InetSocketAddress localAddress()
localAddress
in interface GridNioSession
null
if non-socket communication is used.@Nullable public InetSocketAddress remoteAddress()
remoteAddress
in interface GridNioSession
null
if non-socket communication is used.public long bytesSent()
bytesSent
in interface GridNioSession
public long bytesReceived()
bytesReceived
in interface GridNioSession
public long bytesSent0()
public long bytesReceived0()
public void reset0()
public long createTime()
createTime
in interface GridNioSession
System.currentTimeMillis()
.public long closeTime()
System.currentTimeMillis()
.
If session is not closed, this method will return 0
.closeTime
in interface GridNioSession
public long lastReceiveTime()
lastReceiveTime
in interface GridNioSession
public long lastSendTime()
lastSendTime
in interface GridNioSession
public long lastSendScheduleTime()
lastSendScheduleTime
in interface GridNioSession
public <T> T meta(int key)
meta
in interface GridNioSession
key
- Key to look up.null
if meta was not found.public <T> T addMeta(int key, @Nullable T val)
addMeta
in interface GridNioSession
key
- Metadata Key.val
- Metadata value.null
if no objects were associated.public <T> T removeMeta(int key)
removeMeta
in interface GridNioSession
key
- Metadata key.null
.public boolean accepted()
accepted
in interface GridNioSession
True
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()
GridNioSession
readsPaused
in interface GridNioSession
public void outRecoveryDescriptor(GridNioRecoveryDescriptor recoveryDesc)
outRecoveryDescriptor
in interface GridNioSession
recoveryDesc
- Recovery descriptor.@Nullable public GridNioRecoveryDescriptor outRecoveryDescriptor()
outRecoveryDescriptor
in interface GridNioSession
null otherwise.
public void inRecoveryDescriptor(GridNioRecoveryDescriptor recoveryDesc)
inRecoveryDescriptor
in interface GridNioSession
recoveryDesc
- Recovery descriptor.@Nullable public GridNioRecoveryDescriptor inRecoveryDescriptor()
inRecoveryDescriptor
in interface GridNioSession
null otherwise.
public void systemMessage(Object msg)
systemMessage
in interface GridNioSession
msg
- System message to send.
Follow @ApacheIgnite
Ignite Fabric : ver. 2.3.0 Release Date : October 28 2017