Project JXTA

net.jxta.impl.rendezvous.rendezvousMeter
Class RendezvousConnectionMetric

java.lang.Object
  extended by net.jxta.impl.rendezvous.rendezvousMeter.RendezvousConnectionMetric
All Implemented Interfaces:
DocumentSerializable

public class RendezvousConnectionMetric
extends Object
implements DocumentSerializable

The metrics about a client peer's connection to a rendezvous


Field Summary
static String CONNECTED
           
static String CONNECTING
           
static String DISCONNECTED
           
static String REFUSED
           
 
Constructor Summary
RendezvousConnectionMetric()
           
RendezvousConnectionMetric(PeerID peerID)
           
RendezvousConnectionMetric(RendezvousConnectionMetric prototype)
           
 
Method Summary
(package private)  void beginConnection(long transitionTime)
           
(package private)  void connectionDisconnected(long transitionTime)
           
(package private)  void connectionEstablished(long transitionTime, long timeToConnectTime, long lease)
           
(package private)  void connectionRefused(long transitionTime)
           
 boolean equals(Object obj)
           
 long getBeginConnectionTime()
          Get time began connecting to Rendezvous
 long getDisconnectTime()
          Get time disconnected to Rendezvous
 long getLastLeaseRenewalTime()
          Get Last Lease Renewal Time
 long getLease()
          Get lease establised with Rendezvous
 int getNumConnectionsBegun()
          Get Number of Connections begun with Rendezvous
 int getNumConnectionsEstablished()
          Get Number of Connections established with Rendezvous
 int getNumConnectionsRefused()
          Get Number of Connections refused by Rendezvous
 int getNumDisconnects()
          Get Number of Disconnects
 int getNumLeaseRenewals()
          Get Number of lease Renewals
 PeerID getPeerID()
          Peer ID of Rendezvous
 String getState()
          State of Client Rendezvous
 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 to Rendezvous
 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 getTotalTimesToConnect()
          Get Sum of times it took to connect
 long getTransitionTime()
          Get the time that it entered the current state
 int hashCode()
           
 void initializeFrom(Element element)
           
 boolean isConnected()
          Is connected to Rendezvous
 boolean isConnecting()
          Is connecting to Rendezvous
 boolean isDisconnected()
          Have we disconnected fromthis Rendezvous
(package private)  void leaseRenewed(long lastLeaseRenewalTime, long lease)
           
 void mergeMetrics(RendezvousConnectionMetric otherRendezvousConnectionMetric)
           
 void serializeTo(Element element)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONNECTING

public static final String CONNECTING
See Also:
Constant Field Values

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

RendezvousConnectionMetric

public RendezvousConnectionMetric()

RendezvousConnectionMetric

public RendezvousConnectionMetric(PeerID peerID)

RendezvousConnectionMetric

public RendezvousConnectionMetric(RendezvousConnectionMetric prototype)
Method Detail

getPeerID

public PeerID getPeerID()
Peer ID of Rendezvous


getState

public String getState()
State of Client Rendezvous

Returns:
RendezvousConnectionMetric.CONNECTING, RendezvousConnectionMetric.CONNECTED, RendezvousConnectionMetric.DISCONNECTED or RendezvousConnectionMetric.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

isConnecting

public boolean isConnecting()
Is connecting to Rendezvous


getBeginConnectionTime

public long getBeginConnectionTime()
Get time began connecting to Rendezvous

Returns:
time began or 0 if not connecting

isConnected

public boolean isConnected()
Is connected to Rendezvous


getTimeConnectionEstablished

public long getTimeConnectionEstablished()
Get time connected to Rendezvous

Returns:
time began or 0 if not connected

getLease

public long getLease()
Get lease establised with Rendezvous


getNumConnectionsBegun

public int getNumConnectionsBegun()
Get Number of Connections begun with Rendezvous


getNumConnectionsEstablished

public int getNumConnectionsEstablished()
Get Number of Connections established with Rendezvous


getNumConnectionsRefused

public int getNumConnectionsRefused()
Get Number of Connections refused by Rendezvous


getTotalTimesToConnect

public long getTotalTimesToConnect()
Get Sum of times it took to connect


getLastLeaseRenewalTime

public long getLastLeaseRenewalTime()
Get Last Lease Renewal Time


getNumLeaseRenewals

public int getNumLeaseRenewals()
Get Number of lease Renewals


getNumDisconnects

public int getNumDisconnects()
Get Number of Disconnects


getDisconnectTime

public long getDisconnectTime()
Get time disconnected to Rendezvous

Returns:
time began or 0 if not disconnected

isDisconnected

public boolean isDisconnected()
Have we disconnected fromthis Rendezvous


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()

beginConnection

void beginConnection(long transitionTime)

connectionEstablished

void connectionEstablished(long transitionTime,
                           long timeToConnectTime,
                           long lease)

leaseRenewed

void leaseRenewed(long lastLeaseRenewalTime,
                  long lease)

connectionRefused

void connectionRefused(long transitionTime)

connectionDisconnected

void connectionDisconnected(long transitionTime)

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

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(RendezvousConnectionMetric otherRendezvousConnectionMetric)

JXTA J2SE