com.hazelcast.concurrent.semaphore

## Class SemaphoreContainer

- java.lang.Object
- - com.hazelcast.concurrent.semaphore.SemaphoreContainer

- All Implemented Interfaces:
    DataSerializable, IdentifiedDataSerializable

      public class SemaphoreContainer
      extends Object
      implements IdentifiedDataSerializable

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `INITIAL_CAPACITY`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SemaphoreContainer()`
    `SemaphoreContainer(int partitionId, SemaphoreConfig config)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `acquire(String owner, int permitCount)`
    `boolean` | `detachAll(String owner)`
    `int` | `drain(String owner)`
    `int` | `getAsyncBackupCount()`
    `int` | `getAvailable()`
    `int` | `getFactoryId()` Returns DataSerializableFactory factory ID for this class.
    `int` | `getId()` Returns type identifier for this class.
    `int` | `getPartitionId()`
    `int` | `getSyncBackupCount()`
    `int` | `getTotalBackupCount()`
    `boolean` | `increase(int permitCount)`
    `boolean` | `init(int permitCount)`
    `boolean` | `isAvailable(int permitCount)`
    `void` | `readData(ObjectDataInput in)` Reads fields from the input stream
    `boolean` | `reduce(int permitCount)`
    `void` | `release(String owner, int permitCount)`
    `void` | `setInitialized()`
    `String` | `toString()`
    `void` | `writeData(ObjectDataOutput out)` Writes object fields to output stream

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

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

- - ### Field Detail

    - #### INITIAL_CAPACITY

          public static final int INITIAL_CAPACITY

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### SemaphoreContainer

          public SemaphoreContainer()

    - #### SemaphoreContainer

          public SemaphoreContainer(int partitionId,
                                    SemaphoreConfig config)

  - ### Method Detail

    - #### detachAll

          public boolean detachAll(String owner)

    - #### init

          public boolean init(int permitCount)

    - #### getAvailable

          public int getAvailable()

    - #### isAvailable

          public boolean isAvailable(int permitCount)

    - #### acquire

          public boolean acquire(String owner,
                                 int permitCount)

    - #### drain

          public int drain(String owner)

    - #### increase

          public boolean increase(int permitCount)

    - #### reduce

          public boolean reduce(int permitCount)

    - #### release

          public void release(String owner,
                              int permitCount)

    - #### getPartitionId

          public int getPartitionId()

    - #### getSyncBackupCount

          public int getSyncBackupCount()

    - #### getAsyncBackupCount

          public int getAsyncBackupCount()

    - #### setInitialized

          public void setInitialized()

    - #### getTotalBackupCount

          public int getTotalBackupCount()

    - #### getFactoryId

          public int getFactoryId()

      Description copied from interface: `IdentifiedDataSerializable`
      Returns DataSerializableFactory factory ID for this class.
      Specified by:
        `getFactoryId` in interface `IdentifiedDataSerializable`
      Returns:
        factory ID

    - #### getId

          public int getId()

      Description copied from interface: `IdentifiedDataSerializable`
      Returns type identifier for this class. It should be unique per DataSerializableFactory.
      Specified by:
        `getId` in interface `IdentifiedDataSerializable`
      Returns:
        type ID

    - #### 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.

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

Copyright © 2018. All rights reserved.