test_class.declarator: clock
test_class.modifier: private
test_class.original_string: private Clock clock;
test_class.type: Clock
test_class.var_name: clock
test_class.declarator: store
test_class.modifier: private
test_class.original_string: private TestStore store;
test_class.type: TestStore
test_class.var_name: store
test_class.declarator: handler = new FailureHandler()
test_class.modifier: private
test_class.original_string: private FailureHandler handler = new FailureHandler();
test_class.type: FailureHandler
test_class.var_name: handler
test_class.declarator: invisible
test_class.modifier: private
test_class.original_string: private boolean invisible;
test_class.type: boolean
test_class.var_name: invisible
test_class.file: oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/ClusterNodeInfoTest.java
test_class.identifier: ClusterNodeInfoTest
test_case.body: @Test
      public void renewLease() throws Exception {
          ClusterNodeInfo info = newClusterNodeInfo(1);
          long leaseEnd = info.getLeaseEndTime();
          waitLeaseUpdateInterval();
          assertTrue(info.renewLease());
          assertTrue(info.getLeaseEndTime() > leaseEnd);
          assertFalse(handler.isLeaseFailure());
      }
test_case.class_method_signature: ClusterNodeInfoTest.renewLease()
test_case.full_signature: @Test public void renewLease()
test_case.identifier: renewLease
test_case.invocations: newClusterNodeInfo getLeaseEndTime waitLeaseUpdateInterval assertTrue renewLease assertTrue getLeaseEndTime assertFalse isLeaseFailure
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void renewLease()
focal_class.declarator: LEASE_CHECK_FAILED_MSG = "This oak instance failed to update "
              + "the lease in time and can therefore no longer access this DocumentNodeStore."
focal_class.modifier: private static final
focal_class.original_string: private static final String LEASE_CHECK_FAILED_MSG = "This oak instance failed to update "
              + "the lease in time and can therefore no longer access this DocumentNodeStore.";
focal_class.type: String
focal_class.var_name: LEASE_CHECK_FAILED_MSG
focal_class.declarator: LOG = LoggerFactory.getLogger(ClusterNodeInfo.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger LOG = LoggerFactory.getLogger(ClusterNodeInfo.class);
focal_class.type: Logger
focal_class.var_name: LOG
focal_class.declarator: RANDOM_PREFIX = "random:"
focal_class.modifier: private static final
focal_class.original_string: private static final String RANDOM_PREFIX = "random:";
focal_class.type: String
focal_class.var_name: RANDOM_PREFIX
focal_class.declarator: MACHINE_ID_KEY = "machine"
focal_class.modifier: private static final
focal_class.original_string: private static final String MACHINE_ID_KEY = "machine";
focal_class.type: String
focal_class.var_name: MACHINE_ID_KEY
focal_class.declarator: OAK_VERSION_KEY = "oakVersion"
focal_class.modifier: static final
focal_class.original_string: static final String OAK_VERSION_KEY = "oakVersion";
focal_class.type: String
focal_class.var_name: OAK_VERSION_KEY
focal_class.declarator: INSTANCE_ID_KEY = "instance"
focal_class.modifier: private static final
focal_class.original_string: private static final String INSTANCE_ID_KEY = "instance";
focal_class.type: String
focal_class.var_name: INSTANCE_ID_KEY
focal_class.declarator: LEASE_END_KEY = "leaseEnd"
focal_class.modifier: public static final
focal_class.original_string: public static final String LEASE_END_KEY = "leaseEnd";
focal_class.type: String
focal_class.var_name: LEASE_END_KEY
focal_class.declarator: START_TIME_KEY = "startTime"
focal_class.modifier: public static final
focal_class.original_string: public static final String START_TIME_KEY = "startTime";
focal_class.type: String
focal_class.var_name: START_TIME_KEY
focal_class.declarator: LAST_WRITTEN_ROOT_REV_KEY = "lastWrittenRootRev"
focal_class.modifier: public static final
focal_class.original_string: public static final String LAST_WRITTEN_ROOT_REV_KEY = "lastWrittenRootRev";
focal_class.type: String
focal_class.var_name: LAST_WRITTEN_ROOT_REV_KEY
focal_class.declarator: STATE = "state"
focal_class.modifier: public static final
focal_class.original_string: public static final String STATE = "state";
focal_class.type: String
focal_class.var_name: STATE
focal_class.declarator: BROADCAST_ID = "broadcastId"
focal_class.modifier: public static final
focal_class.original_string: public static final String BROADCAST_ID = "broadcastId";
focal_class.type: String
focal_class.var_name: BROADCAST_ID
focal_class.declarator: BROADCAST_LISTENER = "broadcastListener"
focal_class.modifier: public static final
focal_class.original_string: public static final String BROADCAST_LISTENER = "broadcastListener";
focal_class.type: String
focal_class.var_name: BROADCAST_LISTENER
focal_class.declarator: REV_RECOVERY_LOCK = "recoveryLock"
focal_class.modifier: public static final
focal_class.original_string: public static final String REV_RECOVERY_LOCK = "recoveryLock";
focal_class.type: String
focal_class.var_name: REV_RECOVERY_LOCK
focal_class.declarator: REV_RECOVERY_BY = "recoveryBy"
focal_class.modifier: public static final
focal_class.original_string: public static final String REV_RECOVERY_BY = "recoveryBy";
focal_class.type: String
focal_class.var_name: REV_RECOVERY_BY
focal_class.declarator: INFO_KEY = "info"
focal_class.modifier: private static final
focal_class.original_string: private static final String INFO_KEY = "info";
focal_class.type: String
focal_class.var_name: INFO_KEY
focal_class.declarator: READ_WRITE_MODE_KEY = "readWriteMode"
focal_class.modifier: private static final
focal_class.original_string: private static final String READ_WRITE_MODE_KEY = "readWriteMode";
focal_class.type: String
focal_class.var_name: READ_WRITE_MODE_KEY
focal_class.declarator: INVISIBLE = "invisible"
focal_class.modifier: public static final
focal_class.original_string: public static final String INVISIBLE = "invisible";
focal_class.type: String
focal_class.var_name: INVISIBLE
focal_class.declarator: MACHINE_ID = getHardwareMachineId()
focal_class.modifier: private static final
focal_class.original_string: private static final String MACHINE_ID = getHardwareMachineId();
focal_class.type: String
focal_class.var_name: MACHINE_ID
focal_class.declarator: PROCESS_ID = getProcessId()
focal_class.modifier: private static final
focal_class.original_string: private static final long PROCESS_ID = getProcessId();
focal_class.type: long
focal_class.var_name: PROCESS_ID
focal_class.declarator: WORKING_DIR = System.getProperty("user.dir", "")
focal_class.modifier: protected static
focal_class.original_string: protected static String WORKING_DIR = System.getProperty("user.dir", "");
focal_class.type: String
focal_class.var_name: WORKING_DIR
focal_class.declarator: clock = Clock.SIMPLE
focal_class.modifier: private static
focal_class.original_string: private static Clock clock = Clock.SIMPLE;
focal_class.type: Clock
focal_class.var_name: clock
focal_class.declarator: DEFAULT_LEASE_DURATION_SEC = SystemPropertySupplier.create("oak.documentMK.leaseDurationSeconds", 120)
              .loggingTo(LOG).validateWith(value -> value >= 0)
              .formatSetMessage((name, value) -> String.format("Lease duration set to: %ss (using system property %s)", name, value)).get()
focal_class.modifier: private static final
focal_class.original_string: private static final int DEFAULT_LEASE_DURATION_SEC = SystemPropertySupplier.create("oak.documentMK.leaseDurationSeconds", 120)
              .loggingTo(LOG).validateWith(value -> value >= 0)
              .formatSetMessage((name, value) -> String.format("Lease duration set to: %ss (using system property %s)", name, value)).get();
focal_class.type: int
focal_class.var_name: DEFAULT_LEASE_DURATION_SEC
focal_class.declarator: DEFAULT_LEASE_DURATION_MILLIS = 1000 * DEFAULT_LEASE_DURATION_SEC
focal_class.modifier: public static final
focal_class.original_string: public static final int DEFAULT_LEASE_DURATION_MILLIS = 1000 * DEFAULT_LEASE_DURATION_SEC;
focal_class.type: int
focal_class.var_name: DEFAULT_LEASE_DURATION_MILLIS
focal_class.declarator: DEFAULT_LEASE_UPDATE_INTERVAL_MILLIS = 1000 * 10
focal_class.modifier: public static final
focal_class.original_string: public static final int DEFAULT_LEASE_UPDATE_INTERVAL_MILLIS = 1000 * 10;
focal_class.type: int
focal_class.var_name: DEFAULT_LEASE_UPDATE_INTERVAL_MILLIS
focal_class.declarator: DEFAULT_LEASE_FAILURE_MARGIN_MILLIS = 1000 * 20
focal_class.modifier: public static final
focal_class.original_string: public static final int DEFAULT_LEASE_FAILURE_MARGIN_MILLIS = 1000 * 20;
focal_class.type: int
focal_class.var_name: DEFAULT_LEASE_FAILURE_MARGIN_MILLIS
focal_class.declarator: DEFAULT_LEASE_CHECK_DISABLED = SystemPropertySupplier
              .create("oak.documentMK.disableLeaseCheck", Boolean.FALSE).loggingTo(LOG).get()
focal_class.modifier: public static final
focal_class.original_string: public static final boolean DEFAULT_LEASE_CHECK_DISABLED = SystemPropertySupplier
              .create("oak.documentMK.disableLeaseCheck", Boolean.FALSE).loggingTo(LOG).get();
focal_class.type: boolean
focal_class.var_name: DEFAULT_LEASE_CHECK_DISABLED
focal_class.declarator: DEFAULT_LEASE_CHECK_MODE =
              DEFAULT_LEASE_CHECK_DISABLED ? LeaseCheckMode.DISABLED : LeaseCheckMode.STRICT
focal_class.modifier: static final
focal_class.original_string: static final LeaseCheckMode DEFAULT_LEASE_CHECK_MODE =
              DEFAULT_LEASE_CHECK_DISABLED ? LeaseCheckMode.DISABLED : LeaseCheckMode.STRICT;
focal_class.type: LeaseCheckMode
focal_class.var_name: DEFAULT_LEASE_CHECK_MODE
focal_class.declarator: MAX_RETRY_SLEEPS_BEFORE_LEASE_FAILURE = 5
focal_class.modifier: private static final
focal_class.original_string: private static final int MAX_RETRY_SLEEPS_BEFORE_LEASE_FAILURE = 5;
focal_class.type: int
focal_class.var_name: MAX_RETRY_SLEEPS_BEFORE_LEASE_FAILURE
focal_class.declarator: OAK_VERSION = getModuleVersion()
focal_class.modifier: private static final
focal_class.original_string: private static final String OAK_VERSION = getModuleVersion();
focal_class.type: String
focal_class.var_name: OAK_VERSION
focal_class.declarator: leaseTime = DEFAULT_LEASE_DURATION_MILLIS
focal_class.modifier: private
focal_class.original_string: private long leaseTime = DEFAULT_LEASE_DURATION_MILLIS;
focal_class.type: long
focal_class.var_name: leaseTime
focal_class.declarator: leaseUpdateInterval = DEFAULT_LEASE_UPDATE_INTERVAL_MILLIS
focal_class.modifier: private
focal_class.original_string: private long leaseUpdateInterval = DEFAULT_LEASE_UPDATE_INTERVAL_MILLIS;
focal_class.type: long
focal_class.var_name: leaseUpdateInterval
focal_class.declarator: leaseFailureMargin = DEFAULT_LEASE_FAILURE_MARGIN_MILLIS
focal_class.modifier: private
focal_class.original_string: private long leaseFailureMargin = DEFAULT_LEASE_FAILURE_MARGIN_MILLIS;
focal_class.type: long
focal_class.var_name: leaseFailureMargin
focal_class.declarator: id
focal_class.modifier: private final
focal_class.original_string: private final int id;
focal_class.type: int
focal_class.var_name: id
focal_class.declarator: machineId
focal_class.modifier: private final
focal_class.original_string: private final String machineId;
focal_class.type: String
focal_class.var_name: machineId
focal_class.declarator: instanceId
focal_class.modifier: private final
focal_class.original_string: private final String instanceId;
focal_class.type: String
focal_class.var_name: instanceId
focal_class.declarator: store
focal_class.modifier: private final
focal_class.original_string: private final DocumentStore store;
focal_class.type: DocumentStore
focal_class.var_name: store
focal_class.declarator: startTime
focal_class.modifier: private final
focal_class.original_string: private final long startTime;
focal_class.type: long
focal_class.var_name: startTime
focal_class.declarator: uuid = UUID.randomUUID().toString()
focal_class.modifier: private final
focal_class.original_string: private final String uuid = UUID.randomUUID().toString();
focal_class.type: String
focal_class.var_name: uuid
focal_class.declarator: leaseEndTime
focal_class.modifier: private volatile
focal_class.original_string: private volatile long leaseEndTime;
focal_class.type: long
focal_class.var_name: leaseEndTime
focal_class.declarator: previousLeaseEndTime
focal_class.modifier: private
focal_class.original_string: private long previousLeaseEndTime;
focal_class.type: long
focal_class.var_name: previousLeaseEndTime
focal_class.declarator: readWriteMode
focal_class.modifier: private
focal_class.original_string: private String readWriteMode;
focal_class.type: String
focal_class.var_name: readWriteMode
focal_class.declarator: state = ACTIVE
focal_class.modifier: private
focal_class.original_string: private ClusterNodeState state = ACTIVE;
focal_class.type: ClusterNodeState
focal_class.var_name: state
focal_class.declarator: leaseCheckFailed = false
focal_class.modifier: private
focal_class.original_string: private boolean leaseCheckFailed = false;
focal_class.type: boolean
focal_class.var_name: leaseCheckFailed
focal_class.declarator: leaseCheckMode = DEFAULT_LEASE_CHECK_MODE
focal_class.modifier: private
focal_class.original_string: private LeaseCheckMode leaseCheckMode = DEFAULT_LEASE_CHECK_MODE;
focal_class.type: LeaseCheckMode
focal_class.var_name: leaseCheckMode
focal_class.declarator: newEntry
focal_class.modifier: private
focal_class.original_string: private boolean newEntry;
focal_class.type: boolean
focal_class.var_name: newEntry
focal_class.declarator: leaseFailureHandler
focal_class.modifier: private
focal_class.original_string: private LeaseFailureHandler leaseFailureHandler;
focal_class.type: LeaseFailureHandler
focal_class.var_name: leaseFailureHandler
focal_class.declarator: invisible
focal_class.modifier: private
focal_class.original_string: private boolean invisible;
focal_class.type: boolean
focal_class.var_name: invisible
focal_class.file: oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/ClusterNodeInfo.java
focal_class.identifier: ClusterNodeInfo
focal_class.class_method_signature: ClusterNodeInfo.ClusterNodeInfo(int id, DocumentStore store, String machineId,
                              String instanceId, boolean newEntry, boolean invisible)
focal_class.full_signature: private  ClusterNodeInfo(int id, DocumentStore store, String machineId,
                              String instanceId, boolean newEntry, boolean invisible)
focal_class.identifier: ClusterNodeInfo
focal_class.modifiers: private
focal_class.parameters: (int id, DocumentStore store, String machineId,
                              String instanceId, boolean newEntry, boolean invisible)
focal_class.signature:  ClusterNodeInfo(int id, DocumentStore store, String machineId,
                              String instanceId, boolean newEntry, boolean invisible)
focal_class.class_method_signature: ClusterNodeInfo.setLeaseCheckMode(@NotNull LeaseCheckMode mode)
focal_class.full_signature:  void setLeaseCheckMode(@NotNull LeaseCheckMode mode)
focal_class.identifier: setLeaseCheckMode
focal_class.parameters: (@NotNull LeaseCheckMode mode)
focal_class.return: void
focal_class.signature: void setLeaseCheckMode(@NotNull LeaseCheckMode mode)
focal_class.class_method_signature: ClusterNodeInfo.getLeaseCheckMode()
focal_class.full_signature:  LeaseCheckMode getLeaseCheckMode()
focal_class.identifier: getLeaseCheckMode
focal_class.parameters: ()
focal_class.return: LeaseCheckMode
focal_class.signature: LeaseCheckMode getLeaseCheckMode()
focal_class.class_method_signature: ClusterNodeInfo.getId()
focal_class.full_signature: public int getId()
focal_class.identifier: getId
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: int
focal_class.signature: int getId()
focal_class.class_method_signature: ClusterNodeInfo.getMachineId()
focal_class.full_signature:  String getMachineId()
focal_class.identifier: getMachineId
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String getMachineId()
focal_class.class_method_signature: ClusterNodeInfo.getInstanceId()
focal_class.full_signature:  String getInstanceId()
focal_class.identifier: getInstanceId
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String getInstanceId()
focal_class.class_method_signature: ClusterNodeInfo.isInvisible()
focal_class.full_signature:  boolean isInvisible()
focal_class.identifier: isInvisible
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean isInvisible()
focal_class.class_method_signature: ClusterNodeInfo.getReadOnlyInstance(DocumentStore store)
focal_class.full_signature: public static ClusterNodeInfo getReadOnlyInstance(DocumentStore store)
focal_class.identifier: getReadOnlyInstance
focal_class.modifiers: public static
focal_class.parameters: (DocumentStore store)
focal_class.return: ClusterNodeInfo
focal_class.signature: ClusterNodeInfo getReadOnlyInstance(DocumentStore store)
focal_class.class_method_signature: ClusterNodeInfo.getInstance(DocumentStore store,
          RecoveryHandler recoveryHandler,
          String machineId,
          String instanceId,
          int configuredClusterId)
focal_class.full_signature: public static ClusterNodeInfo getInstance(DocumentStore store,
          RecoveryHandler recoveryHandler,
          String machineId,
          String instanceId,
          int configuredClusterId)
focal_class.identifier: getInstance
focal_class.modifiers: public static
focal_class.parameters: (DocumentStore store,
          RecoveryHandler recoveryHandler,
          String machineId,
          String instanceId,
          int configuredClusterId)
focal_class.return: ClusterNodeInfo
focal_class.signature: ClusterNodeInfo getInstance(DocumentStore store,
          RecoveryHandler recoveryHandler,
          String machineId,
          String instanceId,
          int configuredClusterId)
focal_class.class_method_signature: ClusterNodeInfo.getInstance(DocumentStore store,
                                                RecoveryHandler recoveryHandler,
                                                String machineId,
                                                String instanceId,
                                                int configuredClusterId,
                                                boolean invisible)
focal_class.full_signature: public static ClusterNodeInfo getInstance(DocumentStore store,
                                                RecoveryHandler recoveryHandler,
                                                String machineId,
                                                String instanceId,
                                                int configuredClusterId,
                                                boolean invisible)
focal_class.identifier: getInstance
focal_class.modifiers: public static
focal_class.parameters: (DocumentStore store,
                                                RecoveryHandler recoveryHandler,
                                                String machineId,
                                                String instanceId,
                                                int configuredClusterId,
                                                boolean invisible)
focal_class.return: ClusterNodeInfo
focal_class.signature: ClusterNodeInfo getInstance(DocumentStore store,
                                                RecoveryHandler recoveryHandler,
                                                String machineId,
                                                String instanceId,
                                                int configuredClusterId,
                                                boolean invisible)
focal_class.class_method_signature: ClusterNodeInfo.createInstance(DocumentStore store,
                                                                     RecoveryHandler recoveryHandler,
                                                                     String machineId,
                                                                     String instanceId,
                                                                     int configuredClusterId,
                                                                     boolean waitForLease,
                                                                     boolean invisible)
focal_class.full_signature: private static Map.Entry<ClusterNodeInfo, Long> createInstance(DocumentStore store,
                                                                     RecoveryHandler recoveryHandler,
                                                                     String machineId,
                                                                     String instanceId,
                                                                     int configuredClusterId,
                                                                     boolean waitForLease,
                                                                     boolean invisible)
focal_class.identifier: createInstance
focal_class.modifiers: private static
focal_class.parameters: (DocumentStore store,
                                                                     RecoveryHandler recoveryHandler,
                                                                     String machineId,
                                                                     String instanceId,
                                                                     int configuredClusterId,
                                                                     boolean waitForLease,
                                                                     boolean invisible)
focal_class.return: Map.Entry<ClusterNodeInfo, Long>
focal_class.signature: Map.Entry<ClusterNodeInfo, Long> createInstance(DocumentStore store,
                                                                     RecoveryHandler recoveryHandler,
                                                                     String machineId,
                                                                     String instanceId,
                                                                     int configuredClusterId,
                                                                     boolean waitForLease,
                                                                     boolean invisible)
focal_class.class_method_signature: ClusterNodeInfo.logClusterIdAcquired(ClusterNodeInfo clusterNode,
                                               ClusterNodeInfoDocument before)
focal_class.full_signature: private static void logClusterIdAcquired(ClusterNodeInfo clusterNode,
                                               ClusterNodeInfoDocument before)
focal_class.identifier: logClusterIdAcquired
focal_class.modifiers: private static
focal_class.parameters: (ClusterNodeInfo clusterNode,
                                               ClusterNodeInfoDocument before)
focal_class.return: void
focal_class.signature: void logClusterIdAcquired(ClusterNodeInfo clusterNode,
                                               ClusterNodeInfoDocument before)
focal_class.class_method_signature: ClusterNodeInfo.reject(int id, String reason)
focal_class.full_signature: private static String reject(int id, String reason)
focal_class.identifier: reject
focal_class.modifiers: private static
focal_class.parameters: (int id, String reason)
focal_class.return: String
focal_class.signature: String reject(int id, String reason)
focal_class.class_method_signature: ClusterNodeInfo.waitForLeaseExpiry(DocumentStore store, ClusterNodeInfoDocument cdoc, long leaseEnd, String machineId,
              String instanceId)
focal_class.full_signature: private static boolean waitForLeaseExpiry(DocumentStore store, ClusterNodeInfoDocument cdoc, long leaseEnd, String machineId,
              String instanceId)
focal_class.identifier: waitForLeaseExpiry
focal_class.modifiers: private static
focal_class.parameters: (DocumentStore store, ClusterNodeInfoDocument cdoc, long leaseEnd, String machineId,
              String instanceId)
focal_class.return: boolean
focal_class.signature: boolean waitForLeaseExpiry(DocumentStore store, ClusterNodeInfoDocument cdoc, long leaseEnd, String machineId,
              String instanceId)
focal_class.class_method_signature: ClusterNodeInfo.performLeaseCheck()
focal_class.full_signature: public void performLeaseCheck()
focal_class.identifier: performLeaseCheck
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void performLeaseCheck()
focal_class.class_method_signature: ClusterNodeInfo.isLeaseExpired(long time)
focal_class.full_signature: private boolean isLeaseExpired(long time)
focal_class.identifier: isLeaseExpired
focal_class.modifiers: private
focal_class.parameters: (long time)
focal_class.return: boolean
focal_class.signature: boolean isLeaseExpired(long time)
focal_class.class_method_signature: ClusterNodeInfo.handleLeaseFailure(final String errorMsg)
focal_class.full_signature: private void handleLeaseFailure(final String errorMsg)
focal_class.identifier: handleLeaseFailure
focal_class.modifiers: private
focal_class.parameters: (final String errorMsg)
focal_class.return: void
focal_class.signature: void handleLeaseFailure(final String errorMsg)
focal_class.class_method_signature: ClusterNodeInfo.renewLease()
focal_class.full_signature: public boolean renewLease()
focal_class.identifier: renewLease
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean renewLease()
focal_class.class_method_signature: ClusterNodeInfo.setInfo(Map<String, String> info)
focal_class.full_signature: public void setInfo(Map<String, String> info)
focal_class.identifier: setInfo
focal_class.modifiers: public
focal_class.parameters: (Map<String, String> info)
focal_class.return: void
focal_class.signature: void setInfo(Map<String, String> info)
focal_class.class_method_signature: ClusterNodeInfo.setLeaseTime(long leaseTime)
focal_class.full_signature:  void setLeaseTime(long leaseTime)
focal_class.identifier: setLeaseTime
focal_class.parameters: (long leaseTime)
focal_class.return: void
focal_class.signature: void setLeaseTime(long leaseTime)
focal_class.class_method_signature: ClusterNodeInfo.setLeaseUpdateInterval(long leaseUpdateInterval)
focal_class.full_signature:  void setLeaseUpdateInterval(long leaseUpdateInterval)
focal_class.identifier: setLeaseUpdateInterval
focal_class.parameters: (long leaseUpdateInterval)
focal_class.return: void
focal_class.signature: void setLeaseUpdateInterval(long leaseUpdateInterval)
focal_class.class_method_signature: ClusterNodeInfo.getLeaseTime()
focal_class.full_signature: public long getLeaseTime()
focal_class.identifier: getLeaseTime
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: long
focal_class.signature: long getLeaseTime()
focal_class.class_method_signature: ClusterNodeInfo.getLeaseEndTime()
focal_class.full_signature: public long getLeaseEndTime()
focal_class.identifier: getLeaseEndTime
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: long
focal_class.signature: long getLeaseEndTime()
focal_class.class_method_signature: ClusterNodeInfo.setLeaseFailureHandler(LeaseFailureHandler leaseFailureHandler)
focal_class.full_signature: public void setLeaseFailureHandler(LeaseFailureHandler leaseFailureHandler)
focal_class.identifier: setLeaseFailureHandler
focal_class.modifiers: public
focal_class.parameters: (LeaseFailureHandler leaseFailureHandler)
focal_class.return: void
focal_class.signature: void setLeaseFailureHandler(LeaseFailureHandler leaseFailureHandler)
focal_class.class_method_signature: ClusterNodeInfo.dispose()
focal_class.full_signature: public void dispose()
focal_class.identifier: dispose
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void dispose()
focal_class.class_method_signature: ClusterNodeInfo.toString()
focal_class.full_signature: @Override public String toString()
focal_class.identifier: toString
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String toString()
focal_class.class_method_signature: ClusterNodeInfo.setClock(Clock c)
focal_class.full_signature: static void setClock(Clock c)
focal_class.identifier: setClock
focal_class.modifiers: static
focal_class.parameters: (Clock c)
focal_class.return: void
focal_class.signature: void setClock(Clock c)
focal_class.class_method_signature: ClusterNodeInfo.resetClockToDefault()
focal_class.full_signature: static void resetClockToDefault()
focal_class.identifier: resetClockToDefault
focal_class.modifiers: static
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void resetClockToDefault()
focal_class.class_method_signature: ClusterNodeInfo.getProcessId()
focal_class.full_signature: private static long getProcessId()
focal_class.identifier: getProcessId
focal_class.modifiers: private static
focal_class.parameters: ()
focal_class.return: long
focal_class.signature: long getProcessId()
focal_class.class_method_signature: ClusterNodeInfo.getHWAFromSystemProperty()
focal_class.full_signature: private static String getHWAFromSystemProperty()
focal_class.identifier: getHWAFromSystemProperty
focal_class.modifiers: private static
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String getHWAFromSystemProperty()
focal_class.class_method_signature: ClusterNodeInfo.getHardwareMachineId()
focal_class.full_signature: private static String getHardwareMachineId()
focal_class.identifier: getHardwareMachineId
focal_class.modifiers: private static
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String getHardwareMachineId()
focal_class.class_method_signature: ClusterNodeInfo.getCurrentTime()
focal_class.full_signature: private static long getCurrentTime()
focal_class.identifier: getCurrentTime
focal_class.modifiers: private static
focal_class.parameters: ()
focal_class.return: long
focal_class.signature: long getCurrentTime()
focal_class.class_method_signature: ClusterNodeInfo.leaseExpired(String msg, boolean log)
focal_class.full_signature: private static DocumentStoreException leaseExpired(String msg, boolean log)
focal_class.identifier: leaseExpired
focal_class.modifiers: private static
focal_class.parameters: (String msg, boolean log)
focal_class.return: DocumentStoreException
focal_class.signature: DocumentStoreException leaseExpired(String msg, boolean log)
focal_class.class_method_signature: ClusterNodeInfo.asISO8601(long ms)
focal_class.full_signature: private static String asISO8601(long ms)
focal_class.identifier: asISO8601
focal_class.modifiers: private static
focal_class.parameters: (long ms)
focal_class.return: String
focal_class.signature: String asISO8601(long ms)
focal_method.body: public boolean renewLease() throws DocumentStoreException {
          long now = getCurrentTime();
  
          if (LOG.isTraceEnabled()) {
              LOG.trace("renewLease - leaseEndTime: " + leaseEndTime + ", leaseTime: " + leaseTime + ", leaseUpdateInterval: " + leaseUpdateInterval);
          }
  
          if (now < leaseEndTime - leaseTime + leaseUpdateInterval) {
              // no need to renew the lease - it is still within 'leaseUpdateInterval'
              return false;
          }
          // lease requires renewal
  
          long updatedLeaseEndTime;
          synchronized(this) {
              // this is synchronized since access to leaseCheckFailed and leaseEndTime
              // are both normally synchronized to propagate values between renewLease()
              // and performLeaseCheck().
              // (there are unsynchronized accesses to both of these as well - however
              // they are both double-checked - and with both reading a stale value is thus OK)
  
              if (leaseCheckFailed) {
                  // prevent lease renewal after it failed
                  throw leaseExpired(LEASE_CHECK_FAILED_MSG + " (since " + asISO8601(leaseEndTime) + ")", true);
              }
              // synchronized could have delayed the 'now', so
              // set it again..
              now = getCurrentTime();
              updatedLeaseEndTime = now + leaseTime;
          }
  
          if (leaseCheckMode == LeaseCheckMode.STRICT) {
              // check whether the lease is still valid and can be renewed
              if (isLeaseExpired(now)) {
                  synchronized (this) {
                      if (leaseCheckFailed) {
                          // some other thread already noticed and calls failure handler
                          throw leaseExpired(LEASE_CHECK_FAILED_MSG + " (since " + asISO8601(leaseEndTime) + ")", true);
                      }
                      // current thread calls failure handler
                      // outside synchronized block
                      leaseCheckFailed = true;
                  }
                  String template = "%s (mode: %s, leaseEndTime: %d (%s), leaseTime: %d, leaseFailureMargin: %d, "
                          + "lease check end time (leaseEndTime - leaseFailureMargin): %d (%s), now: %d (%s), remaining: %d)"
                          + " Need to stop oak-store-document/DocumentNodeStoreService.";
                  String errorMsg = String.format(template, LEASE_CHECK_FAILED_MSG, leaseCheckMode.name(), leaseEndTime,
                          asISO8601(leaseEndTime), leaseTime, leaseFailureMargin, leaseEndTime - leaseFailureMargin,
                          asISO8601(leaseEndTime - leaseFailureMargin), now, asISO8601(now), (leaseEndTime - leaseFailureMargin) - now);
                  LOG.error(errorMsg);
                  handleLeaseFailure(errorMsg);
                  // should never be reached: handleLeaseFailure throws a DocumentStoreException
                  return false;
              }
          }
  
          UpdateOp update = new UpdateOp("" + id, false);
          update.set(LEASE_END_KEY, updatedLeaseEndTime);
  
          if (leaseCheckMode != LeaseCheckMode.DISABLED) {
              // if leaseCheckDisabled, then we just update the lease without
              // checking
              // OAK-3398:
              // if we renewed the lease ever with this instance/ClusterNodeInfo
              // (which is the normal case.. except for startup),
              // then we can now make an assertion that the lease is unchanged
              // and the incremental update must only succeed if no-one else
              // did a recover/inactivation in the meantime
              // make three assertions: the leaseEnd must match ..
              update.equals(LEASE_END_KEY, null, previousLeaseEndTime);
              // plus it must still be active ..
              update.equals(STATE, null, ACTIVE.name());
              // plus it must not have a recovery lock on it
              update.notEquals(REV_RECOVERY_LOCK, ACQUIRED.name());
              // @TODO: to make it 100% failure proof we could introduce
              // yet another field to clusterNodes: a runtimeId that we
              // create (UUID) at startup each time - and against that
              // we could also check here - but that goes a bit far IMO
          }
  
          if (LOG.isDebugEnabled()) {
              LOG.debug("Renewing lease for cluster id " + id + " with UpdateOp " + update);
          }
          Stopwatch sw = Stopwatch.createStarted();
          DocumentStoreException dse;
          Object result = null;
          try {
              ClusterNodeInfoDocument doc = store.findAndUpdate(Collection.CLUSTER_NODES, update);
              result = doc;
  
              if (doc == null) { // should not occur when leaseCheckDisabled
                  // OAK-3398 : someone else either started recovering or is already through with that.
                  // in both cases the local instance lost the lease-update-game - and hence
                  // should behave and must consider itself as 'lease failed'
  
                  synchronized(this) {
                      if (leaseCheckFailed) {
                          // somehow the instance figured out otherwise that the
                          // lease check failed - so we don't have to too - so we just log/throw
                          throw leaseExpired(LEASE_CHECK_FAILED_MSG, true);
                      }
                      leaseCheckFailed = true; // make sure only one thread 'wins', ie goes any further
                  }
  
                  String errorMsg = LEASE_CHECK_FAILED_MSG
                          + " (Could not update lease anymore, someone else in the cluster "
                          + "must have noticed this instance' slowness already. "
                          + "Going to invoke leaseFailureHandler!)";
  
                  // try to add more diagnostics
                  try {
                      ClusterNodeInfoDocument current = store.find(Collection.CLUSTER_NODES, "" + id);
                      if (current != null) {
                          Object leaseEnd = current.get(LEASE_END_KEY);
                          Object recoveryLock = current.get(REV_RECOVERY_LOCK);
                          Object recoveryBy = current.get(REV_RECOVERY_BY);
                          Object cnState = current.get(STATE);
                          errorMsg += " (leaseEnd: " + leaseEnd + " (expected: " + leaseEndTime + ")" +
                                  ", (state: " + cnState + " (expected: " + ACTIVE.name() + ")" +
                                  ", recoveryLock: " + recoveryLock +
                                  ", recoveryBy: " + recoveryBy + ")";
                      }
                  } catch (DocumentStoreException ex) {
                      LOG.error("trying to read ClusterNodeInfo for cluster id " + id, ex);
                  }
  
                  LOG.error(errorMsg);
  
                  handleLeaseFailure(errorMsg);
                  // should never be reached: handleLeaseFailure throws a DocumentStoreException
                  return false;
              }
              leaseEndTime = updatedLeaseEndTime;
              previousLeaseEndTime = leaseEndTime; // store previousLeaseEndTime for reference for next time
              String mode = (String) doc.get(READ_WRITE_MODE_KEY);
              if (mode != null && !mode.equals(readWriteMode)) {
                  readWriteMode = mode;
                  store.setReadWriteMode(mode);
              }
              return true;
          } catch (DocumentStoreException e) {
              dse = e;
              result = e.toString();
          } finally {
              sw.stop();
              String msg = "Lease renewal for cluster id {} took {}, resulted in: {}";
              if (sw.elapsed(TimeUnit.SECONDS) > 10) {
                  LOG.warn(msg, id, sw, result);
              } else if (sw.elapsed(TimeUnit.SECONDS) > 1) {
                  LOG.info(msg, id, sw, result);
              } else if (LOG.isDebugEnabled()) {
                  LOG.debug(msg, id, sw, result);
              }
          }
          // if we get here, the update failed with an exception, try to read the
          // current cluster node info document and update leaseEndTime &
          // previousLeaseEndTime accordingly until leaseEndTime is reached
          while (getCurrentTime() < updatedLeaseEndTime) {
              synchronized (this) {
                  if (leaseCheckFailed) {
                      // no need to read from store, lease check already failed
                      break;
                  }
              }
              long t1 = clock.getTime();
              ClusterNodeInfoDocument doc;
              try {
                  doc = store.find(Collection.CLUSTER_NODES, String.valueOf(id));
              } catch (DocumentStoreException e) {
                  LOG.warn("Reading ClusterNodeInfoDocument for id " + id + " failed", e);
                  // do not retry more than once a second
                  try {
                      clock.waitUntil(t1 + 1000);
                  } catch (InterruptedException iex) {
                      // ignore
                  }
                  continue;
              }
              if (doc != null) {
                  if (!doc.isActive()) {
                      LOG.warn("ClusterNodeInfoDocument for id {} is not active " +
                              "anymore. {}", id, doc);
                      // break here and let the next lease update attempt fail
                      break;
                  } else if (doc.getLeaseEndTime() == previousLeaseEndTime
                          || doc.getLeaseEndTime() == updatedLeaseEndTime) {
                      // set lease end times to current values
                      previousLeaseEndTime = doc.getLeaseEndTime();
                      leaseEndTime = doc.getLeaseEndTime();
                      break;
                  } else {
                      // leaseEndTime is neither the previous nor the new value
                      // another cluster node must have updated the leaseEndTime
                      // break here and let the next lease update attempt fail
                      break;
                  }
              } else {
                  LOG.warn("ClusterNodeInfoDocument for id {} does not exist anymore", id);
                  break;
              }
          }
          throw dse;
      }
focal_method.class_method_signature: ClusterNodeInfo.renewLease()
focal_method.full_signature: public boolean renewLease()
focal_method.identifier: renewLease
focal_method.invocations: getCurrentTime isTraceEnabled trace leaseExpired asISO8601 getCurrentTime isLeaseExpired leaseExpired asISO8601 format name asISO8601 asISO8601 asISO8601 error handleLeaseFailure set equals equals name notEquals name isDebugEnabled debug createStarted findAndUpdate leaseExpired find get get get get name error error handleLeaseFailure get equals setReadWriteMode toString stop elapsed warn elapsed info isDebugEnabled debug getCurrentTime getTime find valueOf warn waitUntil isActive warn getLeaseEndTime getLeaseEndTime getLeaseEndTime getLeaseEndTime warn
focal_method.modifiers: public
focal_method.parameters: ()
focal_method.return: boolean
focal_method.signature: boolean renewLease()