Package com.hazelcast.config
Class QueueConfig
java.lang.Object
com.hazelcast.config.QueueConfig
- All Implemented Interfaces:
NamedConfig,UserCodeNamespaceAwareConfig<QueueConfig>,DataSerializable,IdentifiedDataSerializable,com.hazelcast.nio.serialization.impl.Versioned
public class QueueConfig
extends Object
implements IdentifiedDataSerializable, NamedConfig, com.hazelcast.nio.serialization.impl.Versioned, UserCodeNamespaceAwareConfig<QueueConfig>
Contains the configuration for an
IQueue.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intDefault value of the asynchronous backup count.static final intDefault value for the TTL (time to live) for empty Queue.static final intDefault value for the maximum size of the Queue.static final intDefault value for the synchronous backup count.Fields inherited from interface com.hazelcast.config.UserCodeNamespaceAwareConfig
DEFAULT_NAMESPACE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddItemListenerConfig(ItemListenerConfig listenerConfig) Add an item listener configuration to this queue.final booleanintGet the number of asynchronous backups for this queue.intGet the number of synchronous backups for this queue.intReturns type identifier for this class.intReturns the TTL (time to live) for emptying the Queue.intReturns DataSerializableFactory factory ID for this class.Get the list of item listener configurations for this queue.intReturns the maximum size of the Queue.Gets theMergePolicyConfigfor this queue.getName()Returns the class name that will be used to compare queue items.Get the QueueStore (load and store queue items from/to a database) configuration.Returns the split brain protection name for queue operations.intGet the total number of backups: the backup count plus the asynchronous backup count.Retrieve the User Code Deployment Namespace to be used forClassLoaderawareness during operations related to the structure associated with this configuration.final inthashCode()booleanCheck if underlying implementation is aPriorityQueue.booleanCheck if statistics are enabled for this queue.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 for this queue.setEmptyQueueTtl(int emptyQueueTtl) Sets the TTL (time to live) for emptying the Queue.setItemListenerConfigs(List<ItemListenerConfig> listenerConfigs) Set the list of item listener configurations for this queue.setMaxSize(int maxSize) Sets the maximum size of the Queue.setMergePolicyConfig(MergePolicyConfig mergePolicyConfig) Sets theMergePolicyConfigfor this queue.Set the name for this queue.setPriorityComparatorClassName(String priorityComparatorClassName) Sets the class name that will be used to compare queue items.setQueueStoreConfig(QueueStoreConfig queueStoreConfig) Set the QueueStore (load and store queue items from/to a database) configuration.setSplitBrainProtectionName(String splitBrainProtectionName) Sets the split brain protection name for queue operations.setStatisticsEnabled(boolean statisticsEnabled) Enables or disables statistics for this queue.setUserCodeNamespace(String userCodeNamespace) Associates the provided Namespace Name with this structure forClassLoaderawareness.toString()voidWrites object fields to output stream
-
Field Details
-
DEFAULT_MAX_SIZE
public static final int DEFAULT_MAX_SIZEDefault value for the maximum size of the Queue.- See Also:
-
DEFAULT_SYNC_BACKUP_COUNT
public static final int DEFAULT_SYNC_BACKUP_COUNTDefault value for the synchronous backup count.- See Also:
-
DEFAULT_ASYNC_BACKUP_COUNT
public static final int DEFAULT_ASYNC_BACKUP_COUNTDefault value of the asynchronous backup count.- See Also:
-
DEFAULT_EMPTY_QUEUE_TTL
public static final int DEFAULT_EMPTY_QUEUE_TTLDefault value for the TTL (time to live) for empty Queue.- See Also:
-
-
Constructor Details
-
QueueConfig
public QueueConfig() -
QueueConfig
-
QueueConfig
-
-
Method Details
-
getEmptyQueueTtl
public int getEmptyQueueTtl()Returns the TTL (time to live) for emptying the Queue.- Returns:
- the TTL (time to live) for emptying the Queue
-
setEmptyQueueTtl
Sets the TTL (time to live) for emptying the Queue.- Parameters:
emptyQueueTtl- set the TTL (time to live) for emptying the Queue to this value- Returns:
- the Queue configuration
-
getMaxSize
public int getMaxSize()Returns the maximum size of the Queue.- Returns:
- the maximum size of the Queue
-
setMaxSize
Sets the maximum size of the Queue.- Parameters:
maxSize- set the maximum size of the Queue to this value- Returns:
- the Queue configuration
- Throws:
IllegalArgumentException- if the provided max size is negative
-
getTotalBackupCount
public int getTotalBackupCount()Get the total number of backups: the backup count plus the asynchronous backup count.- Returns:
- the total number of backups
-
getBackupCount
public int getBackupCount()Get the number of synchronous backups for this queue.- Returns:
- the synchronous backup count
-
setBackupCount
Sets the number of synchronous backups for this queue.- Parameters:
backupCount- the number of synchronous backups to set- Returns:
- the current QueueConfig
- Throws:
IllegalArgumentException- if backupCount is smaller than 0, or larger than the maximum number of backups, or the sum of the backups and async backups is larger than the maximum number of backups- See Also:
-
getAsyncBackupCount
public int getAsyncBackupCount()Get the number of asynchronous backups for this queue.- Returns:
- the number of asynchronous backups
-
setAsyncBackupCount
Sets the number of asynchronous backups. 0 means no backups.- Parameters:
asyncBackupCount- the number of asynchronous synchronous backups to set- Returns:
- the updated QueueConfig
- 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:
-
getQueueStoreConfig
Get the QueueStore (load and store queue items from/to a database) configuration.- Returns:
- the QueueStore configuration
-
setQueueStoreConfig
Set the QueueStore (load and store queue items from/to a database) configuration.- Parameters:
queueStoreConfig- set the QueueStore configuration to this configuration- Returns:
- the QueueStore configuration
-
isStatisticsEnabled
public boolean isStatisticsEnabled()Check if statistics are enabled for this queue.- Returns:
trueif statistics are enabled,falseotherwise
-
setStatisticsEnabled
Enables or disables statistics for this queue.- Parameters:
statisticsEnabled-trueto enable statistics for this queue,falseto disable- Returns:
- the updated QueueConfig
-
getName
- Specified by:
getNamein interfaceNamedConfig- Returns:
- the name of this queue
-
setName
Set the name for this queue.- Specified by:
setNamein interfaceNamedConfig- Parameters:
name- the name to set for this queue- Returns:
- this queue configuration
-
addItemListenerConfig
Add an item listener configuration to this queue.- Parameters:
listenerConfig- the item listener configuration to add to this queue- Returns:
- the updated queue configuration
-
getItemListenerConfigs
Get the list of item listener configurations for this queue.- Returns:
- the list of item listener configurations for this queue
-
setItemListenerConfigs
Set the list of item listener configurations for this queue.- Parameters:
listenerConfigs- the list of item listener configurations to set for this queue- Returns:
- the updated queue configuration
-
getSplitBrainProtectionName
Returns the split brain protection name for queue operations.- Returns:
- the split brain protection name
-
setSplitBrainProtectionName
Sets the split brain protection name for queue operations.- Parameters:
splitBrainProtectionName- the split brain protection name- Returns:
- the updated queue configuration
-
getMergePolicyConfig
Gets theMergePolicyConfigfor this queue.- Returns:
- the
MergePolicyConfigfor this queue
-
setMergePolicyConfig
Sets theMergePolicyConfigfor this queue.- Returns:
- the updated queue configuration
-
isPriorityQueue
public boolean isPriorityQueue()Check if underlying implementation is aPriorityQueue. Otherwise, it is a FIFO queue.- Returns:
trueif priority queue has been configured,falseotherwise
-
getPriorityComparatorClassName
Returns the class name that will be used to compare queue items. If the returned class name is non-empty, the queue will behave as a priority queue, otherwise it behaves as a FIFO queue.If this value is non-null, then Hazelcast will ignore the queue store
QueueStoreConfig.STORE_MEMORY_LIMITconfiguration value. -
setPriorityComparatorClassName
Sets the class name that will be used to compare queue items. If the provided class name is non-empty, the queue will behave as a priority queue, otherwise it behaves as a FIFO queue.Setting the comparator to a non-null value also makes the queue store ignore the
QueueStoreConfig.STORE_MEMORY_LIMITconfiguration value.- Parameters:
priorityComparatorClassName- the class name that will be used to compare queue items- Returns:
- this QueueConfig instance
-
getUserCodeNamespace
Retrieve the User Code Deployment Namespace to be used forClassLoaderawareness during operations related to the structure associated with this configuration.- Specified by:
getUserCodeNamespacein interfaceUserCodeNamespaceAwareConfig<QueueConfig>- Returns:
- Namespace Name for use with the
UserCodeNamespaceService, ornullif there is no User Code Namespace to associate with.
-
setUserCodeNamespace
Associates 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 interfaceUserCodeNamespaceAwareConfig<QueueConfig>- Parameters:
userCodeNamespace- The ID of the Namespace to associate with this structure.- Returns:
- the updated
QueueConfiginstance - Since:
- 5.4
-
toString
-
getFactoryId
public int getFactoryId()Description copied from interface:IdentifiedDataSerializableReturns DataSerializableFactory factory ID for this class.- Specified by:
getFactoryIdin interfaceIdentifiedDataSerializable- Returns:
- factory ID
-
getClassId
public int getClassId()Description copied from interface:IdentifiedDataSerializableReturns type identifier for this class. It should be unique per DataSerializableFactory.- Specified by:
getClassIdin interfaceIdentifiedDataSerializable- Returns:
- type ID
-
writeData
Description copied from interface:DataSerializableWrites object fields to output stream- Specified by:
writeDatain interfaceDataSerializable- Parameters:
out- output- Throws:
IOException- if an I/O error occurs. In particular, anIOExceptionmay be thrown if the output stream has been closed.
-
readData
Description copied from interface:DataSerializableReads fields from the input stream- Specified by:
readDatain interfaceDataSerializable- Parameters:
in- input- Throws:
IOException- if an I/O error occurs. In particular, anIOExceptionmay be thrown if the input stream has been closed.
-
equals
-
hashCode
public final int hashCode()
-