Project JXTA

net.jxta.impl.util
Class EndpointServiceStatsFilter

java.lang.Object
  extended bynet.jxta.impl.util.EndpointServiceStatsFilter
All Implemented Interfaces:
EndpointFilterListener

public class EndpointServiceStatsFilter
extends Object
implements EndpointFilterListener

Instances of this clas can be registered with an EndpointService to gather statistics about what kind of messages pass through it. This class is not MT-safe, so make sure you plug it only into one endpoint service.

See Also:
net.jxta.endpoint.EndpointService#addFilterListener

Field Summary
(package private)  Hashtable channelTrafficTable
           
(package private)  Hashtable destCountTable
           
(package private)  long lastMessageTime
           
(package private)  Hashtable sourceCountTable
           
 
Constructor Summary
EndpointServiceStatsFilter()
           
 
Method Summary
 Enumeration getChannelNames()
           
 long getLastMessageTime()
          Get the time we last saw a message.
 long getMessageCountFrom(EndpointAddress addr)
          Get the number of messages received from a given address.
 long getMessageCountTo(EndpointAddress addr)
          Get the number of messages we've seen that were adderssed to a given address.
 long getTrafficOnChannel(String channel)
          Get the number of messages seen with a given message element namespace or full message element name.
 Message processIncomingMessage(Message msg, EndpointAddress source, EndpointAddress dest)
          This method is called by the EndpointService to give us a chance to look at the message before it is dispatched to any listeners.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

lastMessageTime

long lastMessageTime

channelTrafficTable

Hashtable channelTrafficTable

sourceCountTable

Hashtable sourceCountTable

destCountTable

Hashtable destCountTable
Constructor Detail

EndpointServiceStatsFilter

public EndpointServiceStatsFilter()
Method Detail

processIncomingMessage

public Message processIncomingMessage(Message msg,
                                      EndpointAddress source,
                                      EndpointAddress dest)
This method is called by the EndpointService to give us a chance to look at the message before it is dispatched to any listeners.

Specified by:
processIncomingMessage in interface EndpointFilterListener

getLastMessageTime

public long getLastMessageTime()
Get the time we last saw a message.

Returns:
time last message was received, in milliseconds, since Jan. 1, 1970.

getTrafficOnChannel

public long getTrafficOnChannel(String channel)
Get the number of messages seen with a given message element namespace or full message element name. (Both are referred to as "channel" here because filters and listeners are dispatched by the EndpointService based on message element namespaces or fully name.)


getChannelNames

public Enumeration getChannelNames()

getMessageCountFrom

public long getMessageCountFrom(EndpointAddress addr)
Get the number of messages received from a given address.


getMessageCountTo

public long getMessageCountTo(EndpointAddress addr)
Get the number of messages we've seen that were adderssed to a given address.


JXTA J2SE