Overview | Package | Class | Tree | Deprecated | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.cocoon.framework
Class Monitor

    java.lang.Object
      |
      +--java.util.Dictionary
            |
            +--java.util.Hashtable
                  |
                  +--org.apache.cocoon.framework.Monitor

All Implemented Interfaces:
  java.lang.Cloneable, java.util.Map, java.io.Serializable

public class Monitor
extends java.util.Hashtable

This class watches over the changes of indicated resources.

Version:
  $Revision: 1.8 $ $Date: 2000/04/14 17:12:57 $
Author:
  Stefano Mazzocchi
See Also:
  Serialized Form

Inner classes inherited from class java.util.Map
`java.util.Map.Entry`

Constructor Summary
`Monitor(int capacity)` Create this class with the given starting capacity.

Method Summary
`boolean` | `hasChanged(java.lang.Object context)` Queries the monitor for changes.
`void` | `invalidate(java.lang.Object context)` Invalidates the given context.
`static long` | `timestamp(java.lang.Object resource)` Create a timestamp indicating the last modified time of the given resource.
`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.util.Hashtable
`clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, put, putAll, rehash, remove, size, toString, values`

Methods inherited from class java.lang.Object
`finalize, getClass, notify, notifyAll, wait, wait, wait`

Constructor Detail

### Monitor

    public Monitor(int capacity)

  Create this class with the given starting capacity.

Method Detail

### 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.

### timestamp

    public static long timestamp(java.lang.Object resource)

  Create a timestamp indicating the last modified time of the given resource.

Overview | Package | Class | Tree | Deprecated | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 1999-2001 Apache Software Foundation. All Rights Reserved.