org.apache.hadoop.fs
Class DU

java.lang.Object
  extended by org.apache.hadoop.util.Shell
      extended by org.apache.hadoop.fs.DU

public class DU
extends Shell

Filesystem disk space usage statistics. Uses the unix 'du' program


Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.hadoop.util.Shell
Shell.ExitCodeException, Shell.ShellCommandExecutor
 
Field Summary
 
Fields inherited from class org.apache.hadoop.util.Shell
LOG, SET_GROUP_COMMAND, SET_OWNER_COMMAND, SET_PERMISSION_COMMAND, timeOutInterval, ULIMIT_COMMAND, USER_NAME_COMMAND, WINDOWS
 
Constructor Summary
DU(File path, Configuration conf)
          Keeps track of disk usage.
DU(File path, long interval)
          Keeps track of disk usage.
 
Method Summary
 void decDfsUsed(long value)
          Decrease how much disk space we use.
 String getDirPath()
           
protected  String[] getExecString()
          return an array containing the command name & its parameters
 long getUsed()
           
 void incDfsUsed(long value)
          Increase how much disk space we use.
static void main(String[] args)
           
protected  void parseExecResult(BufferedReader lines)
          Parse the execution result
 void shutdown()
          Shut down the refreshing thread.
 void start()
          Start the disk usage checking thread.
 String toString()
           
 
Methods inherited from class org.apache.hadoop.util.Shell
execCommand, execCommand, execCommand, getExitCode, getGET_PERMISSION_COMMAND, getGroupsCommand, getGroupsForUserCommand, getProcess, getUlimitMemoryCommand, getUlimitMemoryCommand, getUsersForNetgroupCommand, isTimedOut, run, setEnvironment, setWorkingDirectory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DU

public DU(File path,
          long interval)
   throws IOException
Keeps track of disk usage.

Parameters:
path - the path to check disk usage in
interval - refresh the disk usage at this interval
Throws:
IOException - if we fail to refresh the disk usage

DU

public DU(File path,
          Configuration conf)
   throws IOException
Keeps track of disk usage.

Parameters:
path - the path to check disk usage in
conf - configuration object
Throws:
IOException - if we fail to refresh the disk usage
Method Detail

decDfsUsed

public void decDfsUsed(long value)
Decrease how much disk space we use.

Parameters:
value - decrease by this value

incDfsUsed

public void incDfsUsed(long value)
Increase how much disk space we use.

Parameters:
value - increase by this value

getUsed

public long getUsed()
             throws IOException
Returns:
disk space used
Throws:
IOException - if the shell command fails

getDirPath

public String getDirPath()
Returns:
the path of which we're keeping track of disk usage

start

public void start()
Start the disk usage checking thread.


shutdown

public void shutdown()
Shut down the refreshing thread.


toString

public String toString()
Overrides:
toString in class Object

getExecString

protected String[] getExecString()
Description copied from class: Shell
return an array containing the command name & its parameters

Specified by:
getExecString in class Shell

parseExecResult

protected void parseExecResult(BufferedReader lines)
                        throws IOException
Description copied from class: Shell
Parse the execution result

Specified by:
parseExecResult in class Shell
Throws:
IOException

main

public static void main(String[] args)
                 throws Exception
Throws:
Exception


Copyright © 2009 The Apache Software Foundation