public class EqualsLock
extends Object
A simple lock based on the value of an object instead of the object's instance.
The synchronizing problem in the server is that sometimes it's required to
synchronize on a key value for a hash table. However, the key being used will
never be the same instance from one thread to another, and synchronizing on the
hash table itself will be too slow. Currently synchronization is done by this
lock which locks based on Object value, not the Object's instance.
Synchronization could have been done using primitive Objects, like Integers,
but I decided not to because this program is designed to be embedded. That
kind of synchronization may interfere with the wrapping program, possibly
causing a deadlock that is impossible to find.
- Author:
- isaiah.v