org.apache.cassandra.io.util
Class DiskAwareRunnable

java.lang.Object
  extended by org.apache.cassandra.utils.WrappedRunnable
      extended by org.apache.cassandra.io.util.DiskAwareRunnable
All Implemented Interfaces:
java.lang.Runnable
Direct Known Subclasses:
AbstractCompactionTask

public abstract class DiskAwareRunnable
extends WrappedRunnable


Constructor Summary
DiskAwareRunnable()
           
 
Method Summary
protected abstract  Directories getDirectories()
          Get sstable directories for the CF.
abstract  long getExpectedWriteSize()
          Get expected write size to determine which disk to use for this task.
 boolean reduceScopeForLimitedSpace()
          Called if no disk is available with free space for the full write size.
protected  void runMayThrow()
          Run this task after selecting the optimal disk for it
protected abstract  void runWith(java.io.File sstableDirectory)
          Executes this task on given sstableDirectory.
 
Methods inherited from class org.apache.cassandra.utils.WrappedRunnable
run
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DiskAwareRunnable

public DiskAwareRunnable()
Method Detail

runMayThrow

protected void runMayThrow()
                    throws java.lang.Exception
Run this task after selecting the optimal disk for it

Specified by:
runMayThrow in class WrappedRunnable
Throws:
java.lang.Exception

getDirectories

protected abstract Directories getDirectories()
Get sstable directories for the CF.

Returns:
Directories instance for the CF.

runWith

protected abstract void runWith(java.io.File sstableDirectory)
                         throws java.lang.Exception
Executes this task on given sstableDirectory.

Parameters:
sstableDirectory - sstable directory to work on
Throws:
java.lang.Exception

getExpectedWriteSize

public abstract long getExpectedWriteSize()
Get expected write size to determine which disk to use for this task.

Returns:
expected size in bytes this task will write to disk.

reduceScopeForLimitedSpace

public boolean reduceScopeForLimitedSpace()
Called if no disk is available with free space for the full write size.

Returns:
true if the scope of the task was successfully reduced.


Copyright © 2013 The Apache Software Foundation