org.ifeth.sehr.client.api.driver
Class ConnectionInfo

java.lang.Object
  extended byorg.ifeth.sehr.client.api.driver.ConnectionInfo

public class ConnectionInfo
extends java.lang.Object


Constructor Summary
ConnectionInfo()
           
ConnectionInfo(long t0)
          Constructor with setting the start-up time
 
Method Summary
 void close()
          Close connection by setting a 'close request'
 double getCurrentDurationTime()
          Track current duration time A watching thread can use this to show the 'uptime'
 double getLastConnectionTime()
          Get stored last connection (uptime)
 java.lang.Object getObject()
          Returns the object associated with the connection
 int getStatus()
          Get the status Note: If '0' a watcher or listener thread can close the connection
 double getTotalConnectionTime()
          Get stored total connection time
 boolean isCloseRequest()
          Get the flag 'close requested' This is a very important flag.
 void setCloseRequest(boolean closeRequest)
          Set a 'close requested'
 void setDownTimeMillis(long t1)
          Set 'down-time'
 void setStartUpTimeMillis(long t0)
          Set startup time; if arg <=0 set to current time
 void setStatus(int code)
          Flag the status of the connection 0=unused/offline, 1=used/online/stay online, -1=failure
 void setTotalConnectionTime(double total)
          Used on reconnections to add total connection times
 void storeObject(java.lang.Object o)
          Store (track) object associated with the connection, e.g. that invoked the connection to keep some parameters
 java.lang.String toString()
          For debugging/logging purposes: some infos as string
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ConnectionInfo

public ConnectionInfo()

ConnectionInfo

public ConnectionInfo(long t0)
Constructor with setting the start-up time

Parameters:
t0 - if ≤ 0 set to current time
Method Detail

storeObject

public void storeObject(java.lang.Object o)
Store (track) object associated with the connection, e.g. that invoked the connection to keep some parameters


getObject

public java.lang.Object getObject()
Returns the object associated with the connection


setStatus

public void setStatus(int code)
Flag the status of the connection

0=unused/offline, 1=used/online/stay online, -1=failure


getStatus

public int getStatus()
Get the status

Note: If '0' a watcher or listener thread can close the connection


getCurrentDurationTime

public double getCurrentDurationTime()
Track current duration time

A watching thread can use this to show the 'uptime'


setStartUpTimeMillis

public void setStartUpTimeMillis(long t0)
Set startup time; if arg <=0 set to current time


setDownTimeMillis

public void setDownTimeMillis(long t1)
Set 'down-time'


getLastConnectionTime

public double getLastConnectionTime()
Get stored last connection (uptime)


getTotalConnectionTime

public double getTotalConnectionTime()
Get stored total connection time


setTotalConnectionTime

public void setTotalConnectionTime(double total)
Used on reconnections to add total connection times


isCloseRequest

public boolean isCloseRequest()
Get the flag 'close requested'

This is a very important flag. If a handler/thread requests a 'close connection' no other handler should use this connection; it will be down after a few moments/system tics after all pending stuff is done!


close

public void close()
Close connection by setting a 'close request'


setCloseRequest

public void setCloseRequest(boolean closeRequest)
Set a 'close requested'


toString

public java.lang.String toString()
For debugging/logging purposes: some infos as string