org.hd.d.pg2k.webSvr.exhibit
Class DataSourceBean.EDVHObservable

java.lang.Object
  extended by java.util.Observable
      extended by org.hd.d.pg2k.webSvr.exhibit.DataSourceBean.EDVHObservable
Enclosing class:
DataSourceBean

private static final class DataSourceBean.EDVHObservable
extends java.util.Observable

An Observable that changes when its "currentEDVH" value changes. This currentEDVH is the hash over the exhibit data.

When we call notifyObserversInNewThread() we do so where possible with a single Integer argument carrying the current hash value. An Observer may ignore a call when the value matches its current hash in case it has already rebuilt its cache.

Note that we build this on top of the default Observable implementation which holds no locks while delivering notifications, which should help us avoid deadlocks.


Field Summary
private  int currentEVDH
          The current hash of the exhibits: when this changes then the whole Observable hasChanged().
private  java.lang.Thread deliveryThread
          Thread, if any, being used to deliver notifications.
 
Constructor Summary
private DataSourceBean.EDVHObservable()
           
 
Method Summary
(package private)  void notifyObserversInNewThread(java.lang.Object arg)
          Spins off background thread to call super.notifyObserversInNewThread().
(package private)  void setCurrentEDVH(int currentEVDH)
          Set the currentEVDH; when changed hasChanged() returns true.
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

currentEVDH

private int currentEVDH
The current hash of the exhibits: when this changes then the whole Observable hasChanged().


deliveryThread

private java.lang.Thread deliveryThread
Thread, if any, being used to deliver notifications. Private to notifyObserversInNewThread() and accessed under the instance lock.

Constructor Detail

DataSourceBean.EDVHObservable

private DataSourceBean.EDVHObservable()
Method Detail

setCurrentEDVH

final void setCurrentEDVH(int currentEVDH)
Set the currentEVDH; when changed hasChanged() returns true.


notifyObserversInNewThread

final void notifyObserversInNewThread(java.lang.Object arg)
Spins off background thread to call super.notifyObserversInNewThread(). Will not attempt to start a new thread to do this if the last one appears not to have died, so will in that case just not send any notifications.

No lock is held while notifications are delivered; the instance lock may be briefly held while the thread field is being examined and a thread launched.

Parameters:
arg - any object

DHD Multimedia Gallery V1.53.0

Copyright (c) 1996-2009, Damon Hart-Davis. All rights reserved.