com.hazelcast.config
Class SemaphoreConfig

java.lang.Object
  extended by com.hazelcast.config.SemaphoreConfig
Direct Known Subclasses:
SemaphoreConfigReadOnly

public class SemaphoreConfig
extends Object

Contains the configuration for an ISemaphore.


Field Summary
static int DEFAULT_ASYNC_BACKUP_COUNT
          Default asynchronous backup count
static int DEFAULT_SYNC_BACKUP_COUNT
          Default synchronous backup count
 
Constructor Summary
SemaphoreConfig()
          Creates a default configured SemaphoreConfig.
SemaphoreConfig(SemaphoreConfig config)
          Creates a SemaphoreConfig by cloning another one.
 
Method Summary
 SemaphoreConfigReadOnly getAsReadOnly()
           
 int getAsyncBackupCount()
          Returns the number of asynchronous backups.
 int getBackupCount()
          Returns the number of synchronous backups.
 int getInitialPermits()
          Gets the initial number of permits
 String getName()
          Gets the name of the semaphore.
 int getTotalBackupCount()
          Returns the total number of backups; the returned value will always equal or bigger than 0.
 SemaphoreConfig setAsyncBackupCount(int asyncBackupCount)
          Sets the number of asynchronous backups.
 SemaphoreConfig setBackupCount(int backupCount)
          Sets the number of synchronous backups.
 SemaphoreConfig setInitialPermits(int initialPermits)
          Sets the initial number of permits.
 SemaphoreConfig setName(String name)
          Sets the name of the semaphore.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_SYNC_BACKUP_COUNT

public static final int DEFAULT_SYNC_BACKUP_COUNT
Default synchronous backup count

See Also:
Constant Field Values

DEFAULT_ASYNC_BACKUP_COUNT

public static final int DEFAULT_ASYNC_BACKUP_COUNT
Default asynchronous backup count

See Also:
Constant Field Values
Constructor Detail

SemaphoreConfig

public SemaphoreConfig()
Creates a default configured SemaphoreConfig.


SemaphoreConfig

public SemaphoreConfig(SemaphoreConfig config)
Creates a SemaphoreConfig by cloning another one.

Parameters:
config - the SemaphoreConfig to copy
Throws:
IllegalArgumentException - if config is null.
Method Detail

getAsReadOnly

public SemaphoreConfigReadOnly getAsReadOnly()

getName

public String getName()
Gets the name of the semaphore. If no name has been configured, null is returned.

Returns:
the name of the semaphore.

setName

public SemaphoreConfig setName(String name)
Sets the name of the semaphore.

Parameters:
name - the name
Returns:
the updated SemaphoreConfig
Throws:
IllegalArgumentException - if name is null or empty.

getInitialPermits

public int getInitialPermits()
Gets the initial number of permits

Returns:
the initial number of permits.

setInitialPermits

public SemaphoreConfig setInitialPermits(int initialPermits)
Sets the initial number of permits. The initial number of permits can be 0; meaning that there is no permit but it can also be negative meaning that there is a shortage of permits.

Parameters:
initialPermits - the initial number of permits.
Returns:
the updated SemaphoreConfig

getBackupCount

public int getBackupCount()
Returns the number of synchronous backups.

Returns:
the number of synchronous backups.
See Also:
setBackupCount(int)

setBackupCount

public SemaphoreConfig setBackupCount(int backupCount)
Sets the number of synchronous backups.

Parameters:
backupCount - the number of synchronous backups
Returns:
the updated SemaphoreConfig
Throws:
new - IllegalArgumentException if backupCount smaller than 0.
See Also:
setAsyncBackupCount(int), getBackupCount()

getAsyncBackupCount

public int getAsyncBackupCount()
Returns the number of asynchronous backups.

Returns:
the number of asynchronous backups.
See Also:
setAsyncBackupCount(int)

setAsyncBackupCount

public SemaphoreConfig setAsyncBackupCount(int asyncBackupCount)
Sets the number of asynchronous backups.

Parameters:
asyncBackupCount - the number of asynchronous backups
Returns:
the updated SemaphoreConfig
Throws:
new - IllegalArgumentException if asyncBackupCount smaller than 0.
See Also:
(int), getAsyncBackupCount()

getTotalBackupCount

public int getTotalBackupCount()
Returns the total number of backups; the returned value will always equal or bigger than 0.

Returns:
total number of backups.

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2015 Hazelcast, Inc.. All Rights Reserved.