osnap.api.net
Class CoreReconnecter

java.lang.Object
  extended by java.lang.Thread
      extended by osnap.api.net.CoreReconnecter
All Implemented Interfaces:
java.lang.Runnable

public class CoreReconnecter
extends java.lang.Thread

A class designed to try reconnecting to Core in case of a lost connection. Reconnecting will continue in intervals of 30 seconds in case of failure.


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
private  java.net.Socket _coreSocket
           
private  java.lang.String _hostname
           
private  ModuleInterface _module
           
private  int _port
           
private  java.net.Socket _reconnectSocket
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
CoreReconnecter(java.net.Socket socket, ModuleInterface module)
          Constructor for creating this object.
CoreReconnecter(java.lang.String hostname, int port, ModuleInterface module)
          Constructor for creating this object.
 
Method Summary
 void run()
          Tries to reconnect in intervals of 30 seconds.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_coreSocket

private java.net.Socket _coreSocket

_reconnectSocket

private java.net.Socket _reconnectSocket

_module

private ModuleInterface _module

_hostname

private java.lang.String _hostname

_port

private int _port
Constructor Detail

CoreReconnecter

public CoreReconnecter(java.net.Socket socket,
                       ModuleInterface module)
Constructor for creating this object.

Parameters:
socket - Socket to reconnect with
module - ModuleInterface trying to reconnect

CoreReconnecter

public CoreReconnecter(java.lang.String hostname,
                       int port,
                       ModuleInterface module)
Constructor for creating this object.

Parameters:
hostname - Hostname of Core
port - Port of Core
module - ModuleInterface trying to reconnect
Method Detail

run

public void run()
Tries to reconnect in intervals of 30 seconds. Destroys this thread uppon success

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread