networking.base
Class ForkedThread

java.lang.Object
  extended by java.lang.Thread
      extended by networking.base.ForkedThread
All Implemented Interfaces:
java.lang.Runnable
Direct Known Subclasses:
SocketThread

abstract class ForkedThread
extends java.lang.Thread

ForkedThread - this class represents a thread which can be forked


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
protected static int CHILD
          Fork status CHILD - a thread was forked as child
protected  int m_fork
          Fork status
protected static int NONE
          Fork status NONE neither parent nor child
protected static int PARENT
          Fork status PARENT - a thread has forked other thread and become parent
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
ForkedThread()
          Construct new ForkedThread object
 
Method Summary
protected  void deinit()
          Deallocate resources
protected abstract  void error(java.lang.Exception e)
          Report error
protected  void init()
          Allocate any required resources
 void run()
           
protected  void run1()
          Convenience routine
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NONE

protected static final int NONE
Fork status NONE neither parent nor child

See Also:
Constant Field Values

CHILD

protected static final int CHILD
Fork status CHILD - a thread was forked as child

See Also:
Constant Field Values

PARENT

protected static final int PARENT
Fork status PARENT - a thread has forked other thread and become parent

See Also:
Constant Field Values

m_fork

protected int m_fork
Fork status

Constructor Detail

ForkedThread

public ForkedThread()
Construct new ForkedThread object

Parameters:
forkStatus - initial fork status
Method Detail

run1

protected void run1()
             throws java.lang.Exception
Convenience routine

Throws:
java.lang.Exception

init

protected void init()
             throws java.lang.Exception
Allocate any required resources

Throws:
java.lang.Exception

deinit

protected void deinit()
               throws java.lang.Exception
Deallocate resources

Throws:
java.lang.Exception

run

public void run()
Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

error

protected abstract void error(java.lang.Exception e)
Report error

Parameters:
e - exception


Copyright © 2009 Alexey Veremenko. All rights reserved.