Skip to content
Snippets Groups Projects
Commit c401efe9 authored by buczekp's avatar buczekp
Browse files

[DMV-39] added logging on StoreItem transfer start and finish

SVN: 14660
parent 6b57d033
No related branches found
No related tags found
No related merge requests found
...@@ -263,7 +263,8 @@ public final class DataMover ...@@ -263,7 +263,8 @@ public final class DataMover
final IFileStore readyToMoveStore = final IFileStore readyToMoveStore =
FileStoreFactory.createLocal(sourceDirectory, "ready-to-move", factory, false); FileStoreFactory.createLocal(sourceDirectory, "ready-to-move", factory, false);
final IStoreHandler remoteStoreMover = final IStoreHandler remoteStoreMover =
createOutgoingPathMover(readyToMoveStore, outgoingStore); wrapHandleWithLogging(createOutgoingPathMover(readyToMoveStore, outgoingStore),
null, "FINISHED_TRANSFER");
final HighwaterMarkDirectoryScanningHandler directoryScanningHandler = final HighwaterMarkDirectoryScanningHandler directoryScanningHandler =
new HighwaterMarkDirectoryScanningHandler(new FaultyPathDirectoryScanningHandler( new HighwaterMarkDirectoryScanningHandler(new FaultyPathDirectoryScanningHandler(
sourceDirectory, remoteStoreMover), outgoingStore.getHighwaterMarkWatcher()); sourceDirectory, remoteStoreMover), outgoingStore.getHighwaterMarkWatcher());
...@@ -321,9 +322,43 @@ public final class DataMover ...@@ -321,9 +322,43 @@ public final class DataMover
} }
// //
// Helper classes // Helper methods and classes
// //
/**
* Wraps {@link IStoreHandler} into another one with additional option of logging before and
* after handling an item is performed by the <var>originalHandler</var>.
*
* @param prefixBeforeOrNull if not <code>null</code> a message with this prefix and handled
* item name will be logged before item handling
* @param prefixAfterOrNull if not <code>null</code> a message with this prefix and handled item
* name will be logged after item handling
*/
public final static IStoreHandler wrapHandleWithLogging(final IStoreHandler originalHandler,
final String prefixBeforeOrNull, final String prefixAfterOrNull)
{
return new IStoreHandler()
{
public void handle(StoreItem item)
{
if (prefixBeforeOrNull != null)
{
operationLog.info(prefixBeforeOrNull + ": " + item);
}
originalHandler.handle(item);
if (prefixAfterOrNull != null)
{
operationLog.info(prefixAfterOrNull + ": " + item);
}
}
public boolean isStopped()
{
return originalHandler.isStopped();
}
};
}
private final static class RunOnceMoreAfterTerminateDataMoverProcess extends DataMoverProcess private final static class RunOnceMoreAfterTerminateDataMoverProcess extends DataMoverProcess
{ {
RunOnceMoreAfterTerminateDataMoverProcess(final TimerTask timerTask, final String taskName, RunOnceMoreAfterTerminateDataMoverProcess(final TimerTask timerTask, final String taskName,
......
...@@ -165,7 +165,9 @@ public class IncomingProcessor implements IRecoverableTimerTaskFactory ...@@ -165,7 +165,9 @@ public class IncomingProcessor implements IRecoverableTimerTaskFactory
final File copyInProgressDir = bufferDirs.getCopyInProgressDir(); final File copyInProgressDir = bufferDirs.getCopyInProgressDir();
final HighwaterMarkWatcher highwaterMarkWatcher = final HighwaterMarkWatcher highwaterMarkWatcher =
new HighwaterMarkWatcher(bufferDirs.getBufferDirHighwaterMark()); new HighwaterMarkWatcher(bufferDirs.getBufferDirHighwaterMark());
final IStoreHandler pathHandler = createIncomingMovingPathHandler(); final IStoreHandler pathHandler =
DataMover.wrapHandleWithLogging(createIncomingMovingPathHandler(),
"STARTED_TRANSFER", null);
final HighwaterMarkDirectoryScanningHandler directoryScanningHandler = final HighwaterMarkDirectoryScanningHandler directoryScanningHandler =
new HighwaterMarkDirectoryScanningHandler(new FaultyPathDirectoryScanningHandler( new HighwaterMarkDirectoryScanningHandler(new FaultyPathDirectoryScanningHandler(
copyInProgressDir, pathHandler), highwaterMarkWatcher, copyInProgressDir); copyInProgressDir, pathHandler), highwaterMarkWatcher, copyInProgressDir);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment