public class ClusterNodeInfo extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
ClusterNodeInfo.ClusterNodeState |
static class |
ClusterNodeInfo.RecoverLockState |
| Modifier and Type | Field and Description |
|---|---|
static String |
BROADCAST_ID
The broadcast id.
|
static String |
BROADCAST_LISTENER
The broadcast listener (host:port).
|
static boolean |
DEFAULT_LEASE_CHECK_DISABLED |
static int |
DEFAULT_LEASE_DURATION_MILLIS |
static int |
DEFAULT_LEASE_FAILURE_MARGIN_MILLIS
OAK-3398 : default failure margin 20sec before actual lease timeout
(note that OAK-3399 / MAX_RETRY_SLEEPS_BEFORE_LEASE_FAILURE eats
off another few seconds from this margin, by default 5sec,
so the actual default failure-margin is down to 15sec - and that is high-noon!)
|
static int |
DEFAULT_LEASE_UPDATE_INTERVAL_MILLIS
OAK-3398 : default update interval 10sec
|
static String |
LAST_WRITTEN_ROOT_REV_KEY
The key for the root-revision of the last background write (of unsaved
modifications) - that is: the last root-revision written by the instance
in case of a clear shutdown or via recovery of another instance in case
of a crash
|
static String |
LEASE_END_KEY
The end of the lease.
|
static String |
REV_RECOVERY_BY
Flag indicating which cluster node is running the recovery.
|
static String |
REV_RECOVERY_LOCK
Flag to indicate whether the _lastRev recovery is in progress.
|
static String |
START_TIME_KEY
The start time.
|
static String |
STATE
The state of the cluster.
|
protected static String |
WORKING_DIR
The current working directory.
|
| Modifier and Type | Method and Description |
|---|---|
void |
dispose() |
int |
getId() |
static ClusterNodeInfo |
getInstance(DocumentStore store,
org.apache.jackrabbit.oak.plugins.document.RecoveryHandler recoveryHandler,
String machineId,
String instanceId,
int configuredClusterId)
Get or create a cluster node info instance for the store.
|
long |
getLeaseEndTime() |
long |
getLeaseTime() |
static ClusterNodeInfo |
getReadOnlyInstance(DocumentStore store)
Create a cluster node info instance to be utilized for read only access
to underlying store.
|
void |
performLeaseCheck()
Checks if the lease for this cluster node is still valid, otherwise
throws a
DocumentStoreException. |
boolean |
renewLease()
Renew the cluster id lease.
|
void |
setInfo(Map<String,String> info)
Update the cluster node info.
|
void |
setLeaseFailureHandler(LeaseFailureHandler leaseFailureHandler) |
String |
toString() |
public static final String LEASE_END_KEY
public static final String START_TIME_KEY
public static final String LAST_WRITTEN_ROOT_REV_KEY
public static final String STATE
public static final String BROADCAST_ID
public static final String BROADCAST_LISTENER
public static final String REV_RECOVERY_LOCK
public static final String REV_RECOVERY_BY
protected static String WORKING_DIR
public static final int DEFAULT_LEASE_DURATION_MILLIS
public static final int DEFAULT_LEASE_UPDATE_INTERVAL_MILLIS
public static final int DEFAULT_LEASE_FAILURE_MARGIN_MILLIS
public static final boolean DEFAULT_LEASE_CHECK_DISABLED
public int getId()
public static ClusterNodeInfo getReadOnlyInstance(DocumentStore store)
store - the document store.public static ClusterNodeInfo getInstance(DocumentStore store, org.apache.jackrabbit.oak.plugins.document.RecoveryHandler recoveryHandler, String machineId, String instanceId, int configuredClusterId)
store - the document store (for the lease)recoveryHandler - the recovery handler to call for a clusterId with
an expired lease.machineId - the machine id (null for MAC address)instanceId - the instance id (null for current working directory)configuredClusterId - the configured cluster id (or 0 for dynamic assignment)public void performLeaseCheck()
throws DocumentStoreException
DocumentStoreException. Depending on the
LeaseCheckMode this method will not throw the
exception immediately when the lease expires. If the mode is set to
LeaseCheckMode.LENIENT, then this method will give the lease
update thread a last chance of 5 seconds to renew it. This allows the
DocumentNodeStore to recover from an expired lease caused by a system
put to sleep or a JVM in debug mode.DocumentStoreException - if the lease expired.public boolean renewLease()
throws DocumentStoreException
This method will not fail immediately with a DocumentStoreException if
the lease expired. It will still try to renew the lease and only fail if
performLeaseCheck() decided the lease expired or another cluster
node initiated recover for this node.
true if the lease was renewed; false otherwise.DocumentStoreException - if the operation failed or the lease
expired.public void setInfo(Map<String,String> info)
info - the map of changespublic long getLeaseTime()
public long getLeaseEndTime()
public void setLeaseFailureHandler(LeaseFailureHandler leaseFailureHandler)
public void dispose()
Copyright © 2012–2018 The Apache Software Foundation. All rights reserved.