org.ccnx.ccn.impl.support.Daemon Class Reference

Implements command line daemon functionality. More...

Inheritance diagram for org.ccnx.ccn.impl.support.Daemon:

org.ccnx.ccn.impl.repo.RepositoryDaemon org.ccnx.ccn.impl.support.CCNDaemon

List of all members.

Public Member Functions

String daemonName ()
void setPid (String pid)
String getPid ()
void setInteractive ()
Object getStatus (String daemonName, String type) throws FileNotFoundException, IOException, ClassNotFoundException

Static Public Member Functions

static void main (String[] args)
 Main entry point for command line invocation.

Static Public Attributes

static final String PROP_JAVA_LIBRARY_PATH = "java.library.path"
static final String PROP_DAEMON_MEMORY = "ccn.daemon.memory"
static final String PROP_DAEMON_DEBUG_PORT = "ccn.daemon.debug"
static final String PROP_DAEMON_OUTPUT = "ccn.daemon.output"
static final String PROP_DAEMON_PROFILE = "ccn.daemon.profile"
static final String PROP_DAEMON_DEBUG_SUSPEND = "ccn.daemon.debug.suspend"
static final String PROP_DAEMON_DEBUG_NOSHARE = "ccn.daemon.debug.noshare"
static final String PROP_DAEMON_CHECK_JNI = "ccn.daemon.check.jni"
static final String DEFAULT_OUTPUT_STREAM = "/dev/null"

Protected Types

enum  Mode {
  MODE_UNKNOWN, MODE_START, MODE_STOP, MODE_INTERACTIVE,
  MODE_DAEMON, MODE_SIGNAL
}

Protected Member Functions

void usage ()
 Overridden by subclasses.
void initialize (String[] args, Daemon daemon)
 Overridden by subclasses.
WorkerThread createWorkerThread ()
 overridden by subclasses to make right type of thread.
void rmRMIFile (String pid) throws IOException
 Remove the RMIFile when you don't know the PID.

Static Protected Member Functions

static void setupRemoteAccess (Daemon daemon, WorkerThread wt) throws IOException
static void stopDaemon (Daemon daemon, String pid) throws FileNotFoundException, IOException, ClassNotFoundException
static void cleanupDaemon (String daemonName, String pid) throws IOException
static void signalDaemon (String daemonName, String sigName, String pid) throws FileNotFoundException, IOException, ClassNotFoundException
static File getRMIFile (String daemonName, String pid)
static void renameRMIFile (String daemonName, String pid)
 Rename RMI file to add PID if available, otherwise do nothing.
static File getRMITempFile (String daemonName) throws IOException
static void runDaemon (Daemon daemon, String args[]) throws IOException

Protected Attributes

String _daemonName = null
boolean _interactive = false
String _pid

Static Protected Attributes

static Daemon _daemon
static DaemonListenerClass _daemonListener = null

Classes

interface  DaemonListener
 Interface describing the RMI server object sitting inside the daemon. More...
class  DaemonListenerClass
class  ShutdownHook
 Stop ccnd on exit from daemon. More...
class  StopTimer
class  WorkerThread
 The thread that runs inside the daemon, doing work. More...


Detailed Description

Implements command line daemon functionality.

In the normal case a daemon is started up and then runs in the background after the starting process exits. An RMI file is created to allow outside processes to communicate with the daemon to "signal" it or stop it.

Daemons have several modes as seen below:

 MODE_START - used to start a daemon which will be run in the background
 MODE_STOP  - used to stop a daemon currently running in the background
 MODE_INTERACTIVE - used to run a daemon interactively rather than in the background
 MODE_DAEMON - a daemon started up by a "starter" is started in MODE_DAEMON.
 MODE_SIGNAL - used to signal a daemon from outside to get the daemon to perform implementation defined
 			     services
 

Member Function Documentation

WorkerThread org.ccnx.ccn.impl.support.Daemon.createWorkerThread (  )  [protected]

overridden by subclasses to make right type of thread.

Returns:

Reimplemented in org.ccnx.ccn.impl.repo.RepositoryDaemon, and org.ccnx.ccn.impl.support.CCNDaemon.

static void org.ccnx.ccn.impl.support.Daemon.renameRMIFile ( String  daemonName,
String  pid 
) [static, protected]

Rename RMI file to add PID if available, otherwise do nothing.

Parameters:
daemonName the name of this daemon
pid the PID to add to the RMI file name or null if unavailable

void org.ccnx.ccn.impl.support.Daemon.rmRMIFile ( String  pid  )  throws IOException [protected]

Remove the RMIFile when you don't know the PID.

Exceptions:
IOException 

static void org.ccnx.ccn.impl.support.Daemon.main ( String[]  args  )  [static]

Main entry point for command line invocation.

Parameters:
args Arguments passed in from command line.

Reimplemented in org.ccnx.ccn.impl.repo.RepositoryDaemon, and org.ccnx.ccn.impl.support.CCNDaemon.


The documentation for this class was generated from the following file:

Generated on Thu Feb 16 00:45:00 2012 for Content-Centric Networking in Java by  doxygen 1.5.6