ostore.util
Class Carp

java.lang.Object
  |
  +--ostore.util.Carp

public abstract class Carp
extends Object

A convenience class for dying and generating error messages, complete with "carp" and "croak", borrowed from PERL.

Now extended to control a graceful shutdown. Calls to dieGracefully cause this class to detach a node from the network. UNIX signals (TERM, INT, HUP) detach all virtual nodes.

Version:
$Id: Carp.java,v 1.17 2004/05/13 20:17:55 hweather Exp $
Author:
Dennis Geels

Constructor Summary
Carp()
           
 
Method Summary
static void carp(String msg)
          Print a message to standard error.
static void carp(Throwable e)
          Print an exception's message to standard error.
static void croak()
          Kill the whole jvm or throw a RuntimeException.
static void croak(String msg)
          Print a message to standard error and croak.
static void croak(Throwable e)
          Print an exception's message to standard error and croak.
static void die()
          Carp the current stack trace, then croak.
static void die(String msg)
          Carp a message and current stack trace, then croak.
static void die(Throwable e)
          Carp an exception's message and stack trace, then croak.
static void dieGracefully(Throwable e, NodeId node_id)
          Dispatches an event to the DD stages of the specified virtual node telling them to disconnect the node from the overlay network.
static void dumpStack()
          Print out the stack trace of the current thread.
static void error(String msg)
          Print a message and current stack trace to standard error.
static void error(Throwable e)
          Print an exception's message and stack trace to standard error.
static boolean getThrowException()
          Returns the flag that controls whether croak and die should throw a RuntimeException (true) or call System.exit (false).
static void out(String msg)
          Print a message to standard out.
static void setThrowException(boolean throwException)
          Sets the flag that controls whether croak and die should throw a RuntimeException (true) or call System.exit (false).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Carp

public Carp()
Method Detail

setThrowException

public static void setThrowException(boolean throwException)
Sets the flag that controls whether croak and die should throw a RuntimeException (true) or call System.exit (false).


getThrowException

public static boolean getThrowException()
Returns the flag that controls whether croak and die should throw a RuntimeException (true) or call System.exit (false).


dieGracefully

public static void dieGracefully(Throwable e,
                                 NodeId node_id)
Dispatches an event to the DD stages of the specified virtual node telling them to disconnect the node from the overlay network.

If the _throwException flag is false, this method just calls croak.


out

public static void out(String msg)
Print a message to standard out.


carp

public static void carp(String msg)
Print a message to standard error.


carp

public static void carp(Throwable e)
Print an exception's message to standard error.


error

public static void error(String msg)
Print a message and current stack trace to standard error.


error

public static void error(Throwable e)
Print an exception's message and stack trace to standard error.


croak

public static void croak()
Kill the whole jvm or throw a RuntimeException.


croak

public static void croak(String msg)
Print a message to standard error and croak.


croak

public static void croak(Throwable e)
Print an exception's message to standard error and croak.


die

public static void die()
Carp the current stack trace, then croak.


die

public static void die(String msg)
Carp a message and current stack trace, then croak.


die

public static void die(Throwable e)
Carp an exception's message and stack trace, then croak.


dumpStack

public static void dumpStack()
Print out the stack trace of the current thread. The stack trace will include the call to Carp.dumpStack.