com.mucommander.ui.main.tree
Class AbstractIOThreadManager

java.lang.Object
  extended by java.lang.Thread
      extended by com.mucommander.ui.main.tree.AbstractIOThreadManager
All Implemented Interfaces:
java.lang.Runnable
Direct Known Subclasses:
TreeIOThreadManager

public class AbstractIOThreadManager
extends java.lang.Thread

A class that monitors IOThread if it is running or has been blocked. This class maintains a list of tasks to execute and a thread that executes these tasks. It checks periodically if the IOThread is running. If IOThread has been blocked then it's killed and a new IOThread is instantiated. Then the next task from the list will be executed.

Author:
Mariusz Jakubowski

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
protected  long blockThreshold
          a time after i/o thread is marked as blocked
protected  IOThread ioThread
          a thread that executes tasks
protected  java.util.List queue
          a queue with tasks to execute
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
AbstractIOThreadManager(java.lang.String name, long blockThreshold)
          Creates a new monitoring thread.
 
Method Summary
 void addTask(java.lang.Runnable task)
          Adds new task to execute.
 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
 

Field Detail

queue

protected final java.util.List queue
a queue with tasks to execute


ioThread

protected IOThread ioThread
a thread that executes tasks


blockThreshold

protected long blockThreshold
a time after i/o thread is marked as blocked

Constructor Detail

AbstractIOThreadManager

public AbstractIOThreadManager(java.lang.String name,
                               long blockThreshold)
Creates a new monitoring thread.

Parameters:
name - a name of this thread
blockThreshold - a time after an i/o task is marked as blocked [ms]
Method Detail

addTask

public void addTask(java.lang.Runnable task)
Adds new task to execute. A task is an instance of Runnable interface. A proper exception handling within the Runnable instance have to be implemented. If this task rises an exception, this exception is printed to stderr.

Parameters:
task - a task to be executed

run

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


This file is part of muCommander - Copyright (C) 2002-2008 Maxence Bernard