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
LockStoreContainer.getOrCreateLockStore(ObjectNamespace)
,
OperationParkerImpl.cancelParkedOperations(String, Object, Throwable)
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()
Name of the service
|
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()
ServiceNamespace
getServiceName
in interface ServiceNamespace
public String getObjectName()
ObjectNamespace
getObjectName
in interface ObjectNamespace
public void writeData(ObjectDataOutput out) throws IOException
DataSerializable
writeData
in interface DataSerializable
out
- outputIOException
- if an I/O error occurs. In particular,
an IOException
may be thrown if the
output stream has been closed.public void readData(ObjectDataInput in) throws IOException
DataSerializable
readData
in interface DataSerializable
in
- inputIOException
- if an I/O error occurs. In particular,
an IOException
may be thrown if the
input stream has been closed.Copyright © 2018 Hazelcast, Inc.. All rights reserved.