Package com.hazelcast.kubernetes
Class RuntimeContext
java.lang.Object
com.hazelcast.kubernetes.RuntimeContext
Models the state of a Kubernetes StatefulSet(s).
Note that this class is not thread-safe when instantiated using
RuntimeContext()
or
RuntimeContext(RuntimeContext)
.
RuntimeContext(int, int, int, String)
models a single StatefulSet.-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final long
Deprecated, for removal: This API element is subject to removal in a future version. -
Constructor Summary
ConstructorsConstructorDescriptionCreates aRuntimeContext(int, int, int, java.lang.String)
that can track the state of multiple StatefulSets.RuntimeContext
(int specifiedReplicaCount, int readyReplicas, int currentReplicas, String resourceVersion) Deprecated, for removal: This API element is subject to removal in a future version.RuntimeContext
(RuntimeContext context) Creates aRuntimeContext(int, int, int, java.lang.String)
whose state is derived from anotherRuntimeContext(int, int, int, java.lang.String)
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addStatefulSetInfo
(String name, RuntimeContext.StatefulSetInfo info, String resourceVersion) Adds or updates StatefulSet information in this context.int
Returns the total number of current replicas.int
Returns the total number of ready replicas.Returns the last resource version specified viaaddStatefulSetInfo(java.lang.String, com.hazelcast.kubernetes.RuntimeContext.StatefulSetInfo, java.lang.String)
.int
Returns the total number of specified replicas.int
Returns the number of StatefulSets tracked by this context.toString()
-
Field Details
-
UNKNOWN
Deprecated, for removal: This API element is subject to removal in a future version.Unknown value- See Also:
-
-
Constructor Details
-
RuntimeContext
public RuntimeContext()Creates aRuntimeContext(int, int, int, java.lang.String)
that can track the state of multiple StatefulSets. The createdRuntimeContext(int, int, int, java.lang.String)
is not thread-safe.- Since:
- 5.6
-
RuntimeContext
Creates aRuntimeContext(int, int, int, java.lang.String)
whose state is derived from anotherRuntimeContext(int, int, int, java.lang.String)
. The createdRuntimeContext(int, int, int, java.lang.String)
is not thread-safe.- Throws:
UnsupportedOperationException
- when copying aRuntimeContext(int, int, int, java.lang.String)
created usingRuntimeContext(int, int, int, String)
.- Since:
- 5.6
-
RuntimeContext
@Deprecated(forRemoval=true, since="5.6") public RuntimeContext(int specifiedReplicaCount, int readyReplicas, int currentReplicas, @Nullable String resourceVersion) Deprecated, for removal: This API element is subject to removal in a future version.UseRuntimeContext()
andaddStatefulSetInfo(String, StatefulSetInfo, String)
instead. This constructor is provided for backward compatibility only.Creates a
RuntimeContext(int, int, int, java.lang.String)
that can model a single StatefulSet. The createdRuntimeContext(int, int, int, java.lang.String)
is thread-safe. The view of state returned by this constructor supports the following API:All other method invocations will throw
UnsupportedOperationException
.
-
-
Method Details
-
getSpecifiedReplicaCount
public int getSpecifiedReplicaCount()Returns the total number of specified replicas. If the context is empty, returns -1. -
getReadyReplicas
public int getReadyReplicas()Returns the total number of ready replicas. If the context is empty, returns -1. -
getCurrentReplicas
public int getCurrentReplicas()Returns the total number of current replicas. If the context is empty, returns -1. -
getResourceVersion
Returns the last resource version specified viaaddStatefulSetInfo(java.lang.String, com.hazelcast.kubernetes.RuntimeContext.StatefulSetInfo, java.lang.String)
. -
getStatefulSetCount
public int getStatefulSetCount()Returns the number of StatefulSets tracked by this context.- Returns:
- the number of StatefulSets
- Throws:
UnsupportedOperationException
- when theRuntimeContext(int, int, int, java.lang.String)
was created usingRuntimeContext(int, int, int, String)
.- Since:
- 5.6
-
addStatefulSetInfo
public void addStatefulSetInfo(String name, @Nonnull RuntimeContext.StatefulSetInfo info, String resourceVersion) Adds or updates StatefulSet information in this context.- Parameters:
name
- the name of the StatefulSetinfo
- the StatefulSet informationresourceVersion
- the resource version- Throws:
UnsupportedOperationException
- when theRuntimeContext(int, int, int, java.lang.String)
was created usingRuntimeContext(int, int, int, String)
.- Since:
- 5.6
-
toString
-
RuntimeContext()
andaddStatefulSetInfo(String, StatefulSetInfo, String)
instead.