Project JXTA

net.jxta.impl.rendezvous.rendezvousMeter
Class ClientConnectionMetric

java.lang.Object
  extended bynet.jxta.impl.rendezvous.rendezvousMeter.ClientConnectionMetric
All Implemented Interfaces:
DocumentSerializable

public class ClientConnectionMetric
extends Object
implements DocumentSerializable

The rendezvous's metric for a client peer interacting with a it


Field Summary
static String CONNECTED
           
static String DISCONNECTED
           
static String REFUSED
           
 
Constructor Summary
ClientConnectionMetric()
           
ClientConnectionMetric(ClientConnectionMetric prototype)
           
ClientConnectionMetric(PeerID peerID)
           
 
Method Summary
(package private)  void clientConnectionDisconnected(boolean normal, long transitionTime)
           
(package private)  void clientConnectionEstablished(long transitionTime, long lease)
           
(package private)  void clientConnectionRefused(long transitionTime)
           
(package private)  void clientLeaseRenewed(long lastLeaseRenewalTime, long lease)
           
(package private)  void errorAddingClient()
           
 long getDisconnectTime()
          Get time Connected
 long getLastLeaseRenewalTime()
          Get Last Received Lease Renewal Time
 long getLease()
          Get Lease time granted for last lease Renewal Request.
 int getNumConnectionsRefused()
          Get number of refused connect/lease-renewal messages received from this peer
 int getNumConnects()
          Get number of granted connect messages received from this peer
 int getNumDisconnects()
          Get number of disconnect messages received from this peer
 int getNumErrorsAddingClient()
          Get number of errors when attempting to add this peer as a client
 int getNumLeaseRenewals()
          Get number of granted lease renewal messages received from this peer
 int getNumUnableToRespondToConnectRequest()
          Get number of errors when attempting to respond to this peer's request
 PeerID getPeerID()
          Peer ID of this Client Connection
 String getState()
          State of Client Connection
 long getTimeConnected()
          Get the duration of current connection relative to local clock (from transition time)

Note: This assumes the clocks are in sync with the reporting peer
 long getTimeConnected(long adjustmentTime)
          Get the duration of current connection until the specified time
 long getTimeConnectionEstablished()
          Get time Connected
 long getTotalTimeConnected()
          Get the total time this peer has been connected.
 long getTotalTimeConnected(long adjustmentTime)
          Get the total time this peer has been connected.
 long getTransitionTime()
          Get the time that it entered the current state
 void initializeFrom(Element element)
           
 boolean isConnected()
          Is this client connected
 boolean isDisconnected()
          Is this client disconnected
 void mergeMetrics(ClientConnectionMetric otherClientConnectionMetric)
           
 void serializeTo(Element element)
           
(package private)  void unableToRespondToConnectRequest()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONNECTED

public static final String CONNECTED
See Also:
Constant Field Values

DISCONNECTED

public static final String DISCONNECTED
See Also:
Constant Field Values

REFUSED

public static final String REFUSED
See Also:
Constant Field Values
Constructor Detail

ClientConnectionMetric

public ClientConnectionMetric()

ClientConnectionMetric

public ClientConnectionMetric(PeerID peerID)

ClientConnectionMetric

public ClientConnectionMetric(ClientConnectionMetric prototype)
Method Detail

getPeerID

public PeerID getPeerID()
Peer ID of this Client Connection


getState

public String getState()
State of Client Connection

Returns:
ClientConnectionMetric.CONNECTED, ClientConnectionMetric.DISCONNECTED or ClientConnectionMetric.REFUSED

getTransitionTime

public long getTransitionTime()
Get the time that it entered the current state

Returns:
transition time in ms since January 1, 1970, 00:00:00 GMT

isConnected

public boolean isConnected()
Is this client connected


getTimeConnectionEstablished

public long getTimeConnectionEstablished()
Get time Connected

Returns:
time or 0 if not connected

getDisconnectTime

public long getDisconnectTime()
Get time Connected

Returns:
time or 0 if not disconnected

isDisconnected

public boolean isDisconnected()
Is this client disconnected


getLease

public long getLease()
Get Lease time granted for last lease Renewal Request.

See Also:
getLastLeaseRenewalTime();

getLastLeaseRenewalTime

public long getLastLeaseRenewalTime()
Get Last Received Lease Renewal Time

See Also:
getLease();

getNumConnects

public int getNumConnects()
Get number of granted connect messages received from this peer


getNumLeaseRenewals

public int getNumLeaseRenewals()
Get number of granted lease renewal messages received from this peer


getNumDisconnects

public int getNumDisconnects()
Get number of disconnect messages received from this peer


getNumConnectionsRefused

public int getNumConnectionsRefused()
Get number of refused connect/lease-renewal messages received from this peer


getNumErrorsAddingClient

public int getNumErrorsAddingClient()
Get number of errors when attempting to add this peer as a client


getNumUnableToRespondToConnectRequest

public int getNumUnableToRespondToConnectRequest()
Get number of errors when attempting to respond to this peer's request


getTotalTimeConnected

public long getTotalTimeConnected()
Get the total time this peer has been connected.

Note: This does not include the current time connected (if it is currently connected)

Returns:
time in ms (see note above)
See Also:
getTotalTimeConnected(long)

getTotalTimeConnected

public long getTotalTimeConnected(long adjustmentTime)
Get the total time this peer has been connected. If it is currently connected, then the total time is adjusted to include the time since the transition time to become connected until the provided time

Parameters:
adjustmentTime - The time of this metric will be adjusted to
Returns:
time in ms (see note above)
See Also:
getTotalTimeConnected()

getTimeConnected

public long getTimeConnected()
Get the duration of current connection relative to local clock (from transition time)

Note: This assumes the clocks are in sync with the reporting peer

Returns:
time in ms (see note above) or 0 if not connected
See Also:
getTotalTimeConnected(long)

getTimeConnected

public long getTimeConnected(long adjustmentTime)
Get the duration of current connection until the specified time

Parameters:
adjustmentTime - The time of this metric will be computed until
Returns:
time in ms (see note above) or 0 if not connected
See Also:
getTimeConnected()

clientConnectionEstablished

void clientConnectionEstablished(long transitionTime,
                                 long lease)

clientLeaseRenewed

void clientLeaseRenewed(long lastLeaseRenewalTime,
                        long lease)

errorAddingClient

void errorAddingClient()

clientConnectionDisconnected

void clientConnectionDisconnected(boolean normal,
                                  long transitionTime)

unableToRespondToConnectRequest

void unableToRespondToConnectRequest()

clientConnectionRefused

void clientConnectionRefused(long transitionTime)

serializeTo

public void serializeTo(Element element)
                 throws DocumentSerializationException
Specified by:
serializeTo in interface DocumentSerializable
Throws:
DocumentSerializationException

initializeFrom

public void initializeFrom(Element element)
                    throws DocumentSerializationException
Specified by:
initializeFrom in interface DocumentSerializable
Throws:
DocumentSerializationException

mergeMetrics

public void mergeMetrics(ClientConnectionMetric otherClientConnectionMetric)

JXTA J2SE