Class PerThreadOperationTracker
- java.lang.Object
-
- org.apache.tapestry5.ioc.internal.PerThreadOperationTracker
-
- All Implemented Interfaces:
OperationTracker
public class PerThreadOperationTracker extends java.lang.Object implements OperationTracker
Manages a per-thread OperationTracker using a ThreadLocal.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.tapestry5.ioc.OperationTracker
OperationTracker.NonLoggableException
-
-
Constructor Summary
Constructors Constructor Description PerThreadOperationTracker(org.slf4j.Logger logger)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> T
invoke(java.lang.String description, Invokable<T> operation)
As withOperationTracker.run(String, Runnable)
, but the operation may return a value.<T> T
perform(java.lang.String description, IOOperation<T> operation)
As withOperationTracker.invoke(String, Invokable)
, but the operation may throw anIOException
.void
run(java.lang.String description, java.lang.Runnable operation)
Executes the operation.
-
-
-
Constructor Detail
-
PerThreadOperationTracker
public PerThreadOperationTracker(org.slf4j.Logger logger)
-
-
Method Detail
-
run
public void run(java.lang.String description, java.lang.Runnable operation)
Description copied from interface:OperationTracker
Executes the operation. If the operation throws aRuntimeException
it will be logged and rethrown wrapped as aOperationException
.- Specified by:
run
in interfaceOperationTracker
- Parameters:
description
- used if there is an exceptionoperation
- to execute
-
invoke
public <T> T invoke(java.lang.String description, Invokable<T> operation)
Description copied from interface:OperationTracker
As withOperationTracker.run(String, Runnable)
, but the operation may return a value.- Specified by:
invoke
in interfaceOperationTracker
- Parameters:
description
- used if there is an exceptionoperation
- to invoke- Returns:
- result of operation
-
perform
public <T> T perform(java.lang.String description, IOOperation<T> operation) throws java.io.IOException
Description copied from interface:OperationTracker
As withOperationTracker.invoke(String, Invokable)
, but the operation may throw anIOException
.- Specified by:
perform
in interfaceOperationTracker
- Parameters:
description
- used if there is an exception (outside of IOException)operation
- to perform- Returns:
- result of operation
- Throws:
java.io.IOException
-
-