Class RingbufferConfig
- All Implemented Interfaces:
- NamedConfig,- UserCodeNamespaceAwareConfig<RingbufferConfig>,- DataSerializable,- IdentifiedDataSerializable,- com.hazelcast.nio.serialization.impl.Versioned
Ringbuffer.
 The RingBuffer is a replicated but not partitioned 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.
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final intDefault value of asynchronous backup countstatic final intDefault value of capacity of the RingBuffer.static final InMemoryFormatDefault value for the in-memory format.static final intDefault value of synchronous backup countstatic final intDefault value for the time to live property.Fields inherited from interface com.hazelcast.config.UserCodeNamespaceAwareConfigDEFAULT_NAMESPACE
- 
Constructor SummaryConstructorsConstructorDescriptionRingbufferConfig(RingbufferConfig config) Clones a RingbufferConfigRingbufferConfig(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.
- 
Method SummaryModifier and TypeMethodDescriptionfinal booleanintGets the number of asynchronous backups.intGets the number of synchronous backups.intGets the capacity of the ringbuffer.intReturns type identifier for this class.intReturns DataSerializableFactory factory ID for this class.Returns the in-memory format.Gets theMergePolicyConfigfor this ringbuffer.getName()Returns the name of the ringbuffer.Get the RingbufferStore (load and store ringbuffer items from/to a database) configuration.Returns the split brain protection name for operations.intGets the time to live in seconds.intReturns the total number of backups: backupCount plus asyncBackupCount.Retrieve the User Code Deployment Namespace to be used forClassLoaderawareness during operations related to the structure associated with this configuration.final inthashCode()voidReads fields from the input streamsetAsyncBackupCount(int asyncBackupCount) Sets the number of asynchronous backups. 0 means no backups.setBackupCount(int backupCount) Sets the number of synchronous backups.setCapacity(int capacity) Sets the capacity of the ringbuffer.setInMemoryFormat(InMemoryFormat inMemoryFormat) Sets the in-memory format.setMergePolicyConfig(MergePolicyConfig mergePolicyConfig) Sets theMergePolicyConfigfor this ringbuffer.Sets the name of the ringbuffer.setRingbufferStoreConfig(RingbufferStoreConfig ringbufferStoreConfig) Set the RingbufferStore (load and store ringbuffer items from/to a database) configuration.setSplitBrainProtectionName(String splitBrainProtectionName) Sets the split brain protection name for operations.setTimeToLiveSeconds(int timeToLiveSeconds) Sets the time to live in seconds which is the maximum number of seconds for each item to stay in the ringbuffer before being removed.setUserCodeNamespace(String userCodeNamespace) Associates the provided Namespace Name with this structure forClassLoaderawareness.toString()voidWrites object fields to output stream
- 
Field Details- 
DEFAULT_CAPACITYpublic static final int DEFAULT_CAPACITYDefault value of capacity of the RingBuffer.- See Also:
 
- 
DEFAULT_SYNC_BACKUP_COUNTpublic static final int DEFAULT_SYNC_BACKUP_COUNTDefault value of synchronous backup count- See Also:
 
- 
DEFAULT_ASYNC_BACKUP_COUNTpublic static final int DEFAULT_ASYNC_BACKUP_COUNTDefault value of asynchronous backup count- See Also:
 
- 
DEFAULT_TTL_SECONDSpublic static final int DEFAULT_TTL_SECONDSDefault value for the time to live property.- See Also:
 
- 
DEFAULT_IN_MEMORY_FORMATDefault value for the in-memory format.
 
- 
- 
Constructor Details- 
RingbufferConfigpublic RingbufferConfig()
- 
RingbufferConfigCreates a RingbufferConfig with the provided name.- Parameters:
- name- the name
- Throws:
- NullPointerException- if name is- null
 
- 
RingbufferConfigClones a RingbufferConfig- Parameters:
- config- the ringbuffer config to clone
- Throws:
- NullPointerException- if config is- null
 
- 
RingbufferConfigCreates a new RingbufferConfig by cloning an existing config and overriding the name.- Parameters:
- name- the new name
- config- the config
- Throws:
- NullPointerException- if name or config is- null
 
 
- 
- 
Method Details- 
setNameSets the name of the ringbuffer.- Specified by:
- setNamein interface- NamedConfig
- Parameters:
- name- the name of the ringbuffer
- Returns:
- the updated RingbufferConfig
- Throws:
- IllegalArgumentException- if name is- nullor an empty string
 
- 
getNameReturns the name of the ringbuffer.- Specified by:
- getNamein interface- NamedConfig
- Returns:
- the name of the ringbuffer
 
- 
getCapacitypublic int getCapacity()Gets the capacity of the ringbuffer.The capacity is the total number of items in the ringbuffer. The items will remain in the ringbuffer, but the oldest items will eventually be overwritten by the newest items. - Returns:
- the capacity
 
- 
setCapacitySets the capacity of the ringbuffer.- Parameters:
- capacity- the capacity
- Returns:
- the updated Config
- Throws:
- IllegalArgumentException- if capacity smaller than 1
- See Also:
 
- 
getBackupCountpublic int getBackupCount()Gets the number of synchronous backups.- Returns:
- number of synchronous backups
 
- 
setBackupCountSets the number of synchronous backups.- Parameters:
- backupCount- the number of synchronous backups to set
- Returns:
- the updated SemaphoreConfig
- Throws:
- IllegalArgumentException- 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 backups
- See Also:
 
- 
getAsyncBackupCountpublic int getAsyncBackupCount()Gets the number of asynchronous backups.- Returns:
- the number of asynchronous backups
 
- 
setAsyncBackupCountSets the number of asynchronous backups. 0 means no backups.- Parameters:
- asyncBackupCount- the number of asynchronous synchronous backups to set
- Returns:
- the updated SemaphoreConfig
- Throws:
- 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 backups
- See Also:
 
- 
getTotalBackupCountpublic int getTotalBackupCount()Returns the total number of backups: backupCount plus asyncBackupCount.- Returns:
- the total number of backups: backupCount plus asyncBackupCount
 
- 
getTimeToLiveSecondspublic int getTimeToLiveSeconds()Gets the time to live in seconds.- Returns:
- the time to live in seconds or 0 if the items don't expire
 
- 
setTimeToLiveSecondsSets the time to live in seconds which is the maximum number of seconds for each item to stay in the ringbuffer before being removed.Entries that are older than timeToLiveSecondsare removed from the ringbuffer on the next ringbuffer operation (read or write).Time to live can be disabled by setting timeToLiveSecondsto 0. It means that items won't get removed because they expire. They may only be overwritten. WhentimeToLiveSecondsis disabled and after the tail does a full loop in the ring, the ringbuffer size will always be equal to the capacity.The timeToLiveSecondscan be any integer between 0 andInteger.MAX_VALUE. 0 means infinite. The default is 0.- Parameters:
- timeToLiveSeconds- the time to live period in seconds
- Returns:
- the updated RingbufferConfig
- Throws:
- IllegalArgumentException- if timeToLiveSeconds smaller than 0
 
- 
getInMemoryFormatReturns the in-memory format.The in-memory format controls the format of the stored item in the ringbuffer: - InMemoryFormat.OBJECT: the item is stored in deserialized format (a regular object)
- InMemoryFormat.BINARY: the item is stored in serialized format (a binary blob)
 The default is binary. The object InMemoryFormat is useful when: - the object stored in object format has a smaller footprint than in binary format
- if there are readers using a filter. Since for every filter invocation, the object needs to be available in object format.
 
- 
setInMemoryFormatSets the in-memory format.The in-memory format controls the format of the stored item in the ringbuffer: - InMemoryFormat.OBJECT: the item is stored in deserialized format (a regular object)
- InMemoryFormat.BINARY: the item is stored in serialized format (a binary blob)
 The default is binary. The object InMemoryFormat is useful when: - the object stored in object format has a smaller footprint than in binary format
- if there are readers using a filter. Since for every filter invocation, the object needs to be available in object format.
 - Parameters:
- inMemoryFormat- the new in memory format
- Returns:
- the updated Config
- Throws:
- NullPointerException- if inMemoryFormat is- null
- IllegalArgumentException- if- InMemoryFormat.NATIVEin-memory format is selected
 
- 
getRingbufferStoreConfigGet the RingbufferStore (load and store ringbuffer items from/to a database) configuration.- Returns:
- the ringbuffer store configuration
 
- 
setRingbufferStoreConfigSet the RingbufferStore (load and store ringbuffer items from/to a database) configuration.- Parameters:
- ringbufferStoreConfig- set the RingbufferStore configuration to this configuration
- Returns:
- the ringbuffer configuration
 
- 
getSplitBrainProtectionNameReturns the split brain protection name for operations.- Returns:
- the split brain protection name
 
- 
setSplitBrainProtectionNameSets the split brain protection name for operations.- Parameters:
- splitBrainProtectionName- the split brain protection name
- Returns:
- the updated configuration
 
- 
getMergePolicyConfigGets theMergePolicyConfigfor this ringbuffer.- Returns:
- the MergePolicyConfigfor this ringbuffer
 
- 
setMergePolicyConfigSets theMergePolicyConfigfor this ringbuffer.- Returns:
- the ringbuffer configuration
 
- 
getUserCodeNamespaceRetrieve the User Code Deployment Namespace to be used forClassLoaderawareness during operations related to the structure associated with this configuration.- Specified by:
- getUserCodeNamespacein interface- UserCodeNamespaceAwareConfig<RingbufferConfig>
- Returns:
- Namespace Name for use with the UserCodeNamespaceService, ornullif there is no User Code Namespace to associate with.
 
- 
setUserCodeNamespaceAssociates the provided Namespace Name with this structure forClassLoaderawareness.The behaviour of setting this to nullis outlined in the documentation forUserCodeNamespaceAwareConfig.DEFAULT_NAMESPACE.- Specified by:
- setUserCodeNamespacein interface- UserCodeNamespaceAwareConfig<RingbufferConfig>
- Parameters:
- userCodeNamespace- The ID of the Namespace to associate with this structure.
- Returns:
- the updated RingbufferConfiginstance
- Since:
- 5.4
 
- 
toString
- 
getFactoryIdpublic int getFactoryId()Description copied from interface:IdentifiedDataSerializableReturns DataSerializableFactory factory ID for this class.- Specified by:
- getFactoryIdin interface- IdentifiedDataSerializable
- Returns:
- factory ID
 
- 
getClassIdpublic int getClassId()Description copied from interface:IdentifiedDataSerializableReturns type identifier for this class. It should be unique per DataSerializableFactory.- Specified by:
- getClassIdin interface- IdentifiedDataSerializable
- Returns:
- type ID
 
- 
writeDataDescription copied from interface:DataSerializableWrites object fields to output stream- Specified by:
- writeDatain interface- DataSerializable
- Parameters:
- out- output
- Throws:
- IOException- if an I/O error occurs. In particular, an- IOExceptionmay be thrown if the output stream has been closed.
 
- 
readDataDescription copied from interface:DataSerializableReads fields from the input stream- Specified by:
- readDatain interface- DataSerializable
- Parameters:
- in- input
- Throws:
- IOException- if an I/O error occurs. In particular, an- IOExceptionmay be thrown if the input stream has been closed.
 
- 
equals
- 
hashCodepublic final int hashCode()
 
-