sk.uniba.euromath.gene.controller
Class ExporterThread

java.lang.Object
  extended by java.lang.Thread
      extended by sk.uniba.euromath.gene.controller.ExporterThread
All Implemented Interfaces:
Runnable

final class ExporterThread
extends Thread

Thread that executes given exporter at background. Daemon thread by default. When export finishes succesfully both source and result are closed.

For simple principles of working with cause please look at ExceptionRegistry.

If receiver runs in main thread and cannot terminate, it should first consult registry for a cause. If registry is not empty then receiver should report the cause, otherwise it should simply rethrow the exception. To terminate all running threads, they should be in same thread group. Then you may simply use the ThreadGroup.interrupt() method.

Author:
Martin Vysny

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
ExporterThread(ThreadGroup group, IExporter exporter, Source source, StreamResult result, ExportContext context, sk.uniba.euromath.tools.ExceptionRegistry registry, ICoordinator coordinator, NamespacePath path)
          Constructs new thread instance.
 
Method Summary
 void run()
           
 
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
 

Constructor Detail

ExporterThread

ExporterThread(ThreadGroup group,
               IExporter exporter,
               Source source,
               StreamResult result,
               ExportContext context,
               sk.uniba.euromath.tools.ExceptionRegistry registry,
               ICoordinator coordinator,
               NamespacePath path)
Constructs new thread instance. The start() method must be called to execute the export.

Parameters:
group - link the thread with this group.
exporter - configured exporter instance to execute.
source - source.
result - result.
context - export context.
registry - exceptions are recorded here.
coordinator - final coordinator.
path - current namespace path.
Method Detail

run

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


Copyright 2003-2003-2006 null. All Rights Reserved.