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 interfaceAbstractLogger.CallableType of thunk used inexecute(Callable, String, Object[])protected static interfaceAbstractLogger.SafeCallableType of thunk used inexecute(SafeCallable, String, Object[])
-
Constructor Summary
Constructors Constructor Description AbstractLogger(LogWriter writer)Create a new instance of this log wrapper which useswriterfor persisting log messages.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Objectexecute(AbstractLogger.Callable thunk, String methodName, Object[] args)Execute athunkof a method which might throw aRepositoryException.protected Objectexecute(AbstractLogger.SafeCallable thunk, String methodName, Object[] args)Execute athunkof 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 useswriterfor persisting log messages.- Parameters:
writer-
-
-
Method Detail
-
execute
protected Object execute(AbstractLogger.Callable thunk, String methodName, Object[] args) throws RepositoryException
Execute athunkof a method which might throw aRepositoryException. The call is logged towriterright 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 thethunkthrows an Exception the exception is re-thrown.
-
execute
protected Object execute(AbstractLogger.SafeCallable thunk, String methodName, Object[] args)
Execute athunkof a method which does not throw any checked exception. The call is logged towriterright 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
-
-