public class SemaphoreConfig extends Object
ISemaphore
.Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_ASYNC_BACKUP_COUNT
Default asynchronous backup count
|
static int |
DEFAULT_SYNC_BACKUP_COUNT
Default synchronous backup count
|
Constructor and Description |
---|
SemaphoreConfig()
Creates a default configured
SemaphoreConfig . |
SemaphoreConfig(SemaphoreConfig config)
Creates a SemaphoreConfig by cloning another one.
|
Modifier and Type | Method and Description |
---|---|
SemaphoreConfigReadOnly |
getAsReadOnly()
Deprecated.
this method will be removed in 4.0; it is meant for internal usage only.
|
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 (synchronous plus asynchronous);
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() |
public static final int DEFAULT_SYNC_BACKUP_COUNT
public static final int DEFAULT_ASYNC_BACKUP_COUNT
public SemaphoreConfig()
SemaphoreConfig
.public SemaphoreConfig(SemaphoreConfig config)
config
- the SemaphoreConfig to copyIllegalArgumentException
- if config is null.public SemaphoreConfigReadOnly getAsReadOnly()
public String getName()
public SemaphoreConfig setName(String name)
name
- the name of the semaphoreIllegalArgumentException
- if name is null or empty.public int getInitialPermits()
public SemaphoreConfig setInitialPermits(int initialPermits)
initialPermits
- the initial number of permits.public int getBackupCount()
setBackupCount(int)
public SemaphoreConfig setBackupCount(int backupCount)
backupCount
- the number of synchronous backups to setIllegalArgumentException
- if backupCount smaller than 0,
or larger than the maximum number of backup
or the sum of the backups and async backups is larger
than the maximum number of backupssetAsyncBackupCount(int)
,
getBackupCount()
public int getAsyncBackupCount()
setAsyncBackupCount(int)
public SemaphoreConfig setAsyncBackupCount(int asyncBackupCount)
asyncBackupCount
- the number of asynchronous synchronous backups to set.IllegalArgumentException
- if asyncBackupCount smaller than 0,
or larger than the maximum number of backup
or the sum of the backups and async backups is larger than the maximum
number of backupssetBackupCount(int)
,
getAsyncBackupCount()
public int getTotalBackupCount()
Copyright © 2017 Hazelcast, Inc.. All Rights Reserved.