Spring Integration

org.springframework.integration.monitor
Class DirectChannelMetrics

java.lang.Object
  extended by org.springframework.integration.monitor.DirectChannelMetrics
All Implemented Interfaces:
org.aopalliance.aop.Advice, org.aopalliance.intercept.Interceptor, org.aopalliance.intercept.MethodInterceptor, MessageChannelMetrics
Direct Known Subclasses:
PollableChannelMetrics

@ManagedResource
public class DirectChannelMetrics
extends java.lang.Object
implements org.aopalliance.intercept.MethodInterceptor, MessageChannelMetrics

Registers all message channels, and accumulates statistics about their performance. The statistics are then published locally for other components to consume and publish remotely.

Since:
2.0
Author:
Dave Syer, Helena Edelson

Field Summary
static int DEFAULT_MOVING_AVERAGE_WINDOW
           
protected  org.apache.commons.logging.Log logger
           
static long ONE_MINUTE_SECONDS
           
static long ONE_SECOND_SECONDS
           
 
Constructor Summary
DirectChannelMetrics(MessageChannel messageChannel, java.lang.String name)
           
 
Method Summary
 void destroy()
           
protected  java.lang.Object doInvoke(org.aopalliance.intercept.MethodInvocation invocation, java.lang.String method, MessageChannel channel)
           
 Statistics getErrorRate()
           
 double getMaxSendDuration()
           
 double getMeanErrorRate()
           
 double getMeanErrorRatio()
           
 double getMeanSendDuration()
           
 double getMeanSendRate()
           
 MessageChannel getMessageChannel()
           
 double getMinSendDuration()
           
 java.lang.String getName()
           
 int getSendCount()
           
 Statistics getSendDuration()
           
 int getSendErrorCount()
           
 Statistics getSendRate()
           
 double getStandardDeviationSendDuration()
           
 double getTimeSinceLastSend()
           
 java.lang.Object invoke(org.aopalliance.intercept.MethodInvocation invocation)
           
 void reset()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

logger

protected final org.apache.commons.logging.Log logger

ONE_SECOND_SECONDS

public static final long ONE_SECOND_SECONDS
See Also:
Constant Field Values

ONE_MINUTE_SECONDS

public static final long ONE_MINUTE_SECONDS
See Also:
Constant Field Values

DEFAULT_MOVING_AVERAGE_WINDOW

public static final int DEFAULT_MOVING_AVERAGE_WINDOW
See Also:
Constant Field Values
Constructor Detail

DirectChannelMetrics

public DirectChannelMetrics(MessageChannel messageChannel,
                            java.lang.String name)
Method Detail

destroy

public void destroy()

getMessageChannel

public MessageChannel getMessageChannel()

getName

public java.lang.String getName()

invoke

public java.lang.Object invoke(org.aopalliance.intercept.MethodInvocation invocation)
                        throws java.lang.Throwable
Specified by:
invoke in interface org.aopalliance.intercept.MethodInterceptor
Throws:
java.lang.Throwable

doInvoke

protected java.lang.Object doInvoke(org.aopalliance.intercept.MethodInvocation invocation,
                                    java.lang.String method,
                                    MessageChannel channel)
                             throws java.lang.Throwable
Throws:
java.lang.Throwable

reset

public void reset()
Specified by:
reset in interface MessageChannelMetrics

getSendCount

public int getSendCount()
Specified by:
getSendCount in interface MessageChannelMetrics
Returns:
the number of successful sends

getSendErrorCount

public int getSendErrorCount()
Specified by:
getSendErrorCount in interface MessageChannelMetrics
Returns:
the number of failed sends (either throwing an exception or rejected by the channel)

getTimeSinceLastSend

public double getTimeSinceLastSend()
Specified by:
getTimeSinceLastSend in interface MessageChannelMetrics
Returns:
the time in seconds since the last send

getMeanSendRate

public double getMeanSendRate()
Specified by:
getMeanSendRate in interface MessageChannelMetrics
Returns:
the mean send rate (per second)

getMeanErrorRate

public double getMeanErrorRate()
Specified by:
getMeanErrorRate in interface MessageChannelMetrics
Returns:
the mean error rate (per second). Errors comprise all failed sends.

getMeanErrorRatio

public double getMeanErrorRatio()
Specified by:
getMeanErrorRatio in interface MessageChannelMetrics
Returns:
the mean ratio of failed to successful sends in approximately the last minute

getMeanSendDuration

public double getMeanSendDuration()
Specified by:
getMeanSendDuration in interface MessageChannelMetrics
Returns:
the mean send duration (milliseconds)

getMinSendDuration

public double getMinSendDuration()
Specified by:
getMinSendDuration in interface MessageChannelMetrics
Returns:
the minimum send duration (milliseconds) since startup

getMaxSendDuration

public double getMaxSendDuration()
Specified by:
getMaxSendDuration in interface MessageChannelMetrics
Returns:
the maximum send duration (milliseconds) since startup

getStandardDeviationSendDuration

public double getStandardDeviationSendDuration()
Specified by:
getStandardDeviationSendDuration in interface MessageChannelMetrics
Returns:
the standard deviation send duration (milliseconds)

getSendDuration

public Statistics getSendDuration()
Specified by:
getSendDuration in interface MessageChannelMetrics
Returns:
summary statistics about the send duration (milliseconds)

getSendRate

public Statistics getSendRate()
Specified by:
getSendRate in interface MessageChannelMetrics
Returns:
summary statistics about the send rates (per second)

getErrorRate

public Statistics getErrorRate()
Specified by:
getErrorRate in interface MessageChannelMetrics
Returns:
summary statistics about the error rates (per second)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

Spring Integration