org.tranche.flatfile.logs
Class DataBlockUtilLogger

java.lang.Object
  extended by org.tranche.flatfile.logs.DataBlockUtilLogger
All Implemented Interfaces:
DataBlockUtilLog

public class DataBlockUtilLogger
extends java.lang.Object
implements DataBlockUtilLog

Add logs to logger, which is invoked. Logs are like event listeners which conform to same interface as logger.

Author:
Bryan Smith - bryanesmith@gmail.com

Method Summary
 void addLog(DataBlockUtilLog log)
          Add a log that conforms to DataBlockUtilLog interface.
 void clearLogs()
          Clear all logs from the logger.
 void close()
          Close off resources associated with this log.
 long getBlockGetFailures()
          Uses the default log.
 long getBlockGetSuccesses()
          Uses the default log.
 long getBlockSetFailures()
          Uses the default log.
 long getBlockSetSuccesses()
          Uses the default log.
static DataBlockUtilLogger getLogger()
          Static access to singleton log.
 java.util.List<DataBlockUtilLog> getLogs()
          Returns an unmodifiable list of logs attached to logger.
 long getRuntime()
          Uses the default log.
 long getTimeSpentMerging()
          Uses the default log.
 void logGetBlockFailed(BigHash hash)
          Log failed get request.
 void logGetBlockSucceed(BigHash hash)
          Log successful get request.
 void logGetStarted(BigHash hash)
          Log start of a get request.
 void logHasFalse(BigHash hash)
          Log does not have a chunk.
 void logHasStarted(BigHash hash)
          Log the start of a has chunk activity.
 void logHasTrue(BigHash hash)
          Log has a chunk.
 void logMergeFinish(java.io.File datablock)
          Log stop of merge.
 void logMergeStart(java.io.File datablock)
          Log start of merge.
 void logSetBlockFailed(BigHash hash)
          Log failed set request.
 void logSetBlockSucceed(BigHash hash)
          Log successful set request.
 void logSetStarted(BigHash hash)
          Log start of a set request.
 java.lang.String toString()
          Uses the default log.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getLogger

public static DataBlockUtilLogger getLogger()

Static access to singleton log.

Returns:

clearLogs

public void clearLogs()

Clear all logs from the logger. Will need to manually add logs if want, including the aggregate in-memory log.


addLog

public void addLog(DataBlockUtilLog log)

Add a log that conforms to DataBlockUtilLog interface.

Parameters:
log -

getLogs

public java.util.List<DataBlockUtilLog> getLogs()

Returns an unmodifiable list of logs attached to logger.

Returns:

logHasStarted

public void logHasStarted(BigHash hash)

Log the start of a has chunk activity.

Specified by:
logHasStarted in interface DataBlockUtilLog
Parameters:
hash -

logHasTrue

public void logHasTrue(BigHash hash)

Log has a chunk.

Specified by:
logHasTrue in interface DataBlockUtilLog
Parameters:
hash -

logHasFalse

public void logHasFalse(BigHash hash)

Log does not have a chunk.

Specified by:
logHasFalse in interface DataBlockUtilLog
Parameters:
hash -

logGetStarted

public void logGetStarted(BigHash hash)

Log start of a get request.

Specified by:
logGetStarted in interface DataBlockUtilLog
Parameters:
hash -

logSetStarted

public void logSetStarted(BigHash hash)

Log start of a set request.

Specified by:
logSetStarted in interface DataBlockUtilLog
Parameters:
hash -

logMergeStart

public void logMergeStart(java.io.File datablock)

Log start of merge.

Specified by:
logMergeStart in interface DataBlockUtilLog
Parameters:
datablock -

logMergeFinish

public void logMergeFinish(java.io.File datablock)

Log stop of merge.

Specified by:
logMergeFinish in interface DataBlockUtilLog
Parameters:
datablock -

logGetBlockSucceed

public void logGetBlockSucceed(BigHash hash)

Log successful get request.

Specified by:
logGetBlockSucceed in interface DataBlockUtilLog
Parameters:
hash -

logGetBlockFailed

public void logGetBlockFailed(BigHash hash)

Log failed get request.

Specified by:
logGetBlockFailed in interface DataBlockUtilLog
Parameters:
hash -

logSetBlockSucceed

public void logSetBlockSucceed(BigHash hash)

Log successful set request.

Specified by:
logSetBlockSucceed in interface DataBlockUtilLog
Parameters:
hash -

logSetBlockFailed

public void logSetBlockFailed(BigHash hash)

Log failed set request.

Specified by:
logSetBlockFailed in interface DataBlockUtilLog
Parameters:
hash -

close

public void close()
           throws java.lang.Exception

Close off resources associated with this log.

Specified by:
close in interface DataBlockUtilLog
Throws:
java.lang.Exception

getTimeSpentMerging

public long getTimeSpentMerging()

Uses the default log. For more information, call logs directly.

Specified by:
getTimeSpentMerging in interface DataBlockUtilLog
Returns:

getRuntime

public long getRuntime()

Uses the default log. For more information, call logs directly.

Specified by:
getRuntime in interface DataBlockUtilLog
Returns:

toString

public java.lang.String toString()
Uses the default log. For more information, call logs directly.

Specified by:
toString in interface DataBlockUtilLog
Overrides:
toString in class java.lang.Object

getBlockGetSuccesses

public long getBlockGetSuccesses()

Uses the default log. For more information, call logs directly.

Specified by:
getBlockGetSuccesses in interface DataBlockUtilLog
Returns:

getBlockGetFailures

public long getBlockGetFailures()

Uses the default log. For more information, call logs directly.

Specified by:
getBlockGetFailures in interface DataBlockUtilLog
Returns:

getBlockSetSuccesses

public long getBlockSetSuccesses()

Uses the default log. For more information, call logs directly.

Specified by:
getBlockSetSuccesses in interface DataBlockUtilLog
Returns:

getBlockSetFailures

public long getBlockSetFailures()

Uses the default log. For more information, call logs directly.

Specified by:
getBlockSetFailures in interface DataBlockUtilLog
Returns:


This code is free for use both commercially and non-commercially as stated in the project's license