@Beta public class RingbufferConfig extends Object
Ringbuffer
.
The RingBuffer is currently not a distributed data-structure, so its content will be fully stored on a single member
in the cluster and its backup in another member in the cluster.Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_ASYNC_BACKUP_COUNT
Default value of asynchronous backup count
|
static int |
DEFAULT_CAPACITY
Default value of capacity of the RingBuffer.
|
static InMemoryFormat |
DEFAULT_IN_MEMORY_FORMAT
Default value for the InMemoryFormat.
|
static int |
DEFAULT_SYNC_BACKUP_COUNT
Default value of synchronous backup count
|
static int |
DEFAULT_TTL_SECONDS
Default value for the time to live property.
|
Constructor and Description |
---|
RingbufferConfig() |
RingbufferConfig(RingbufferConfig config)
Clones a RingbufferConfig
|
RingbufferConfig(String name)
Creates a RingbufferConfig with the provided name.
|
RingbufferConfig(String name,
RingbufferConfig config)
Creates a new RingbufferConfig by cloning an existing config and overriding the name.
|
Modifier and Type | Method and Description |
---|---|
RingbufferConfig |
getAsReadOnly()
Deprecated.
this method will be removed in 4.0; it is meant for internal usage only.
|
int |
getAsyncBackupCount()
Gets the number of asynchronous backups.
|
int |
getBackupCount()
Gets the number of synchronous backups.
|
int |
getCapacity()
Gets the capacity of the ringbuffer.
|
InMemoryFormat |
getInMemoryFormat()
Gets the InMemoryFormat.
|
String |
getName()
Returns the name of the ringbuffer.
|
RingbufferStoreConfig |
getRingbufferStoreConfig()
Get the RingbufferStore (load and store ring buffer items from/to a database) configuration.
|
int |
getTimeToLiveSeconds()
Gets the time to live in seconds.
|
int |
getTotalBackupCount()
Returns the total number of backups: backupCount plus asyncBackupCount.
|
RingbufferConfig |
setAsyncBackupCount(int asyncBackupCount)
Sets the number of asynchronous backups.
|
RingbufferConfig |
setBackupCount(int backupCount)
Sets the number of synchronous backups.
|
RingbufferConfig |
setCapacity(int capacity)
Sets the capacity of the ringbuffer.
|
RingbufferConfig |
setInMemoryFormat(InMemoryFormat inMemoryFormat)
Sets the InMemoryFormat.
|
RingbufferConfig |
setName(String name)
Sets the name of the ringbuffer.
|
RingbufferConfig |
setRingbufferStoreConfig(RingbufferStoreConfig ringbufferStoreConfig)
Set the RingbufferStore (load and store ring buffer items from/to a database) configuration.
|
RingbufferConfig |
setTimeToLiveSeconds(int timeToLiveSeconds)
Sets the time to live in seconds.
|
String |
toString() |
public static final int DEFAULT_CAPACITY
public static final int DEFAULT_SYNC_BACKUP_COUNT
public static final int DEFAULT_ASYNC_BACKUP_COUNT
public static final int DEFAULT_TTL_SECONDS
public static final InMemoryFormat DEFAULT_IN_MEMORY_FORMAT
public RingbufferConfig()
public RingbufferConfig(String name)
name
- the nameNullPointerException
- if name is nullpublic RingbufferConfig(RingbufferConfig config)
config
- the ringbuffer config to cloneNullPointerException
- if config is nullpublic RingbufferConfig(String name, RingbufferConfig config)
name
- the new nameconfig
- the config.NullPointerException
- if name or config is null.public RingbufferConfig setName(String name)
name
- the name of the ringbufferRingbufferConfig
IllegalArgumentException
- if name is null or an empty string.public String getName()
public int getCapacity()
public RingbufferConfig setCapacity(int capacity)
capacity
- the capacity.IllegalArgumentException
- if capacity smaller than 1.getCapacity()
public int getBackupCount()
public RingbufferConfig 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()
public RingbufferConfig 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 int getTimeToLiveSeconds()
public RingbufferConfig setTimeToLiveSeconds(int timeToLiveSeconds)
Time to live is the time the ringbuffer is going to retain items before deleting them.
Time to live can be disabled by setting timeToLiveSeconds to 0. It means that items won't get removed because they retire. They will only overwrite. This means that when timeToLiveSeconds is disabled, that after tail did a full loop in the ring that the size will always be equal to the capacity.
timeToLiveSeconds
- the time to live period in secondsIllegalArgumentException
- if timeToLiveSeconds smaller than 0.public InMemoryFormat getInMemoryFormat()
public RingbufferConfig setInMemoryFormat(InMemoryFormat inMemoryFormat)
Setting the InMemoryFormat controls format of storing an item in the ringbuffer:
InMemoryFormat.OBJECT
: the item is stored in deserialized format (so a regular object)InMemoryFormat.BINARY
: the item is stored in serialized format (so a is binary blob) The default is binary. The object InMemoryFormat is useful when:
inMemoryFormat
- the new in memory format.NullPointerException
- if inMemoryFormat is null.IllegalArgumentException
- if InMemoryFormat.NATIVE
in memory format is selected.public RingbufferStoreConfig getRingbufferStoreConfig()
public RingbufferConfig setRingbufferStoreConfig(RingbufferStoreConfig ringbufferStoreConfig)
ringbufferStoreConfig
- Set the RingbufferStore configuration to this configuration.public RingbufferConfig getAsReadOnly()
Copyright © 2017 Hazelcast, Inc.. All Rights Reserved.