com.neeve.rog.log
Class RogLogCompactor

java.lang.Object
  extended by com.neeve.root.RootObject
      extended by com.neeve.rog.RogObject
          extended by com.neeve.rog.log.RogLogCompactor

public final class RogLogCompactor
extends RogObject

Compacts a log's live log file

Threading:
A log compactor is not safe for concurrent access by multiple threads.

Nested Class Summary
static class RogLogCompactor.State
          Enmerates the various compactor states
 
Method Summary
 RogLogCompactor compact()
          Perform the log compaction This method kicks off the background compaction of the live transaction log file.
 RogLogCompactor compact(long forceCheckpointCompletionOn)
          Perform the log compaction
 long getMaxCompactionWindowSize()
          Gets the compaction window size.
 RogLogCompactor.State getState()
          Get the current compaction state
 boolean isCompactionInProgress()
          Get is compaction is in progress
 void setMaxCompactionWindowSize(long size)
          May be used to change the compaction windows size.
 void stop()
          Stop any running compaction
 void waitForCompactionToComplete()
          Wait for compaction to complete
 
Methods inherited from class com.neeve.root.RootObject
getChecked, getThreaded, getTracer, setChecked, setTracer
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

setMaxCompactionWindowSize

public final void setMaxCompactionWindowSize(long size)
May be used to change the compaction windows size.

Parameters:
size - The size (in megabytes to set for the compaction window.
Throws:
IllegalStateException - if isCompactionInProgress() is true.
IllegalArgumentException - if the compaction window size is invalid (<=0).

getMaxCompactionWindowSize

public final long getMaxCompactionWindowSize()
Gets the compaction window size.

Returns:
The current compaction window size in megabytes.

getState

public final RogLogCompactor.State getState()
Get the current compaction state


compact

public final RogLogCompactor compact(long forceCheckpointCompletionOn)
Perform the log compaction

Parameters:
forceCheckpointCompletionOn - Specifies a checkpoint version that forces the completion of a checkpoint in the compacted log. This value is used in conjunction with the compaction window to determine when to complete a checkpoint in the compacted log. A value of <=0 in this parameter will cause only the compaction window to be used. A value of > 0 will cause the compaction window to be used but will force the checkpoint to be completed immediately after processing the checkpoint version specified in this parameter.

This method kicks off the background compaction of the live transaction log file. The caller can track the status of the compaction by polling the state via the getState() method.


compact

public final RogLogCompactor compact()
Perform the log compaction

This method kicks off the background compaction of the live transaction log file. The caller can track the status of the compaction by polling the state via the getState() method.


isCompactionInProgress

public final boolean isCompactionInProgress()
Get is compaction is in progress


waitForCompactionToComplete

public final void waitForCompactionToComplete()
                                       throws Exception
Wait for compaction to complete

Throws:
Exception

stop

public final void stop()
Stop any running compaction



Copyright © 2016 Neeve Research, LLC. All Rights Reserved.