|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.alfresco.repo.transaction.SingleEntryTransactionResourceInterceptor
public class SingleEntryTransactionResourceInterceptor
This interceptor gathers basic method call statistics and calls the
resource managers
for
further processing. The resource managers are called after the method
invocations, but it doesn't matter too much since they are called on a time
frequency basis.
It acts as a sampling tool, but doesn't make any decisions or take any action with regard system or transaction-related resources. All samples are stored against the current transaction. If there is no current transaction then no action will be taken with respect to the resource management.
The default is to activate after 10s and call through every 5s.
This class supports both interceptor-based calling as well as manual calling. Long-running processes can call an this manually on every iteration and get the same behaviour of regular calls to the resouce managers.
The current thread is marked on first entry and all subsequent nested re-entries will just get passed down to the underlying delegate invocation method.
MethodResourceManager
Constructor Summary | |
---|---|
SingleEntryTransactionResourceInterceptor()
|
Method Summary | |
---|---|
java.lang.Object |
invoke(org.aopalliance.intercept.MethodInvocation invocation)
|
void |
performManualCheck(java.lang.reflect.Method calledMethod,
long deltaNs)
An alternative method allowing a manual call to check the resources. |
void |
setElapsedTimeBeforeActivationMillis(long elapsedTimeBeforeActivationMillis)
Set the minimum number of seconds that a transaction must have been running for before method sampling begins. |
void |
setMethodResourceManagers(java.util.List methodResourceManagers)
Set the method-based resource managers that will be notified of the statistics. |
void |
setResourceManagerCallFrequencyMillis(long resourceManagerCallFrequencyMillis)
Set the approximate time between calls to the registered resource managers . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SingleEntryTransactionResourceInterceptor()
Method Detail |
---|
public void setMethodResourceManagers(java.util.List methodResourceManagers)
methodResourceManagers
- a list of resource managers - may be null or emptypublic void setElapsedTimeBeforeActivationMillis(long elapsedTimeBeforeActivationMillis)
elapsedTimeBeforeActivationMillis
- an initial idle time in millisecondspublic void setResourceManagerCallFrequencyMillis(long resourceManagerCallFrequencyMillis)
registered resource managers
. This applies to this instance
of the interceptor and not to the transaction. If a single instance of this
class is used in multiple places, then the resource managers will still only get called at a steady
rate. This is mainly in order to streamline the interception prior to the activation phase, but suits
the resource managers since they get given the exact methods that were called anyway.
resourceManagerCallFrequencyMillis
- an approximate time between calls to the resource managerspublic java.lang.Object invoke(org.aopalliance.intercept.MethodInvocation invocation) throws java.lang.Throwable
invoke
in interface org.aopalliance.intercept.MethodInterceptor
java.lang.Throwable
public void performManualCheck(java.lang.reflect.Method calledMethod, long deltaNs)
If you have a loop in a method that doesn't call anything that can be intercepted and handle safely, then get a pre-configured instance (usually from the application context) and mimic the interceptor call.
You should get the Method
, which is used for informational purposes, in a
single call when you calling code is loaded by the classloader. Introspecting every time
you wish to call this method is unnecessary.
calledMethod
- the method that this check applies todeltaNs
- the time in milliseconds that the repeated operation took
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |