Class InstanceTrackingConfig
- java.lang.Object
-
- com.hazelcast.config.InstanceTrackingConfig
-
public class InstanceTrackingConfig extends java.lang.Object
Configures tracking of a running Hazelcast instance. For now, this is limited to writing information about the Hazelcast instance to a file while the instance is starting.The file is overwritten on every start of the Hazelcast instance and if multiple instance share the same file system, every instance will overwrite the tracking file of a previously started instance.
If this instance is unable to write the file, the exception is logged and the instance is allowed to start.
- Since:
- 4.1
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
InstanceTrackingConfig.InstanceMode
The mode in which this instance is running.static class
InstanceTrackingConfig.InstanceProductName
Product name for the Hazelcast instancestatic class
InstanceTrackingConfig.InstanceTrackingProperties
Enumeration of instance properties provided to the format pattern for output.
-
Field Summary
Fields Modifier and Type Field Description static java.nio.file.Path
DEFAULT_FILE
Default file to which the instance metadata will be written.static java.lang.String
PLACEHOLDER_NAMESPACE
Namespace for the placeholders in the file name and format pattern to distinguish between different types of placeholders.
-
Constructor Summary
Constructors Constructor Description InstanceTrackingConfig()
InstanceTrackingConfig(InstanceTrackingConfig other)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object o)
java.lang.String
getFileName()
Returns the name of the file which will contain the tracking metadata.java.lang.String
getFormatPattern()
Returns the pattern used to render the contents of the instance tracking file.int
hashCode()
boolean
isEnabled()
Returnstrue
if instance tracking is enabled.InstanceTrackingConfig
setEnabled(boolean enabled)
Enables or disables instance tracking.InstanceTrackingConfig
setFileName(java.lang.String fileName)
Sets the name of the file which will contain the tracking metadata.InstanceTrackingConfig
setFormatPattern(java.lang.String formatPattern)
Sets the pattern used to render the contents of the instance tracking file.java.lang.String
toString()
-
-
-
Field Detail
-
DEFAULT_FILE
public static final java.nio.file.Path DEFAULT_FILE
Default file to which the instance metadata will be written.
-
PLACEHOLDER_NAMESPACE
public static final java.lang.String PLACEHOLDER_NAMESPACE
Namespace for the placeholders in the file name and format pattern to distinguish between different types of placeholders.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
InstanceTrackingConfig
public InstanceTrackingConfig()
-
InstanceTrackingConfig
public InstanceTrackingConfig(InstanceTrackingConfig other)
-
-
Method Detail
-
isEnabled
public boolean isEnabled()
Returnstrue
if instance tracking is enabled.
-
setEnabled
public InstanceTrackingConfig setEnabled(boolean enabled)
Enables or disables instance tracking.- Parameters:
enabled
-true
if instance tracking should be enabled- Returns:
- this configuration
-
getFileName
public java.lang.String getFileName()
Returns the name of the file which will contain the tracking metadata. Ifnull
,DEFAULT_FILE
is used instead.The filename can contain placeholders that will be resolved in the same way as placeholders for the format pattern (see
setFormatPattern(String)
).
-
setFileName
public InstanceTrackingConfig setFileName(java.lang.String fileName)
Sets the name of the file which will contain the tracking metadata. If set tonull
,DEFAULT_FILE
is used instead.The filename can contain placeholders that will be resolved in the same way as placeholders for the format pattern (see
setFormatPattern(String)
).- Parameters:
fileName
- the name of the file to contain the tracking metadata- Returns:
- this configuration
-
getFormatPattern
public java.lang.String getFormatPattern()
Returns the pattern used to render the contents of the instance tracking file. It may contain placeholders for properties listed in theInstanceTrackingConfig.InstanceTrackingProperties
enum. The placeholders are defined by a $HZ_INSTANCE_TRACKING{ prefix and followed by }. For instance, a placeholder for theInstanceTrackingConfig.InstanceTrackingProperties.START_TIMESTAMP
would be $HZ_INSTANCE_TRACKING{start_timestamp}.The placeholders are resolved in a fail-safe manner. Any incorrect syntax is ignored and only the known properties are resolved, placeholders for any parameters which do not have defined values will be ignored. This also means that if there is a missing closing bracket in one of the placeholders, the property name will be resolved as anything from the opening bracket to the next closing bracket, which might contain additional opening brackets.
If set to
null
, a JSON formatted output will be used.- Returns:
- the pattern for the instance tracking file
- See Also:
InstanceTrackingConfig.InstanceTrackingProperties
-
setFormatPattern
public InstanceTrackingConfig setFormatPattern(java.lang.String formatPattern)
Sets the pattern used to render the contents of the instance tracking file. It may contain placeholders for properties listed in theInstanceTrackingConfig.InstanceTrackingProperties
enum. The placeholders are defined by a $HZ_INSTANCE_TRACKING{ prefix and followed by }. For instance, a placeholder for theInstanceTrackingConfig.InstanceTrackingProperties.START_TIMESTAMP
would be $HZ_INSTANCE_TRACKING{start_timestamp}.The placeholders are resolved in a fail-safe manner. Any incorrect syntax is ignored and only the known properties are resolved, placeholders for any parameters which do not have defined values will be ignored. This also means that if there is a missing closing bracket in one of the placeholders, the property name will be resolved as anything from the opening bracket to the next closing bracket, which might contain additional opening brackets.
If set to
null
, a JSON formatted output will be used.- Parameters:
formatPattern
- the pattern for the instance tracking file- Returns:
- this configuration
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-