com.gain.rateservice
Class RateService

java.lang.Object
  |
  +--com.gain.rateservice.RateService
All Implemented Interfaces:
java.lang.Runnable

public class RateService
extends java.lang.Object
implements java.lang.Runnable

RateService Connects to the rates service on a separate thread and processes rates messages


Constructor Summary
RateService(RateServiceListener listener, java.lang.String host, int port, java.lang.String key)
          Constructs a Rates Service with the following parameters
RateService(RateServiceListener listener, java.lang.String host, int port, java.lang.String key, boolean compactRates)
          Constructs a Rates Service with the following parameters
 
Method Summary
 boolean connect()
          Connect - connect the rate service
 boolean disconnect()
          Disconnect- Disconnects the rate service.
 int getFailedConsecutiveCounnectionCount()
          getFailedConsecutiveCounnectionCount
 int getFailedCounnectionCount()
          getFailedConnectionCount
 int getSuccessfullCounnectionCount()
          getSuccessfullConnectionCount
static java.lang.String getVersion()
          getVersion
 boolean isConnected()
          IsConnected
 void run()
          Worker Thread routine, connects to the host, processes/distributes rate messages
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RateService

public RateService(RateServiceListener listener,
                   java.lang.String host,
                   int port,
                   java.lang.String key)
Constructs a Rates Service with the following parameters
Parameters:
listener - Rate Listener to receive rate callbacks on
host - Rate Server Host Address
port - Rate Server Port
key - Authentication key to use

RateService

public RateService(RateServiceListener listener,
                   java.lang.String host,
                   int port,
                   java.lang.String key,
                   boolean compactRates)
Constructs a Rates Service with the following parameters
Parameters:
listener - Rate Listener to receive rate callbacks on
host - Rate Server Host Address
port - Rate Server Port
key - Authentication key to use
compactRates - Flag to indicate if compact rates should be used
Method Detail

getVersion

public static java.lang.String getVersion()
getVersion
Returns:
the version number of the rates service

connect

public boolean connect()
Connect - connect the rate service

disconnect

public boolean disconnect()
Disconnect- Disconnects the rate service.

isConnected

public boolean isConnected()
IsConnected
Returns:
Return true if connected to the rates service, otherwise false.

getSuccessfullCounnectionCount

public int getSuccessfullCounnectionCount()
getSuccessfullConnectionCount
Returns:
the total successfull connection count.

getFailedCounnectionCount

public int getFailedCounnectionCount()
getFailedConnectionCount
Returns:
the total failed connection count.

getFailedConsecutiveCounnectionCount

public int getFailedConsecutiveCounnectionCount()
getFailedConsecutiveCounnectionCount
Returns:
the total consecutive failed connection count since the last successfull connect or since connections attempts started.

run

public void run()
Worker Thread routine, connects to the host, processes/distributes rate messages
Specified by:
run in interface java.lang.Runnable