Interface GridNioSession
-
- All Known Implementing Classes:
GridNioSessionImpl,GridSelectorNioSessionImpl
public interface GridNioSessionThis interface represents established or closed connection between nio server and remote client.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleanaccepted()<T> TaddMeta(int key, T val)Adds metadata associated with specified key.longbytesReceived()Gets the total count of bytes received since the session was created.longbytesSent()Gets the total count of bytes sent since the session was created.@Nullable Certificate[]certificates()GridNioFuture<Boolean>close()Performs a request for asynchronous session close.longcloseTime()If session is closed, this method will return session close time returned bySystem.currentTimeMillis().longcreateTime()Gets the time when the session was created.@Nullable GridNioRecoveryDescriptorinRecoveryDescriptor()voidinRecoveryDescriptor(GridNioRecoveryDescriptor recoveryDesc)longlastReceiveTime()Returns the time when last read activity was performed on this session.longlastSendScheduleTime()Returns time when last send was scheduled on this session.longlastSendTime()Returns time when last send activity was performed on this session.@Nullable InetSocketAddresslocalAddress()Gets local address of this session.<T> Tmeta(int key)Gets metadata associated with specified key.@Nullable GridNioRecoveryDescriptoroutRecoveryDescriptor()voidoutRecoveryDescriptor(GridNioRecoveryDescriptor recoveryDesc)GridNioFuture<?>pauseReads()Pauses reads.booleanreadsPaused()Checks whether reads are paused.@Nullable InetSocketAddressremoteAddress()Gets address of remote peer on this session.<T> TremoveMeta(int key)Removes metadata with the specified key.GridNioFuture<?>resumeReads()Resumes session reads.GridNioFuture<?>send(Object msg)Performs a request for asynchronous data send.voidsendNoFuture(Object msg, @Nullable IgniteInClosure<IgniteException> ackC)voidsystemMessage(Object msg)
-
-
-
Method Detail
-
localAddress
@Nullable @Nullable InetSocketAddress localAddress()
Gets local address of this session.- Returns:
- Local network address or
nullif non-socket communication is used.
-
remoteAddress
@Nullable @Nullable InetSocketAddress remoteAddress()
Gets address of remote peer on this session.- Returns:
- Address of remote peer or
nullif non-socket communication is used.
-
bytesSent
long bytesSent()
Gets the total count of bytes sent since the session was created.- Returns:
- Total count of bytes sent.
-
bytesReceived
long bytesReceived()
Gets the total count of bytes received since the session was created.- Returns:
- Total count of bytes received.
-
createTime
long createTime()
Gets the time when the session was created.- Returns:
- Time when this session was created returned by
System.currentTimeMillis().
-
closeTime
long closeTime()
If session is closed, this method will return session close time returned bySystem.currentTimeMillis(). If session is not closed, this method will return0.- Returns:
- Session close time.
-
lastReceiveTime
long lastReceiveTime()
Returns the time when last read activity was performed on this session.- Returns:
- Lats receive time.
-
lastSendTime
long lastSendTime()
Returns time when last send activity was performed on this session.- Returns:
- Last send time.
-
lastSendScheduleTime
long lastSendScheduleTime()
Returns time when last send was scheduled on this session.- Returns:
- Last send schedule time.
-
close
GridNioFuture<Boolean> close()
Performs a request for asynchronous session close.- Returns:
- Future representing result.
-
send
GridNioFuture<?> send(Object msg)
Performs a request for asynchronous data send.- Parameters:
msg- Message to be sent. This message will be eventually passed in to a parser plugged to the nio server.- Returns:
- Future representing result.
-
sendNoFuture
void sendNoFuture(Object msg, @Nullable @Nullable IgniteInClosure<IgniteException> ackC) throws IgniteCheckedException
- Parameters:
msg- Message to be sent.ackC- Optional closure invoked when ack for message is received.- Throws:
IgniteCheckedException- If failed.
-
meta
@Nullable <T> T meta(int key)
Gets metadata associated with specified key.- Parameters:
key- Key to look up.- Returns:
- Associated meta object or
nullif meta was not found.
-
addMeta
@Nullable <T> T addMeta(int key, @Nullable T val)Adds metadata associated with specified key.- Parameters:
key- Metadata Key.val- Metadata value.- Returns:
- Previously associated object or
nullif no objects were associated.
-
removeMeta
@Nullable <T> T removeMeta(int key)
Removes metadata with the specified key.- Parameters:
key- Metadata key.- Returns:
- Object that was associated with the key or
null.
-
accepted
boolean accepted()
- Returns:
Trueif this connection was initiated from remote node.
-
certificates
@Nullable @Nullable Certificate[] certificates()
- Returns:
- Client SSL certificates
-
resumeReads
GridNioFuture<?> resumeReads()
Resumes session reads.- Returns:
- Future representing result.
-
pauseReads
GridNioFuture<?> pauseReads()
Pauses reads.- Returns:
- Future representing result.
-
readsPaused
boolean readsPaused()
Checks whether reads are paused.- Returns:
Trueif reads are paused.
-
outRecoveryDescriptor
void outRecoveryDescriptor(GridNioRecoveryDescriptor recoveryDesc)
- Parameters:
recoveryDesc- Recovery descriptor.
-
inRecoveryDescriptor
void inRecoveryDescriptor(GridNioRecoveryDescriptor recoveryDesc)
- Parameters:
recoveryDesc- Recovery descriptor.
-
outRecoveryDescriptor
@Nullable @Nullable GridNioRecoveryDescriptor outRecoveryDescriptor()
- Returns:
- Recovery descriptor if recovery is supported,
null otherwise.
-
inRecoveryDescriptor
@Nullable @Nullable GridNioRecoveryDescriptor inRecoveryDescriptor()
- Returns:
- Recovery descriptor if recovery is supported,
null otherwise.
-
systemMessage
void systemMessage(Object msg)
- Parameters:
msg- System message to send.
-
-