public final class InternalLockNamespace extends Object implements ObjectNamespace
ObjectNamespace intended to be used by ILock proxies.
It intentionally does not use name field in equals()
and hashcode() methods. This is a hack to share a single instance of
LockStore for all ILocks proxies (per partition).
Discussion:
If we included the name in equals()/hashcode() methods then each ILock would create
its own LockStoreImpl. Each LockStoreImpl contains additional
mapping key -> LockResource. However ILock proxies always use a single key only
thus creating a LockStoreImpl for each ILock would introduce an unnecessary
indirection and memory waster. Also each LockStoreImpl is maintaining its own
scheduler for lock eviction purposes, etc.
I originally wanted to remove the name field and use a constant,
but it has side-effects - for example when a ILock proxy is destroyed then you
want to destroy all pending BlockingOperation| Constructor and Description |
|---|
InternalLockNamespace() |
InternalLockNamespace(String name) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object o) |
String |
getObjectName()
Gets the object name within the service.
|
String |
getServiceName()
Gets the service name.
|
int |
hashCode() |
void |
readData(ObjectDataInput in)
Reads fields from the input stream
|
String |
toString() |
void |
writeData(ObjectDataOutput out)
Writes object fields to output stream
|
public InternalLockNamespace()
public InternalLockNamespace(String name)
public String getServiceName()
ObjectNamespacegetServiceName in interface ObjectNamespacepublic String getObjectName()
ObjectNamespacegetObjectName in interface ObjectNamespacepublic void writeData(ObjectDataOutput out) throws IOException
DataSerializablewriteData in interface DataSerializableout - outputIOExceptionpublic void readData(ObjectDataInput in) throws IOException
DataSerializablereadData in interface DataSerializablein - inputIOExceptionCopyright © 2017 Hazelcast, Inc.. All Rights Reserved.