org.apache.cocoon.framework
Class Monitor
java.lang.Object
|
+--org.apache.cocoon.framework.Monitor
- public class Monitor
- extends java.lang.Object
This class watches over the changes of indicated resources.
- Version:
- $Revision: 1.5 $ $Date: 2000/02/23 00:49:58 $
- Author:
- Stefano Mazzocchi
Constructor Summary |
Monitor(int capacity)
|
Method Summary |
boolean |
hasChanged(java.lang.Object context)
Queries the monitor for changes. |
void |
invalidate(java.lang.Object context)
Invalidates the given context. |
void |
watch(java.lang.Object key,
java.lang.Object resource)
Tells the monitor to watch the given resource, timestamps it
and associate it to the given key. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Monitor
public Monitor(int capacity)
watch
public void watch(java.lang.Object key,
java.lang.Object resource)
- Tells the monitor to watch the given resource, timestamps it
and associate it to the given key.
hasChanged
public boolean hasChanged(java.lang.Object context)
- Queries the monitor for changes. For maximum reliability, this
method is synchronous, but less reliable for faster asynchronous
versions could be implemented. Returns true if the resource
associated to the given key has changed since the last call
to watch.
WARNING: due to a stupid bug in "FileURLConnection", the
class that implements the "file:" protocol for the java.net.URL
framework, the getLastModified() method always returns 0.
For this reason, the use of the File resource is strongly
suggested over the "file:" type URL.
NOTE: this may not be (and should not be) the case in other
virtual machine implementations or if we rewrite the URL
handler ourselves (which I don't care to do at this point).
invalidate
public void invalidate(java.lang.Object context)
- Invalidates the given context.
Copyright © 1999-2000 Apache Software Foundation. All Rights Reserved.