public class SemaphoreConfig extends Object implements IdentifiedDataSerializable, Versioned, NamedConfig
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 |
---|---|
boolean |
equals(Object o) |
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 |
getFactoryId()
Returns DataSerializableFactory factory ID for this class.
|
int |
getId()
Returns type identifier for this class.
|
int |
getInitialPermits()
Gets the initial number of permits.
|
String |
getName()
Gets the name of the semaphore.
|
String |
getQuorumName() |
int |
getTotalBackupCount()
Returns the total number of backups (synchronous plus asynchronous);
the returned value will always equal or bigger than 0.
|
int |
hashCode() |
void |
readData(ObjectDataInput in)
Reads fields from the input stream
|
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.
|
SemaphoreConfig |
setQuorumName(String quorumName) |
String |
toString() |
void |
writeData(ObjectDataOutput out)
Writes object fields to output stream
|
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()
null
is returned.getName
in interface NamedConfig
public SemaphoreConfig setName(String name)
setName
in interface NamedConfig
name
- the name of the semaphoreIllegalArgumentException
- if name is null
or emptypublic int getInitialPermits()
public SemaphoreConfig setInitialPermits(int initialPermits)
initialPermits
- the initial number of permitspublic 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 setIllegalArgumentException
- 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()
public String getQuorumName()
public SemaphoreConfig setQuorumName(String quorumName)
public int getFactoryId()
IdentifiedDataSerializable
getFactoryId
in interface IdentifiedDataSerializable
public int getId()
IdentifiedDataSerializable
getId
in interface IdentifiedDataSerializable
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 © 2021 Hazelcast, Inc.. All Rights Reserved.