Top Description Fields Constructors Methods
org.apache.derby.iapi.services.monitor

public Class DerbyObservable

extends Object
Class Inheritance
Known Direct Subclasses
org.apache.derby.iapi.store.raw.xact.RawTransaction, org.apache.derby.impl.store.raw.data.BaseContainerHandle
Imports
java.util.ArrayList

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 Summary

Modifier and TypeField and Description
private boolean
private ArrayList<DerbyObserver>

Constructor Summary

AccessConstructor and Description
public
DerbyObservable()

No-arg constructor

Method Summary

Modifier and TypeMethod and Description
public synchronized void
addObserver(DerbyObserver
The object which wants to be notified when this object changes
observer
)

Add another observer who wants to be told about changes to this object.

public synchronized int

Returns:

The number of watchers
countObservers
()

Return the number of observers who are watching this object.

public synchronized void
deleteObserver(DerbyObserver
The observer to remove.
observer
)

Remove a specific observer from the list of watchers.

public void
notifyObservers()

This method is equivalent to notifyObservers(null);

public void
notifyObservers(Object
Extra information to be passed to the observer's callback method.
extraInfo
)

If this object has changed, then notify all observers.

protected synchronized void
setChanged()

When the object state changes, the object calls this method in order to flag that fact.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_hasChangedback to summary
private boolean _hasChanged
_observersback to summary
private ArrayList<DerbyObserver> _observers

Constructor Detail

DerbyObservableback to summary
public DerbyObservable()

No-arg constructor

Method Detail

addObserverback to summary
public synchronized void addObserver(DerbyObserver observer)

Add another observer who wants to be told about changes to this object.

Parameters
observer:DerbyObserver

The object which wants to be notified when this object changes

Exceptions
IllegalArgumentException:
If the argument is bad (e.g., null)
countObserversback to summary
public synchronized int countObservers()

Return the number of observers who are watching this object.

Returns:int

The number of watchers

deleteObserverback to summary
public synchronized void deleteObserver(DerbyObserver observer)

Remove a specific observer from the list of watchers. Null is ignored.

Parameters
observer:DerbyObserver

The observer to remove.

notifyObserversback to summary
public void notifyObservers()

This method is equivalent to notifyObservers(null);

notifyObserversback to summary
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:Object

Extra information to be passed to the observer's callback method.

setChangedback to summary
protected synchronized 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.