|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.sasl.aop.AbstractRootAspect net.sf.sasl.aop.AbstractPlaceholderScriptUsingAspect net.sf.sasl.aop.monitoring.execution.time.ThresholdMethodExecutionTimeWarnAspect
public class ThresholdMethodExecutionTimeWarnAspect
The task that this aspect addresses is to send configurable warn and recovery
messages over configurable communication channels (mail, irc, instant
messenger, ...), if the execution time of a target method exceeds a given
threshold value. To reduce flooding of warn messages if a system is
temporarily at the limit for some operation, it could be also configured that
the aspects sends a warn message only again for a (target class, target
method) pair after a given time has gone. This feature is reduced by the
maximum number of elements the cache can store.
The aspect could be used to monitor the execution behavior of own services,
for example to answer the following questions:
net.sf.sasl.aop.common.grammar.placeholder.resolver
Nested Class Summary | |
---|---|
protected class |
ThresholdMethodExecutionTimeWarnAspect.MessageSender
Helper class to interpret and deliver warn and recovery messages concurrently. |
protected class |
ThresholdMethodExecutionTimeWarnAspect.SendRecoveryMessageMarker
Small helper class for the concurrent synchronization between the warn and recovery message sending threads. |
Field Summary |
---|
Fields inherited from class net.sf.sasl.aop.AbstractPlaceholderScriptUsingAspect |
---|
placeholderSymbolTable |
Fields inherited from class net.sf.sasl.aop.AbstractRootAspect |
---|
logger |
Fields inherited from interface org.springframework.core.Ordered |
---|
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE |
Constructor Summary | |
---|---|
ThresholdMethodExecutionTimeWarnAspect()
|
Method Summary | |
---|---|
void |
afterPropertiesSet()
|
net.sf.ehcache.Ehcache |
getCache()
|
List<ICommunicationChannel> |
getCommunicationChannels()
|
List<MethodExecutionTimeThresholdBean> |
getMethodExecutionTimeThresholdChain()
|
IScheduleService |
getScheduleService()
|
PlaceholderScriptMessage |
getScriptedRecoveryMessage()
|
PlaceholderScriptMessage |
getScriptedWarnMessage()
|
Object |
invoke(org.aopalliance.intercept.MethodInvocation invocation)
Please see the documentation header of the class for more informations what this method does in whole. |
protected MethodExecutionTimeThresholdBean |
lookupThresholdConfiguration(org.aopalliance.intercept.MethodInvocation invocation)
Returns the first threshold configuration of the the threshold configuration chain list that matches for the (targetObject, targetMethod, targetArguments) triple. |
protected static String |
makeCacheKey(Object targetObject,
Method targetMethod)
Creates a cache key for a (targetObject, targetMethod) pair. |
void |
setCache(net.sf.ehcache.Ehcache cache)
Sets the cache which will be used to decide if a warn message should be send for a slow operation, if a flooding restriction was set via #setWaitTimeBeforeSendingNewWarnMessage(TimeUnitsBean) . |
void |
setCommunicationChannels(List<ICommunicationChannel> communicationChannels)
Sets a list of communication channels to which warn and recovery messages will be delivered. |
void |
setMethodExecutionTimeThresholdChain(List<MethodExecutionTimeThresholdBean> methodExecutionTimeThresholdChain)
Sets a chain list of MethodExecutionTimeThresholdBeans. |
void |
setRecoveryMessage(MessageBean recoveryMessage)
Sets the recovery message which will be send after a target method finished its execution and a warn message was sent for it. |
void |
setScheduleService(IScheduleService scheduleService)
Sets a schedule service which will be used for operations that can run concurrent like sending warn and recovery messages, so that the execution of the targetMethod gets not deferred. |
void |
setWarnMessage(MessageBean warnMessage)
Sets the warn message which will be send, if the execution time of a target method is over the defined threshold time. |
Methods inherited from class net.sf.sasl.aop.AbstractPlaceholderScriptUsingAspect |
---|
getPlaceholderSymbolTable, runInterpreter, setPlaceholderResolverList |
Methods inherited from class net.sf.sasl.aop.AbstractRootAspect |
---|
getLogger, getOrder, setLogger, setLoggerByName, setOrder |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ThresholdMethodExecutionTimeWarnAspect()
Method Detail |
---|
public Object invoke(org.aopalliance.intercept.MethodInvocation invocation) throws Throwable
invoke
in interface org.aopalliance.intercept.MethodInterceptor
Throwable
MethodInterceptor.invoke(org.aopalliance.intercept.MethodInvocation)
protected MethodExecutionTimeThresholdBean lookupThresholdConfiguration(org.aopalliance.intercept.MethodInvocation invocation)
invocation
- non null
public List<MethodExecutionTimeThresholdBean> getMethodExecutionTimeThresholdChain()
setMethodExecutionTimeThresholdChain(List)
public void setMethodExecutionTimeThresholdChain(List<MethodExecutionTimeThresholdBean> methodExecutionTimeThresholdChain) throws IllegalArgumentException
methodExecutionTimeThresholdChain
- non null
IllegalArgumentException
- if methodExecutionTimeThresholdChain is null or there exists
a bean in the list that has got a a total milliseconds time
value lesser than 0.public IScheduleService getScheduleService()
setScheduleService(IScheduleService)
public void setScheduleService(IScheduleService scheduleService) throws IllegalArgumentException
scheduleService
- non null
IllegalArgumentException
- if scheduleService is null.public List<ICommunicationChannel> getCommunicationChannels()
setCommunicationChannels(List)
public void setCommunicationChannels(List<ICommunicationChannel> communicationChannels) throws IllegalArgumentException
communicationChannels
- non null
IllegalArgumentException
- if communicationChannels is null.public PlaceholderScriptMessage getScriptedWarnMessage()
setWarnMessage(MessageBean)
public void setWarnMessage(MessageBean warnMessage) throws IllegalArgumentException, ParseException
warnMessage
- non null
ParseException
- if a parse error occurs during parsing the subject and
message of the message bean.
IllegalArgumentException
- if warnMessage is null.public PlaceholderScriptMessage getScriptedRecoveryMessage()
setRecoveryMessage(MessageBean)
public void setRecoveryMessage(MessageBean recoveryMessage) throws IllegalArgumentException, ParseException
recoveryMessage
- non null.
IllegalArgumentException
- if recoveryMessage is null.
ParseException
- if a parse error occurs during parsing the subject and
message of the message bean.public net.sf.ehcache.Ehcache getCache()
#setCache(Cache)
public void setCache(net.sf.ehcache.Ehcache cache)
#setWaitTimeBeforeSendingNewWarnMessage(TimeUnitsBean)
.
cache
- null or non nullpublic void afterPropertiesSet() throws Exception
afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
IllegalStateException
- if there exists a MethodExecutionTimeThresholdBean in the
chain list that have a non zero
waitTimeBeforeNewWarnMessageSeconds value but no cache was
set.
Exception
InitializingBean.afterPropertiesSet()
protected static String makeCacheKey(Object targetObject, Method targetMethod)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |