Class AbstractLogger
- java.lang.Object
-
- org.apache.jackrabbit.spi.commons.logging.AbstractLogger
-
- Direct Known Subclasses:
BatchLogger
,IdFactoryLogger
,NameFactoryLogger
,PathFactoryLogger
,QValueFactoryLogger
,RepositoryServiceLogger
,SessionInfoLogger
public class AbstractLogger extends Object
Common base class for all log wrappers of SPI entities.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static interface
AbstractLogger.Callable
Type of thunk used inexecute(Callable, String, Object[])
protected static interface
AbstractLogger.SafeCallable
Type of thunk used inexecute(SafeCallable, String, Object[])
-
Constructor Summary
Constructors Constructor Description AbstractLogger(LogWriter writer)
Create a new instance of this log wrapper which useswriter
for persisting log messages.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Object
execute(AbstractLogger.Callable thunk, String methodName, Object[] args)
Execute athunk
of a method which might throw aRepositoryException
.protected Object
execute(AbstractLogger.SafeCallable thunk, String methodName, Object[] args)
Execute athunk
of a method which does not throw any checked exception.
-
-
-
Constructor Detail
-
AbstractLogger
public AbstractLogger(LogWriter writer)
Create a new instance of this log wrapper which useswriter
for persisting log messages.- Parameters:
writer
-
-
-
Method Detail
-
execute
protected Object execute(AbstractLogger.Callable thunk, String methodName, Object[] args) throws RepositoryException
Execute athunk
of a method which might throw aRepositoryException
. The call is logged towriter
right before it is actually performed and after it returns. Any exception thrown by the call is logged before it is re-thrown.- Parameters:
thunk
- thunk of the method to executemethodName
- the name of the methodargs
- the arguments passed to the method- Returns:
- the value returned from executing the
thunk
- Throws:
RepositoryException
- if executing thethunk
throws an Exception the exception is re-thrown.
-
execute
protected Object execute(AbstractLogger.SafeCallable thunk, String methodName, Object[] args)
Execute athunk
of a method which does not throw any checked exception. The call is logged towriter
right before it is actually performed and after it returns.- Parameters:
thunk
- thunk of the method to executemethodName
- the name of the methodargs
- the arguments passed to the method- Returns:
- the value returned from executing the
thunk
-
-