Class EventJournalConfig
- All Implemented Interfaces:
DataSerializable,IdentifiedDataSerializable
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intDefault value of capacity of the event journal.static final intDefault value for the time to live property. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanintGets the capacity of the event journal.intReturns type identifier for this class.intReturns DataSerializableFactory factory ID for this class.intGets the time to live in seconds.final inthashCode()booleanReturns if the event journal is enabled.voidReads fields from the input streamsetCapacity(int capacity) Sets the capacity of the event journal.setEnabled(boolean enabled) Enables or disables the event journal.setTimeToLiveSeconds(int timeToLiveSeconds) Sets the time to live in seconds.toString()voidWrites object fields to output stream
-
Field Details
-
DEFAULT_CAPACITY
public static final int DEFAULT_CAPACITYDefault value of capacity of the event journal.- See Also:
-
DEFAULT_TTL_SECONDS
public static final int DEFAULT_TTL_SECONDSDefault value for the time to live property.- See Also:
-
-
Constructor Details
-
EventJournalConfig
public EventJournalConfig() -
EventJournalConfig
Clones aEventJournalConfig.- Parameters:
config- the event journal config to clone- Throws:
NullPointerException- if the config is null
-
-
Method Details
-
getCapacity
public int getCapacity()Gets the capacity of the event journal. The capacity is the total number of items that the event journal can hold at any moment. The actual number of items contained in the journal can be lower.NOTE The capacity is shared equally between all partitions. This is done by assigning each partition
getCapacity() / partitionCountavailable slots in the event journal. Because of this, the effective total capacity may be somewhat lower and you must make sure that the configured capacity is at least greater than the partition count.- Returns:
- the capacity.
-
setCapacity
Sets the capacity of the event journal. The capacity is the total number of items that the event journal can hold at any moment. The actual number of items contained in the journal can be lower.NOTE The capacity is shared equally between all partitions. This is done by assigning each partition
getCapacity() / partitionCountavailable slots in the event journal. Because of this, the effective total capacity may be somewhat lower and you must make sure that the configured capacity is at least greater than the partition count.- Parameters:
capacity- the capacity.- Returns:
- the updated config.
- Throws:
IllegalArgumentException- if capacity smaller than 1.- See Also:
-
getTimeToLiveSeconds
public int getTimeToLiveSeconds()Gets the time to live in seconds.- Returns:
- the time to live in seconds. Returns 0 the time to live if the items don't expire.
-
setTimeToLiveSeconds
Sets the time to live in seconds. Time to live is the time the event journal retains items before removing them from the journal. The events are removed on journal read and write actions, not while the journal is idle.Time to live can be disabled by setting timeToLiveSeconds to 0. This means that the events never expire but they can be overwritten when the capacity of the journal is exceeded.
- Parameters:
timeToLiveSeconds- the time to live period in seconds- Returns:
- the updated config
- Throws:
IllegalArgumentException- if timeToLiveSeconds smaller than 0.
-
toString
-
isEnabled
public boolean isEnabled()Returns if the event journal is enabled.- Returns:
trueif the event journal is enabled,falseotherwise
-
setEnabled
Enables or disables the event journal.- Parameters:
enabled-trueif enabled,falseotherwise.- Returns:
- the updated config.
-
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()
-