Package org.hcjf.cloud.impl.network
Class CloudClient
- java.lang.Object
-
- org.hcjf.io.net.NetServiceConsumer<S,D>
-
- org.hcjf.io.net.NetClient<S,MessageBuffer>
-
- org.hcjf.io.net.messages.MessagesNode<CloudSession>
-
- org.hcjf.cloud.impl.network.CloudClient
-
- All Implemented Interfaces:
ServiceConsumer
public class CloudClient extends MessagesNode<CloudSession>
- Author:
- javaito
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.hcjf.io.net.NetServiceConsumer
NetServiceConsumer.DecoupledAction
-
-
Constructor Summary
Constructors Constructor Description CloudClient(java.lang.String host, java.lang.Integer port)
-
Method Summary
Modifier and Type Method Description CloudSessioncheckSession(CloudSession session, MessageBuffer payLoad, NetPackage netPackage)Check the channel session.voiddestroySession(NetSession session)Destroy the session.voiddisconnect()CloudSessiongetSession()This method return the object that represent the client's session.protected MessageBuffergetShutdownPackage(CloudSession session)Returns the shutdown package to send before the net service shutdown.protected voidonDisconnect(CloudSession session, NetPackage netPackage)Method must be implemented by the custom implementation to known when a session is disconnectedprotected voidonRead(CloudSession session, Message message)This method is called when there are a complete message into the buffer.-
Methods inherited from class org.hcjf.io.net.messages.MessagesNode
decode, decrypt, encode, encrypt, isConnected, isEncrypted, onConnect, onConnectFail, onRead, send, waitForConnect
-
Methods inherited from class org.hcjf.io.net.NetServiceConsumer
addDecoupledAction, decoupleIoAction, disconnect, getName, getPort, getProtocol, getService, getShutdownFrame, getSocketOptions, getSSLEngine, getWriteWaitForTimeout, isDecoupledIoAction, onCheckSessionError, onConnect, onDisconnect, onRead, onWrite, onWrite, setService, setWriteWaitForTimeout, write, write
-
-
-
-
Method Detail
-
getSession
public CloudSession getSession()
Description copied from class:NetClientThis method return the object that represent the client's session.- Specified by:
getSessionin classNetClient<CloudSession,MessageBuffer>- Returns:
- Client's session.
-
checkSession
public CloudSession checkSession(CloudSession session, MessageBuffer payLoad, NetPackage netPackage)
Description copied from class:NetServiceConsumerCheck the channel session.- Specified by:
checkSessionin classNetServiceConsumer<CloudSession,MessageBuffer>- Parameters:
session- Created session.payLoad- Decoded package.netPackage- Net package.- Returns:
- Updated session.
-
disconnect
public void disconnect()
-
destroySession
public void destroySession(NetSession session)
Description copied from class:NetServiceConsumerDestroy the session.- Specified by:
destroySessionin classNetServiceConsumer<CloudSession,MessageBuffer>- Parameters:
session- Net session to be destroyed
-
getShutdownPackage
protected MessageBuffer getShutdownPackage(CloudSession session)
Description copied from class:NetServiceConsumerReturns the shutdown package to send before the net service shutdown.- Overrides:
getShutdownPackagein classNetServiceConsumer<CloudSession,MessageBuffer>- Parameters:
session- Session to create the package.- Returns:
- Shutdown package.
-
onRead
protected void onRead(CloudSession session, Message message)
Description copied from class:MessagesNodeThis method is called when there are a complete message into the buffer.- Specified by:
onReadin classMessagesNode<CloudSession>- Parameters:
session- Net session.message- Incoming message.
-
onDisconnect
protected void onDisconnect(CloudSession session, NetPackage netPackage)
Description copied from class:NetServiceConsumerMethod must be implemented by the custom implementation to known when a session is disconnected- Overrides:
onDisconnectin classMessagesNode<CloudSession>- Parameters:
session- Disconnected session.netPackage- Original package.
-
-