mqwfes
Class StartDirectoryCheck

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--mqwfes.StartDirectoryCheck
All Implemented Interfaces:
java.lang.Runnable

public class StartDirectoryCheck
extends java.lang.Thread

Starts the DirectoryCheck-class in 6 threads.

Author:
Eike Klattenhoff

Field Summary
static java.util.Vector comparelist
          Comparelist.
static java.util.Vector duplicatedirectories
          List of directories monitored by at least 2 activities.
static java.util.Vector harmlesserrors
          List of workitems with harmless errors (wrong value in parameter p).
 boolean nowchecking
          True, if function getWorklistAndDistribute is running.
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
StartDirectoryCheck()
          Constructor.
StartDirectoryCheck(WorkList startlist)
          Constructor.
 
Method Summary
 void CheckChangedVariables()
          Setting systemvariables in threads new.
 int CountItemsOnThreads(int threadnumber)
          Counts and returns the number of items on the thread-worklists.
 boolean Distribute(int threadnumber, java.lang.String[] delivery)
          Sorts and distributes the activities to the different lists of the threads.
 void getWorklistAndDistribute()
          Starts the needed functions.
 void PossibleProblems()
          Checks if a directory is monitored by more than one activity.
 void run()
          Executes the other functions.
 void StartThreadNumber(int threadnumber)
          Starts work of given thread.
 void StartThreads()
          Starts threads 1-6
 void StopThreads()
          Stops threads 1-6
 void UpdateThreadlists()
          Deletes workitems from the different lists of the threads if not existing anymore on the server-worklist.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

comparelist

public static java.util.Vector comparelist
Comparelist.


duplicatedirectories

public static java.util.Vector duplicatedirectories
List of directories monitored by at least 2 activities.


harmlesserrors

public static java.util.Vector harmlesserrors
List of workitems with harmless errors (wrong value in parameter p).


nowchecking

public boolean nowchecking
True, if function getWorklistAndDistribute is running.

Constructor Detail

StartDirectoryCheck

public StartDirectoryCheck(WorkList startlist)
Constructor. Used by server-class (second call).

Parameters:
startlist - Worklist from Server

StartDirectoryCheck

public StartDirectoryCheck()
Constructor. Used by server-class (first call).

Method Detail

CheckChangedVariables

public void CheckChangedVariables()
Setting systemvariables in threads new. e.g. priorities and makedirectories-flag.


Distribute

public boolean Distribute(int threadnumber,
                          java.lang.String[] delivery)
Sorts and distributes the activities to the different lists of the threads. If the entry already exists on the worklist of the thread it will be ignored.

Parameters:
threadnumber - Number of the thread.
delivery - Array with POID [0] and all parameters.
Returns:
TRUE if item has been successfully added to list of one thread.
FALSE if item already exists on threadlist.

UpdateThreadlists

public void UpdateThreadlists()
Deletes workitems from the different lists of the threads if not existing anymore on the server-worklist.


StartThreads

public void StartThreads()
Starts threads 1-6


StopThreads

public void StopThreads()
Stops threads 1-6


getWorklistAndDistribute

public void getWorklistAndDistribute()
Starts the needed functions.    - Clears Comparelist.
   - Checks if system variables have been changed.
   - Gets a new worklist.
   - Distributes the workitems to the different threads.
   - Updates the locale thread-worklists.
   - Starts all threads with new items.
   - Checks if more than one activity monitors the same directory.


StartThreadNumber

public void StartThreadNumber(int threadnumber)
Starts work of given thread.

Parameters:
threadnumber - 1-6 for thread 1-6 or 0 for all.

CountItemsOnThreads

public int CountItemsOnThreads(int threadnumber)
Counts and returns the number of items on the thread-worklists.

Parameters:
threadnumber - Number of thread 1-6 or any other number for all.
Returns:
Number of items on thread-worklist.

PossibleProblems

public void PossibleProblems()
Checks if a directory is monitored by more than one activity.


run

public void run()
Executes the other functions.
   - Starts threads.
   - Gets and checks the workliste from the server.
   - Sorts and distribute the "orders" to the different lists of the 6 threads.
   - Creating one big "local worklist".
   - Checking the worklists of the threads and deleting all old entries.
   - Getting a newer version of the workliste from the server.

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread