public final class ClusterStateManager extends Object
Global state manager for Sentinel cluster. This enables switching between cluster token client and server mode.
| Modifier and Type | Field and Description |
|---|---|
static int |
CLUSTER_CLIENT |
static int |
CLUSTER_NOT_STARTED |
static int |
CLUSTER_SERVER |
| Constructor and Description |
|---|
ClusterStateManager() |
| Modifier and Type | Method and Description |
|---|---|
static void |
applyState(Integer state)
Apply given state to cluster mode.
|
static long |
getLastModified() |
static int |
getMode() |
static boolean |
isClient() |
static boolean |
isServer() |
static void |
markToServer() |
static void |
registerProperty(SentinelProperty<Integer> property) |
static boolean |
setToClient()
Set current mode to client mode.
|
static boolean |
setToServer()
Set current mode to server mode.
|
public static final int CLUSTER_CLIENT
public static final int CLUSTER_SERVER
public static final int CLUSTER_NOT_STARTED
public static void registerProperty(SentinelProperty<Integer> property)
public static int getMode()
public static boolean isClient()
public static boolean isServer()
public static boolean setToClient()
Set current mode to client mode. If Sentinel currently works in server mode, it will be turned off. Then the cluster client will be started.
public static boolean setToServer()
Set current mode to server mode. If Sentinel currently works in client mode, it will be turned off. Then the cluster server will be started.
public static long getLastModified()
public static void applyState(Integer state)
state - valid state to applypublic static void markToServer()
Copyright © 2021 Alibaba Group. All rights reserved.