Package com.hazelcast.config
Class CollectionConfig<T extends CollectionConfig>
java.lang.Object
com.hazelcast.config.CollectionConfig<T>
- Type Parameters:
- T- Type of Collection such as List, Set
- All Implemented Interfaces:
- NamedConfig,- UserCodeNamespaceAwareConfig<CollectionConfig<T>>,- DataSerializable,- IdentifiedDataSerializable,- com.hazelcast.nio.serialization.impl.Versioned
- Direct Known Subclasses:
- ListConfig,- SetConfig
public abstract class CollectionConfig<T extends CollectionConfig>
extends Object
implements IdentifiedDataSerializable, NamedConfig, com.hazelcast.nio.serialization.impl.Versioned, UserCodeNamespaceAwareConfig<CollectionConfig<T>>
Provides configuration service for Collection.
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final intThe default number of asynchronous backupsstatic final intDefault maximum size for the Configuration.static final intThe default number of synchronous backupsFields inherited from interface com.hazelcast.config.UserCodeNamespaceAwareConfigDEFAULT_NAMESPACE
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionaddItemListenerConfig(ItemListenerConfig itemListenerConfig) Adds an item listener to this collection (listens for when items are added or removed).final booleanprotected StringReturns field names with values as concatenated String, so it can be used in child classes' toString() methods.intGets the number of asynchronous backups.intGets the number of synchronous backups for this collection.intReturns DataSerializableFactory factory ID for this class.Gets the list of ItemListenerConfigs.intGets the maximum size for the Configuration.Gets theMergePolicyConfigfor the collection.getName()Gets the name of this collection.Returns the split brain protection name for operations.intGets the total number of synchronous and asynchronous backups for this collection.Retrieve the User Code Deployment Namespace to be used forClassLoaderawareness during operations related to the structure associated with this configuration.final inthashCode()booleanChecks if collection statistics are enabled.voidReads fields from the input streamsetAsyncBackupCount(int asyncBackupCount) Sets the number of asynchronous backups.setBackupCount(int backupCount) Sets the number of synchronous backups for this collection.setItemListenerConfigs(List<ItemListenerConfig> listenerConfigs) Sets the list of ItemListenerConfigs.setMaxSize(int maxSize) Sets the maximum size for the collection.setMergePolicyConfig(MergePolicyConfig mergePolicyConfig) Sets theMergePolicyConfigfor the collection.Sets the name of this collection.setSplitBrainProtectionName(String splitBrainProtectionName) Sets the split brain protection name for operations.setStatisticsEnabled(boolean statisticsEnabled) Sets collection statistics to enabled or disabled.setUserCodeNamespace(String userCodeNamespace) Associates the provided Namespace Name with this structure forClassLoaderawareness.voidWrites object fields to output streamMethods inherited from class java.lang.Objectclone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.hazelcast.nio.serialization.IdentifiedDataSerializablegetClassId
- 
Field Details- 
DEFAULT_MAX_SIZEpublic static final int DEFAULT_MAX_SIZEDefault maximum size for the Configuration.- See Also:
 
- 
DEFAULT_SYNC_BACKUP_COUNTpublic static final int DEFAULT_SYNC_BACKUP_COUNTThe default number of synchronous backups- See Also:
 
- 
DEFAULT_ASYNC_BACKUP_COUNTpublic static final int DEFAULT_ASYNC_BACKUP_COUNTThe default number of asynchronous backups- See Also:
 
 
- 
- 
Constructor Details- 
CollectionConfigprotected CollectionConfig()
- 
CollectionConfig
 
- 
- 
Method Details- 
getNameGets the name of this collection.- Specified by:
- getNamein interface- NamedConfig
- Returns:
- the name of this collection
 
- 
setNameSets the name of this collection.- Specified by:
- setNamein interface- NamedConfig
- Parameters:
- name- the name of this collection
- Returns:
- the updated collection configuration
 
- 
getItemListenerConfigsGets the list of ItemListenerConfigs.- Returns:
- the list of ItemListenerConfigs
 
- 
setItemListenerConfigsSets the list of ItemListenerConfigs.- Parameters:
- listenerConfigs- the list of ItemListenerConfigs to set
- Returns:
- this collection configuration
 
- 
getTotalBackupCountpublic int getTotalBackupCount()Gets the total number of synchronous and asynchronous backups for this collection.- Returns:
- the total number of synchronous and asynchronous backups for this collection
 
- 
getBackupCountpublic int getBackupCount()Gets the number of synchronous backups for this collection.- Returns:
- the number of synchronous backups for this collection
 
- 
setBackupCountSets the number of synchronous backups for this collection.- Parameters:
- backupCount- the number of synchronous backups to set for this collection
- Returns:
- the current CollectionConfig
- 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.- Parameters:
- asyncBackupCount- the number of asynchronous synchronous backups to set
- Returns:
- the updated CollectionConfig
- Throws:
- IllegalArgumentException- if asyncBackupCount 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:
 
- 
getMaxSizepublic int getMaxSize()Gets the maximum size for the Configuration.- Returns:
- the maximum size for the Configuration
 
- 
setMaxSizeSets the maximum size for the collection.- Returns:
- the current CollectionConfig
 
- 
isStatisticsEnabledpublic boolean isStatisticsEnabled()Checks if collection statistics are enabled.- Returns:
- trueif collection statistics are enabled,- falseotherwise
 
- 
setStatisticsEnabledSets collection statistics to enabled or disabled.- Parameters:
- statisticsEnabled-- trueto enable collection statistics,- falseto disable
- Returns:
- the current collection config instance
 
- 
addItemListenerConfigAdds an item listener to this collection (listens for when items are added or removed).- Parameters:
- itemListenerConfig- the item listener to add to this collection
- Returns:
- this 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 the collection.- Returns:
- the MergePolicyConfigfor the collection
 
- 
setMergePolicyConfigSets theMergePolicyConfigfor the collection.- Returns:
- the current CollectionConfig
 
- 
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<T extends CollectionConfig>
- 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<T extends CollectionConfig>
- Parameters:
- userCodeNamespace- The ID of the Namespace to associate with this structure.
- Returns:
- the updated CollectionConfiginstance
- Since:
- 5.4
 
- 
getFactoryIdpublic int getFactoryId()Description copied from interface:IdentifiedDataSerializableReturns DataSerializableFactory factory ID for this class.- Specified by:
- getFactoryIdin interface- IdentifiedDataSerializable
- Returns:
- factory 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()
- 
fieldsToStringReturns field names with values as concatenated String, so it can be used in child classes' toString() methods.
 
-