org.mortbay.jetty.plugin.util
Class Scanner

java.lang.Object
  extended by java.lang.Thread
      extended by org.mortbay.jetty.plugin.util.Scanner
All Implemented Interfaces:
Runnable

public class Scanner
extends Thread

Scanner Scans a list of files and directories on a periodic basis to detect changes. If a change in any of the watched files is found, then the target LifeCycle objects are stopped and restarted. This is used by the Jetty Maven plugin to watch the classes, dependencies and web.xml file of a web application and to restart the webapp if any of the above changes.

Author:
janb

Nested Class Summary
static interface Scanner.Listener
           
 
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
Scanner()
           
 
Method Summary
 List getListeners()
          List of Scanner.Listener implementations.
 List getRoots()
          The files and directory roots to watch.
 int getScanInterval()
           
 void run()
          Loop every scanInterval seconds until interrupted, checking to see if any of the watched files have changed.
 void setListeners(List listeners)
           
 void setRoots(List roots)
           
 void setScanInterval(int scanInterval)
           
 
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

Scanner

public Scanner()
Method Detail

getRoots

public List getRoots()
The files and directory roots to watch. Directories will be recursively scanned.

Returns:
Returns the roots.

setRoots

public void setRoots(List roots)
Parameters:
roots - The roots to set.

getScanInterval

public int getScanInterval()
Returns:
Returns the scanInterval.

setScanInterval

public void setScanInterval(int scanInterval)
Parameters:
scanInterval - The scanInterval in seconds to set.

getListeners

public List getListeners()
List of Scanner.Listener implementations.

Returns:
Returns the listeners.

setListeners

public void setListeners(List listeners)
Parameters:
listeners - The listeners to set.

run

public void run()
Loop every scanInterval seconds until interrupted, checking to see if any of the watched files have changed. If they have, stop and restart the LifeCycle targets.

Specified by:
run in interface Runnable
Overrides:
run in class Thread
See Also:
Runnable.run()


Copyright © 2007 Mort Bay Consulting. All Rights Reserved.