de.bea.domingo.proxy
Class DNotesThread

java.lang.Object
  extended by java.lang.Thread
      extended by de.bea.domingo.proxy.DNotesThread
All Implemented Interfaces:
java.lang.Runnable

public class DNotesThread
extends java.lang.Thread

The NotesThread class extends java.lang.Thread to include special initialization and termination code for Domino.

This extension to Thread is required to run Java programs that make local calls to the Domino classes, but is not allowed for applications that make remote calls. An application that makes both local and remote calls must determine dynamically when to use the static methods sinitThread and stermThread. This includes threads invoked by AWT that access Domino objects.

To execute threads through the Runnable interface, implement Runnable and include a run method as you would for any class using threads.

To execute threads through inheritance, extend NotesThread instead of Thread and include a runNotes method instead of run.

Author:
Kurt Riede

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
DNotesThread()
          Allocates a new DNotesThread object.
DNotesThread(java.lang.Runnable theTarget)
          Allocates a new DNotesThread object.
DNotesThread(java.lang.Runnable theTarget, java.lang.String name)
          Allocates a new DNotesThread object.
DNotesThread(java.lang.String name)
          Allocates a new Thread object.
DNotesThread(java.lang.ThreadGroup group, java.lang.Runnable theTarget)
          Allocates a new DNotesThread object.
DNotesThread(java.lang.ThreadGroup group, java.lang.Runnable theTarget, java.lang.String name)
          Allocates a new DNotesThread object so that it has target as its run object, has the specified name as its name, and belongs to the thread group referred to by group.
DNotesThread(java.lang.ThreadGroup group, java.lang.String name)
          Allocates a new Thread object.
 
Method Summary
protected  void finalize()
           
protected  void initThread()
           
 void run()
           
 void runNotes()
          Runs a Notes process.
 void setMonitor(DNotesMonitor theMonitor)
          Set the monitor.
protected  void termThread()
           
 
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, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DNotesThread

public DNotesThread()
Allocates a new DNotesThread object. This constructor has the same effect as DNotesThread(null, null, name), where name is a newly generated name. Automatically generated names are of the form "Thread-"+n, where n is an integer.

See Also:
DNotesThread(ThreadGroup, Runnable, String)

DNotesThread

public DNotesThread(java.lang.String name)
Allocates a new Thread object. This constructor has the same effect as Thread(null, null, name).

Parameters:
name - the name of the new thread.
See Also:
DNotesThread(ThreadGroup, Runnable, String)

DNotesThread

public DNotesThread(java.lang.Runnable theTarget)
Allocates a new DNotesThread object. This constructor has the same effect as DNotesThread(null, target, name), where name is a newly generated name. Automatically generated names are of the form "Thread-"+n, where n is an integer.

Parameters:
theTarget - the object whose run method is called.
See Also:
DNotesThread(ThreadGroup, Runnable, String)

DNotesThread

public DNotesThread(java.lang.ThreadGroup group,
                    java.lang.Runnable theTarget)
Allocates a new DNotesThread object. This constructor has the same effect as DNotesThread(group, target, name), where name is a newly generated name. Automatically generated names are of the form "Thread-"+n, where n is an integer.

Parameters:
group - the thread group.
theTarget - the object whose run method is called.
See Also:
DNotesThread(ThreadGroup, Runnable, String)

DNotesThread

public DNotesThread(java.lang.Runnable theTarget,
                    java.lang.String name)
Allocates a new DNotesThread object. This constructor has the same effect as DNotesThread(null, target, name).

Parameters:
theTarget - the object whose run method is called.
name - the name of the new thread.
See Also:
DNotesThread(ThreadGroup, Runnable, String)

DNotesThread

public DNotesThread(java.lang.ThreadGroup group,
                    java.lang.String name)
Allocates a new Thread object. This constructor has the same effect as Thread(null, target, name).

Parameters:
group - the thread group.
name - the name of the new thread.
See Also:
DNotesThread(ThreadGroup, Runnable, String)

DNotesThread

public DNotesThread(java.lang.ThreadGroup group,
                    java.lang.Runnable theTarget,
                    java.lang.String name)
Allocates a new DNotesThread object so that it has target as its run object, has the specified name as its name, and belongs to the thread group referred to by group.

If group is null and there is a security manager, the group is determined by the security manager's getThreadGroup method. If group is null and there is not a security manager, or the security manager's getThreadGroup method returns null, the group is set to be the same ThreadGroup as the thread that is creating the new thread.

If there is a security manager, its checkAccess method is called with the ThreadGroup as its argument.

In addition, its checkPermission method is called with the RuntimePermission("enableContextClassLoaderOverride") permission when invoked directly or indirectly by the constructor of a subclass which overrides the getContextClassLoader or setContextClassLoader methods. This may result in a SecurityException.

If the target argument is not null, the run method of the target is called when this thread is started. If the target argument is null, this thread's run method is called when this thread is started.

The priority of the newly created thread is set equal to the priority of the thread creating it, that is, the currently running thread. The method setPriority may be used to change the priority to a new value.

The newly created thread is initially marked as being a daemon thread.

Parameters:
group - the thread group.
theTarget - the object whose run method is called.
name - the name of the new thread.
See Also:
Thread.Thread(java.lang.ThreadGroup, java.lang.Runnable, java.lang.String)
Method Detail

setMonitor

public final void setMonitor(DNotesMonitor theMonitor)
Set the monitor.

Parameters:
theMonitor - the monitor
See Also:
DNotesFactory.setMonitor(de.bea.domingo.DNotesMonitor)

initThread

protected final void initThread()
See Also:
initThread()

termThread

protected final void termThread()
See Also:
termThread()

runNotes

public void runNotes()
              throws DNotesException
Runs a Notes process.

Throws:
DNotesException - if any error occurred in running the thread

run

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

finalize

protected final void finalize()
                       throws java.lang.Throwable
Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable - the Exception raised by this method
See Also:
Object.finalize()


Domingo Java-API