JThreadKitTM
v1.1.0
(public members only)

com.jthreadkit
Interface AccessibleLock

All Known Subinterfaces:
BasicFIFO, ObjectFIFO, ResourcePool, SizeMonitored, SizeMonitoredCollection, SizeMonitoredList, SizeMonitoredMap, SizeMonitoredSet, SizeMonitoredSortedMap, SizeMonitoredSortedSet
All Known Implementing Classes:
SyncBoolean, ConfigChangeListenerTool, SyncInteger, ListenerTool

public interface AccessibleLock

This interface is implemented by classes that want to allow access the the object used for synchronization.


Method Summary
 Object getLockObject()
          Returns the reference to the object that is synchronized on by other methods in the implementing class.
 

Method Detail

getLockObject

public Object getLockObject()
Returns the reference to the object that is synchronized on by other methods in the implementing class. This reference is not permitted to change after construction, so this method can be called once and the reference saved.

This reference can be used in synchronized blocks to keep other threads from sneaking in between methods calls like this:
  
obj = //...
synchronized ( obj.getLockObject() ) {
    obj.methodA(); 
    obj.methodB(); 
}

Returns:
the object used to lock on to control concurrent access.

JThreadKitTM
v1.1.0
(public members only)

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