Class SessionImpl
java.lang.Object
com.tenio.core.network.entity.session.implement.SessionImpl
- All Implemented Interfaces:
Session
The implementation for session.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoid
activate()
void
addDroppedPackets
(int packets) void
addReadBytes
(long bytes) void
addWrittenBytes
(long bytes) void
close
(ConnectionDisconnectMode connectionDisconnectMode, PlayerDisconnectMode playerDisconnectMode) boolean
void
void
boolean
int
long
long
long
getId()
long
long
long
long
int
getName()
long
int
io.netty.channel.Channel
long
int
hashCode()
It is generally necessary to override the hashCode method whenever equals method is overridden, so as to maintain the general contract for the hashCode method, which states that equal objects must have equal hash codes.boolean
boolean
boolean
isIdle()
boolean
isTcp()
boolean
static Session
void
setConnected
(boolean connected) void
setCreatedTime
(long timestamp) void
setDatagramChannel
(DatagramChannel datagramChannel, SocketAddress remoteAddress) void
setLastActivityTime
(long timestamp) void
setLastReadTime
(long timestamp) void
setLastWriteTime
(long timestamp) void
setMaxIdleTimeInSeconds
(int seconds) void
void
setPacketQueue
(PacketQueue packetQueue) void
setPacketReadState
(PacketReadState packetReadState) void
setSelectionKey
(SelectionKey selectionKey) void
setSessionManager
(SessionManager sessionManager) void
setSocketChannel
(SocketChannel socketChannel) void
setWebSocketChannel
(io.netty.channel.Channel webSocketChannel) toString()
-
Method Details
-
newInstance
-
getId
public long getId() -
getName
-
setName
-
isConnected
public boolean isConnected()- Specified by:
isConnected
in interfaceSession
-
setConnected
public void setConnected(boolean connected) - Specified by:
setConnected
in interfaceSession
-
getPacketQueue
- Specified by:
getPacketQueue
in interfaceSession
-
setPacketQueue
- Specified by:
setPacketQueue
in interfaceSession
-
getTransportType
- Specified by:
getTransportType
in interfaceSession
-
isTcp
public boolean isTcp() -
containsUdp
public boolean containsUdp()- Specified by:
containsUdp
in interfaceSession
-
isWebSocket
public boolean isWebSocket()- Specified by:
isWebSocket
in interfaceSession
-
getSocketChannel
- Specified by:
getSocketChannel
in interfaceSession
-
setSocketChannel
- Specified by:
setSocketChannel
in interfaceSession
-
createPacketSocketHandle
public void createPacketSocketHandle()- Specified by:
createPacketSocketHandle
in interfaceSession
-
getSelectionKey
- Specified by:
getSelectionKey
in interfaceSession
-
setSelectionKey
- Specified by:
setSelectionKey
in interfaceSession
-
getPacketReadState
- Specified by:
getPacketReadState
in interfaceSession
-
setPacketReadState
- Specified by:
setPacketReadState
in interfaceSession
-
getProcessedPacket
- Specified by:
getProcessedPacket
in interfaceSession
-
getPendingPacket
- Specified by:
getPendingPacket
in interfaceSession
-
getDatagramChannel
- Specified by:
getDatagramChannel
in interfaceSession
-
setDatagramChannel
- Specified by:
setDatagramChannel
in interfaceSession
-
getDatagramRemoteSocketAddress
- Specified by:
getDatagramRemoteSocketAddress
in interfaceSession
-
getWebSocketChannel
public io.netty.channel.Channel getWebSocketChannel()- Specified by:
getWebSocketChannel
in interfaceSession
-
setWebSocketChannel
public void setWebSocketChannel(io.netty.channel.Channel webSocketChannel) - Specified by:
setWebSocketChannel
in interfaceSession
-
getCreatedTime
public long getCreatedTime()- Specified by:
getCreatedTime
in interfaceSession
-
setCreatedTime
public void setCreatedTime(long timestamp) - Specified by:
setCreatedTime
in interfaceSession
-
getLastActivityTime
public long getLastActivityTime()- Specified by:
getLastActivityTime
in interfaceSession
-
setLastActivityTime
public void setLastActivityTime(long timestamp) - Specified by:
setLastActivityTime
in interfaceSession
-
getLastReadTime
public long getLastReadTime()- Specified by:
getLastReadTime
in interfaceSession
-
setLastReadTime
public void setLastReadTime(long timestamp) - Specified by:
setLastReadTime
in interfaceSession
-
getLastWriteTime
public long getLastWriteTime()- Specified by:
getLastWriteTime
in interfaceSession
-
setLastWriteTime
public void setLastWriteTime(long timestamp) - Specified by:
setLastWriteTime
in interfaceSession
-
getReadBytes
public long getReadBytes()- Specified by:
getReadBytes
in interfaceSession
-
addReadBytes
public void addReadBytes(long bytes) - Specified by:
addReadBytes
in interfaceSession
-
getWrittenBytes
public long getWrittenBytes()- Specified by:
getWrittenBytes
in interfaceSession
-
addWrittenBytes
public void addWrittenBytes(long bytes) - Specified by:
addWrittenBytes
in interfaceSession
-
getDroppedPackets
public long getDroppedPackets()- Specified by:
getDroppedPackets
in interfaceSession
-
addDroppedPackets
public void addDroppedPackets(int packets) - Specified by:
addDroppedPackets
in interfaceSession
-
getMaxIdleTimeInSeconds
public int getMaxIdleTimeInSeconds()- Specified by:
getMaxIdleTimeInSeconds
in interfaceSession
-
setMaxIdleTimeInSeconds
public void setMaxIdleTimeInSeconds(int seconds) - Specified by:
setMaxIdleTimeInSeconds
in interfaceSession
-
isIdle
public boolean isIdle() -
isActivated
public boolean isActivated()- Specified by:
isActivated
in interfaceSession
-
activate
public void activate() -
deactivate
public void deactivate()- Specified by:
deactivate
in interfaceSession
-
getInactivatedTime
public long getInactivatedTime()- Specified by:
getInactivatedTime
in interfaceSession
-
getFullClientIpAddress
- Specified by:
getFullClientIpAddress
in interfaceSession
-
getClientAddress
- Specified by:
getClientAddress
in interfaceSession
-
getClientPort
public int getClientPort()- Specified by:
getClientPort
in interfaceSession
-
getServerAddress
- Specified by:
getServerAddress
in interfaceSession
-
getServerPort
public int getServerPort()- Specified by:
getServerPort
in interfaceSession
-
getFullServerIpAddress
- Specified by:
getFullServerIpAddress
in interfaceSession
-
getSessionManager
- Specified by:
getSessionManager
in interfaceSession
-
setSessionManager
- Specified by:
setSessionManager
in interfaceSession
-
close
public void close(ConnectionDisconnectMode connectionDisconnectMode, PlayerDisconnectMode playerDisconnectMode) throws IOException - Specified by:
close
in interfaceSession
- Throws:
IOException
-
equals
-
hashCode
public int hashCode()It is generally necessary to override the hashCode method whenever equals method is overridden, so as to maintain the general contract for the hashCode method, which states that equal objects must have equal hash codes. -
toString
-