Class DerbyObservable

java.lang.Object
org.apache.derby.iapi.services.monitor.DerbyObservable
Direct Known Subclasses:
BaseContainerHandle, RawTransaction

public class DerbyObservable extends Object

Created to provide the Observable behavior which Derby has depended on since Java 1.2 but which as deprecated in JDK 9 build 118. A DerbyObservable is an object whose state changes are being tracked.

  • Field Details

  • Constructor Details

    • DerbyObservable

      public DerbyObservable()
      No-arg constructor
  • Method Details

    • addObserver

      public void addObserver(DerbyObserver observer)
      Add another observer who wants to be told about changes to this object.
      Parameters:
      observer - The object which wants to be notified when this object changes
      Throws:
      IllegalArgumentException - If the argument is bad (e.g., null)
    • countObservers

      public int countObservers()
      Return the number of observers who are watching this object.
      Returns:
      The number of watchers
    • deleteObserver

      public void deleteObserver(DerbyObserver observer)
      Remove a specific observer from the list of watchers. Null is ignored.
      Parameters:
      observer - The observer to remove.
    • notifyObservers

      public void notifyObservers()
      This method is equivalent to notifyObservers(null);
    • notifyObservers

      public void notifyObservers(Object extraInfo)
      If this object has changed, then notify all observers. Pass them this object and the extraInfo. This object is then marked as unchanged again.
      Parameters:
      extraInfo - Extra information to be passed to the observer's callback method.
    • setChanged

      protected void setChanged()
      When the object state changes, the object calls this method in order to flag that fact. After this method has been called, then the notifyObservers() will wake up the observers which are watching this object.