Package nl.tue.id.oocsi.client.socket
Class SocketClientRunner
java.lang.Object
nl.tue.id.oocsi.client.socket.SocketClientRunner
- All Implemented Interfaces:
java.lang.Runnable
public class SocketClientRunner
extends java.lang.Object
implements java.lang.Runnable
-
Field Summary
Fields Modifier and Type Field Description protected boolean
connectionEstablished
-
Constructor Summary
Constructors Constructor Description SocketClientRunner(java.lang.String name, java.lang.String hostname, int port, java.util.Map<java.lang.String,Handler> channels, java.util.Map<java.lang.String,Responder> services)
SocketClientRunner(java.lang.String name, java.lang.String hostname, int port, java.util.Map<java.lang.String,Handler> channels, java.util.Map<java.lang.String,Responder> services, boolean noPing, boolean noProcess)
for testing only -
Method Summary
Modifier and Type Method Description void
disconnect()
disconnect from OOCSIvoid
handleMessage(java.lang.String fromServer)
handle a whole messageboolean
isConnected()
check if still connected to OOCSIprotected boolean
isConnectionInProgress()
return true if the connection is currently in progressboolean
isReconnect()
retrieve whether we are still trying to reconnect, or whether we have given up on this connection (server, handle, etc.)void
kill()
kills this client connection from OOCSIvoid
log(java.lang.String message)
logging of message on console (can be overridden by subclass)void
reconnect()
reconnects this client connection to OOCSIvoid
run()
protected void
sleep(int ms)
let thread sleep for ms millisecondsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
connectionEstablished
protected boolean connectionEstablished
-
-
Constructor Details
-
SocketClientRunner
-
SocketClientRunner
public SocketClientRunner(java.lang.String name, java.lang.String hostname, int port, java.util.Map<java.lang.String,Handler> channels, java.util.Map<java.lang.String,Responder> services, boolean noPing, boolean noProcess)for testing only- Parameters:
name
-hostname
-port
-channels
-services
-noPing
-noProcess
-
-
-
Method Details
-
run
public void run()- Specified by:
run
in interfacejava.lang.Runnable
-
isConnectionInProgress
protected boolean isConnectionInProgress()return true if the connection is currently in progress- Returns:
-
handleMessage
public void handleMessage(java.lang.String fromServer) throws java.io.IOExceptionhandle a whole message- Parameters:
fromServer
-- Throws:
java.io.IOException
-
disconnect
public void disconnect()disconnect from OOCSI -
kill
public void kill()kills this client connection from OOCSI -
reconnect
public void reconnect()reconnects this client connection to OOCSI -
isConnected
public boolean isConnected()check if still connected to OOCSI- Returns:
-
isReconnect
public boolean isReconnect()retrieve whether we are still trying to reconnect, or whether we have given up on this connection (server, handle, etc.)- Returns:
-
sleep
protected void sleep(int ms)let thread sleep for ms milliseconds -
log
public void log(java.lang.String message)logging of message on console (can be overridden by subclass)
-