Two kind of functions are to be defined :
Public Member Functions | |
LSDClientCommon (LSDClientCommonSessionHandler lscshext, String Hostname, int ServerPort, boolean immediate, boolean keepalived) | |
LSDClientCommon (String Hostname, int ServerPort, boolean immediate, boolean keepalived) | |
LSDClientCommon (LSDClientCommonSessionHandler lscshext, String Hostname, int ServerPort, boolean ServerCompressed, boolean ClientCompressed, boolean immediate, boolean keepalived) | |
LSDClientCommon (String Hostname, int ServerPort, boolean ServerCompressed, boolean ClientCompressed, boolean immediate, boolean keepalived) | |
void | connect (boolean immediate, boolean keepalived) |
boolean | connectionJoin () |
boolean | sessionReconnect () |
boolean | isConnected () |
void | clear () |
Object | getObject () |
void | setObject (Object object) |
Object | clearObject () |
void | close () |
void | realClose () |
int | getStatus () |
void | initShared () |
void | lock () |
void | unlock () |
String | toString () |
Static Public Member Functions | |
static void | initClient () |
static void | endClient () |
static void | endClient (boolean toexit) |
static boolean | isSessionOK (IoSession session) |
Public Attributes | |
String | hostname = "localhost" |
int | serverPort = 8080 |
boolean | serverCompressed = false |
boolean | clientCompressed = false |
long | idip = LSDConstants.invalide_idx |
IoSession | session = null |
SocketConnector | connector = null |
LSDClientSession | ls = null |
LSDClientCommonSessionHandler | lscsh = null |
ExecutorService | executorChainService = null |
LSDPoolConnectionAbstract | poolConnection = null |
Protected Member Functions | |
abstract LSDClientCommonSessionHandler | createSessionHandler () |
Private Member Functions | |
void | addKeepAlive () |
Private Attributes | |
ConnectFuture | future = null |
SocketSessionConfig | config = null |
InetSocketAddress | inetSocketAddress = null |
DefaultIoFilterChainBuilder | chain = null |
ReentrantLock | lock = null |
LSDKeepAliveFilter | keepAliveFilter = null |
Static Private Attributes | |
static IoBufferAllocator | ioBufferAllocator = null |
openlsd.network.client.common.LSDClientCommon.LSDClientCommon | ( | LSDClientCommonSessionHandler | lscshext, | |
String | Hostname, | |||
int | ServerPort, | |||
boolean | immediate, | |||
boolean | keepalived | |||
) |
Create a new ClientCommon using a specific SessionHandler that extends the LSDClientCommonSessionHandler class and a specific Hostname and serverPort. The client is immediately connected if immediate is true, else it will be connected after connectionJoint() will be called.
lscshext | ||
Hostname | ||
ServerPort | ||
immediate | ||
keepalived |
openlsd.network.client.common.LSDClientCommon.LSDClientCommon | ( | String | Hostname, | |
int | ServerPort, | |||
boolean | immediate, | |||
boolean | keepalived | |||
) |
Create a new ClientCommon using a specific Hostname and serverPort. The client is immediately connected if immediate is true, else it will be connected after connectionJoint() will be called.
Hostname | ||
ServerPort | ||
immediate | ||
keepalived |
openlsd.network.client.common.LSDClientCommon.LSDClientCommon | ( | LSDClientCommonSessionHandler | lscshext, | |
String | Hostname, | |||
int | ServerPort, | |||
boolean | ServerCompressed, | |||
boolean | ClientCompressed, | |||
boolean | immediate, | |||
boolean | keepalived | |||
) |
Create a new ClientCommon using a specific SessionHandler that extends the LSDClientCommonSessionHandler class and a specific Hostname and serverPort and the properties of compression for server and client part. The client is immediately connected if immediate is true, else it will be connected after connectionJoint() will be called.
lscshext | ||
Hostname | ||
ServerPort | ||
ServerCompressed | ||
ClientCompressed | ||
immediate | ||
keepalived |
openlsd.network.client.common.LSDClientCommon.LSDClientCommon | ( | String | Hostname, | |
int | ServerPort, | |||
boolean | ServerCompressed, | |||
boolean | ClientCompressed, | |||
boolean | immediate, | |||
boolean | keepalived | |||
) |
Create a new ClientCommon using a specific Hostname and serverPort and the properties of compression for server and client part. The client is immediately connected if immediate is true, else it will be connected after connectionJoint() will be called.
Hostname | ||
ServerPort | ||
ServerCompressed | ||
ClientCompressed | ||
immediate | ||
keepalived |
static void openlsd.network.client.common.LSDClientCommon.initClient | ( | ) | [static] |
Init global structure like IoBufferAllocator
static void openlsd.network.client.common.LSDClientCommon.endClient | ( | ) | [static] |
End global structure like IoBufferAllocator
static void openlsd.network.client.common.LSDClientCommon.endClient | ( | boolean | toexit | ) | [static] |
End global structure like IoBufferAllocator
toexit |
abstract LSDClientCommonSessionHandler openlsd.network.client.common.LSDClientCommon.createSessionHandler | ( | ) | [protected, pure virtual] |
Create a SessionHandler. This function has to be rewritten by classes that extends this one.
Implemented in openlsd.network.client.admin.LSDClientAdmin, openlsd.network.client.delete.LSDClientDelete, openlsd.network.client.get.LSDClientGet, openlsd.network.client.info.LSDClientInfo, openlsd.network.client.move.LSDClientMove, openlsd.network.client.put.LSDClientPut, openlsd.appli.extension.LSDExtClientInfo, openlsd.multiple.ophandler.extension.LSDPoolClientGet, openlsd.multiple.ophandler.extension.LSDPoolClientPut, and openlsd.web.extension.LSDWebClientGet.
void openlsd.network.client.common.LSDClientCommon.addKeepAlive | ( | ) | [private] |
Add the Keep Alive feature to this session: Can only be added before connection is done!
void openlsd.network.client.common.LSDClientCommon.connect | ( | boolean | immediate, | |
boolean | keepalived | |||
) |
The client is now to be connected to the server using the specific SessionHandler that extends the LSDClientCommonSessionHandler class. This function is called by the Constructor.
If the connection is not ok, then the function isConnected() returns false. The client is immediately connected if immediate is true, else it will be connected after connectionJoint() will be called.
immediate | ||
keepalived | True if the chainFilter should add the keepalived feature (mandatory in immediate mode to true if the keepalived filter is wanted) |
boolean openlsd.network.client.common.LSDClientCommon.connectionJoin | ( | ) |
Join the connection, so as to finalize the connection process
boolean openlsd.network.client.common.LSDClientCommon.sessionReconnect | ( | ) |
Enable to try to reconnect to the server if disconnected.
boolean openlsd.network.client.common.LSDClientCommon.isConnected | ( | ) |
Returns the status of the connection and clear the session if not connected (sessionStop)
static boolean openlsd.network.client.common.LSDClientCommon.isSessionOK | ( | IoSession | session | ) | [static] |
Test if the session is still OK
session |
void openlsd.network.client.common.LSDClientCommon.clear | ( | ) |
clear session information
Object openlsd.network.client.common.LSDClientCommon.getObject | ( | ) |
Return the current user object of the session
void openlsd.network.client.common.LSDClientCommon.setObject | ( | Object | object | ) |
Set the current user object of the session
object |
Object openlsd.network.client.common.LSDClientCommon.clearObject | ( | ) |
Return the current user object of the session before clear the object stored.
void openlsd.network.client.common.LSDClientCommon.close | ( | ) |
Will close the current session and finalize the Client. Reconnection is still possible.
Reimplemented in openlsd.multiple.ophandler.extension.LSDPoolClientDelete, openlsd.multiple.ophandler.extension.LSDPoolClientGet, openlsd.multiple.ophandler.extension.LSDPoolClientInfo, openlsd.multiple.ophandler.extension.LSDPoolClientMove, and openlsd.multiple.ophandler.extension.LSDPoolClientPut.
void openlsd.network.client.common.LSDClientCommon.realClose | ( | ) |
Will totally close the current session and finalize the Client. Reconnection cannot be done.
int openlsd.network.client.common.LSDClientCommon.getStatus | ( | ) |
Return the status of the request: 1 running, 0 finished, -1 error system, -2 error as request, -3 error as unavailable request, -4 error as cannot restore to previous state, -5 error as bad client request, -6 error as no service.
void openlsd.network.client.common.LSDClientCommon.initShared | ( | ) |
Initialized a lock to enable shared connection among threads
Lock in case of shared connection (no synchronized since if connection are not shared, they can be done in parallel)
void openlsd.network.client.common.LSDClientCommon.unlock | ( | ) |
UnLock in case of shared connection
String openlsd.network.client.common.LSDClientCommon.toString | ( | ) |
String openlsd.network.client.common.LSDClientCommon.hostname = "localhost" |
Hostname
Port for the server
boolean openlsd.network.client.common.LSDClientCommon.serverCompressed = false |
Are messages compressed from Server
boolean openlsd.network.client.common.LSDClientCommon.clientCompressed = false |
Are messages compressed from Client
Idip of server: not mandatory, should be set if needed after constructor
IoSession openlsd.network.client.common.LSDClientCommon.session = null |
Associated session
SocketConnector openlsd.network.client.common.LSDClientCommon.connector = null |
Associated socket connector
ConnectFuture openlsd.network.client.common.LSDClientCommon.future = null [private] |
Associated future connector
SocketSessionConfig openlsd.network.client.common.LSDClientCommon.config = null [private] |
Associated Socket Session Config
Associated session info
Associated Session Handler
ExecutorService openlsd.network.client.common.LSDClientCommon.executorChainService = null |
Associated ExecutorChainService
IoBufferAllocator openlsd.network.client.common.LSDClientCommon.ioBufferAllocator = null [static, private] |
Associated IoBufferAllocator
InetSocketAddress openlsd.network.client.common.LSDClientCommon.inetSocketAddress = null [private] |
Associated Socket Address
DefaultIoFilterChainBuilder openlsd.network.client.common.LSDClientCommon.chain = null [private] |
Chain filter
ReentrantLock openlsd.network.client.common.LSDClientCommon.lock = null [private] |
Associated Lock for shared session between multiple thread
The referent pool of connections if this connection is taken from a pool of connections
The KeepAlive filter associated if any