org.enhydra.shark.client.utilities
Class LimitChecker

java.lang.Object
  extended by java.lang.Thread
      extended by org.enhydra.shark.client.utilities.LimitChecker
All Implemented Interfaces:
java.lang.Runnable

public class LimitChecker
extends java.lang.Thread

Checks limits on running processes, and aborts ones which riched that limit.

Author:
Sasa Bojanic

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
protected  long delay
           
protected  int failuresToIgnore
           
protected  int instancesPerTransaction
           
protected  boolean isInitialized
           
protected  java.util.List limitStructs
           
protected  boolean stopped
           
protected  java.lang.String username
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
LimitChecker(java.lang.String username, java.util.List limitStructs, long delay, int instPerTrans, int failToIgnore, boolean startImmediatelly)
           
 
Method Summary
protected  void checkLimits(java.util.List instancesToCheck)
           
protected  boolean checkLimitStructs()
           
 long getDelay()
           
 int getFailuresToIgnore()
           
 int getInstancesPerTransaction()
           
 java.util.List getLimitStructs()
           
 java.lang.String getUsername()
           
 void run()
           
protected  void runMe()
           
 void setDelay(long delay)
           
 void setFailuresToIgnore(int failToIgnore)
           
 void setInstancesPerTransaction(int insPerTrans)
           
 void setLimitStructs(java.util.List ls)
           
 void setLimitStructsByString(java.lang.String str)
           
 void setUsername(java.lang.String username)
           
 void startChecker()
           
 void stopChecker()
           
protected  void updateLimitStructs()
           
 
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

username

protected java.lang.String username

delay

protected long delay

instancesPerTransaction

protected int instancesPerTransaction

failuresToIgnore

protected int failuresToIgnore

stopped

protected boolean stopped

limitStructs

protected java.util.List limitStructs

isInitialized

protected boolean isInitialized
Constructor Detail

LimitChecker

public LimitChecker(java.lang.String username,
                    java.util.List limitStructs,
                    long delay,
                    int instPerTrans,
                    int failToIgnore,
                    boolean startImmediatelly)
Method Detail

getUsername

public java.lang.String getUsername()

setUsername

public void setUsername(java.lang.String username)

getDelay

public long getDelay()

setDelay

public void setDelay(long delay)

getLimitStructs

public java.util.List getLimitStructs()

setLimitStructs

public void setLimitStructs(java.util.List ls)

setLimitStructsByString

public void setLimitStructsByString(java.lang.String str)

getInstancesPerTransaction

public int getInstancesPerTransaction()

setInstancesPerTransaction

public void setInstancesPerTransaction(int insPerTrans)

getFailuresToIgnore

public int getFailuresToIgnore()

setFailuresToIgnore

public void setFailuresToIgnore(int failToIgnore)

stopChecker

public void stopChecker()

startChecker

public void startChecker()

run

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

runMe

protected void runMe()

checkLimits

protected void checkLimits(java.util.List instancesToCheck)
                    throws java.lang.Exception
Throws:
java.lang.Exception

checkLimitStructs

protected boolean checkLimitStructs()
                             throws java.lang.Exception
Throws:
java.lang.Exception

updateLimitStructs

protected void updateLimitStructs()