JThreadKitTM
v1.1.0
(public members only)

com.jthreadkit
Interface SizeChangeListener


public interface SizeChangeListener

Used to signal changes in the size stored in an instance of a class that has implemented the SizeMonitored interface. See addSizeChangeListener.

Here's a typical use:
  
SizeMonitored sizeMon = //...
sizeMon.addSizeChangeListener(new SizeChangeListener() {
        public void sizeChanged(SizeMonitored sizeMon, int newSize) {
            // Size changed, do something quickly...
            // ...sizeMon can be explicitly cast if needed...
            // ...
        }
    });


Method Summary
 void sizeChanged(SizeMonitored sizeMon, int newSize)
          This method is called every time the size stored inside an instance of SizeMonitored changes.
 

Method Detail

sizeChanged

public void sizeChanged(SizeMonitored sizeMon,
                        int newSize)
This method is called every time the size stored inside an instance of SizeMonitored changes. This method is called by the thread that just changed the value--while calling this method, this thread continues to hold the exclusive lock on the object returned by AccessibleLock.getLockObject(). In light of this, implementations of this method should do their work quickly (and without making method calls that potentially block!). In addition, if the size is altered again as a result of something done during this method call, re-notification will not occur.
Parameters:
sizeMon - the particular SizeMonitored that was just changed (a single listener can monitor multiple instances of SizeMonitored).
newSize - the new size as a result of that change (no need to query the instance).

JThreadKitTM
v1.1.0
(public members only)

© Copyright 2000-2001 Programix Incorporated. All rights reserved. JThreadKit home