ch.elca.el4j.util.socketstatistics
Class SocketStatistics

java.lang.Object
  extended by ch.elca.el4j.util.socketstatistics.SocketStatistics
All Implemented Interfaces:
SocketStatisticsMXBean

public class SocketStatistics
extends Object
implements SocketStatisticsMXBean

Keeps statistics for all sockets / from all socket connections.

Author:
Jonas Hauenstein (JHN)
File-location:
SocketStatistics
Last check-in date:
2009-11-13 16:36:10 +0100 (Fr, 13. Nov 2009) by jonasha for revision 3990

Constructor Summary
SocketStatistics()
           
 
Method Summary
static ConnectionStatistics addNewConStats()
          Add a new ConnectionStatics for a socket.
 void deleteStatistics()
          Delete all gathered statistics.
 void exportStatisticsCSV(String filepath)
          Generate a csv of all gathered statistics and save it on the passed path/filename.
 long getClosedSocketsCount()
          Get number of already closed sockets.
 Set<ConnectionStatistics> getConnectionStatistics()
          Get a Set of all present ConnectionStatics for open and already closed sockets.
 int getKeepStats()
          Getter for the keepStats property which defines how many seconds stats of closed sockets are kept.
 long getOpenSocketsCount()
          Get number of open sockets.
static void setConnectionDestroyed(ConnectionStatistics cs)
          Set a connection as destroyed / closed.
 void setKeepStats(int ks)
          Setter for the keepStats property which defines how many seconds stats of closed sockets are kept.
 void showSocketsStats()
          Print statistics of all listed sockets to stdout.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SocketStatistics

public SocketStatistics()
Method Detail

addNewConStats

public static ConnectionStatistics addNewConStats()
Add a new ConnectionStatics for a socket.

Returns:
the ConnectionsStatics added to the the set

getClosedSocketsCount

public long getClosedSocketsCount()
Get number of already closed sockets.

Specified by:
getClosedSocketsCount in interface SocketStatisticsMXBean
Returns:
number of closed sockets

getOpenSocketsCount

public long getOpenSocketsCount()
Get number of open sockets.

Specified by:
getOpenSocketsCount in interface SocketStatisticsMXBean
Returns:
number of open sockets

getConnectionStatistics

public Set<ConnectionStatistics> getConnectionStatistics()
Get a Set of all present ConnectionStatics for open and already closed sockets.

Specified by:
getConnectionStatistics in interface SocketStatisticsMXBean
Returns:
set of all tracked ConnectionStatatics

getKeepStats

public int getKeepStats()
Getter for the keepStats property which defines how many seconds stats of closed sockets are kept.

Specified by:
getKeepStats in interface SocketStatisticsMXBean
Returns:
how many seconds closed sockets are kept in statistics

setKeepStats

public void setKeepStats(int ks)
Setter for the keepStats property which defines how many seconds stats of closed sockets are kept.

Specified by:
setKeepStats in interface SocketStatisticsMXBean
Parameters:
ks - how many seconds closed sockets will be kept in statistics

exportStatisticsCSV

public void exportStatisticsCSV(String filepath)
Generate a csv of all gathered statistics and save it on the passed path/filename.

Specified by:
exportStatisticsCSV in interface SocketStatisticsMXBean
Parameters:
filepath - path and filename of the csv output

deleteStatistics

public void deleteStatistics()
Delete all gathered statistics.

Specified by:
deleteStatistics in interface SocketStatisticsMXBean

setConnectionDestroyed

public static void setConnectionDestroyed(ConnectionStatistics cs)
Set a connection as destroyed / closed. Also sets the destruction date / close date of the connection to now

Parameters:
cs - the corresponding ConnectionStatics object

showSocketsStats

public void showSocketsStats()
Print statistics of all listed sockets to stdout.



Copyright © 2005-2011 ELCA. All Rights Reserved.