com.hazelcast.concurrent.lock

## Class InternalLockNamespace

- java.lang.Object
- - com.hazelcast.concurrent.lock.InternalLockNamespace

- All Implemented Interfaces:
    DataSerializable, ObjectNamespace, ServiceNamespace

      public final class InternalLockNamespace
      extends Object
      implements ObjectNamespace

  A specialization of `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`
  See Also:
    `LockStoreContainer.getOrCreateLockStore(ObjectNamespace)`, `OperationParkerImpl.cancelParkedOperations(String, Object, Throwable)`

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `InternalLockNamespace()`
    `InternalLockNamespace(String name)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    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

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### InternalLockNamespace

          public InternalLockNamespace()

    - #### InternalLockNamespace

          public InternalLockNamespace(String name)

  - ### Method Detail

    - #### getServiceName

          public String getServiceName()

      Description copied from interface: `ServiceNamespace`
      Name of the service
      Specified by:
        `getServiceName` in interface `ServiceNamespace`
      Returns:
        name of the service

    - #### getObjectName

          public String getObjectName()

      Description copied from interface: `ObjectNamespace`
      Gets the object name within the service.
      Specified by:
        `getObjectName` in interface `ObjectNamespace`
      Returns:
        the object name within the service

    - #### writeData

          public void writeData(ObjectDataOutput out)
                         throws IOException

      Description copied from interface: `DataSerializable`
      Writes object fields to output stream
      Specified by:
        `writeData` in interface `DataSerializable`
      Parameters:
        `out` - output
      Throws:
        `IOException` - if an I/O error occurs. In particular, an `IOException` may be thrown if the output stream has been closed.

    - #### readData

          public void readData(ObjectDataInput in)
                        throws IOException

      Description copied from interface: `DataSerializable`
      Reads fields from the input stream
      Specified by:
        `readData` in interface `DataSerializable`
      Parameters:
        `in` - input
      Throws:
        `IOException` - if an I/O error occurs. In particular, an `IOException` may be thrown if the input stream has been closed.

    - #### equals

          public boolean equals(Object o)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

Copyright © 2018. All rights reserved.