mirror of
https://github.com/OpenHFT/Chronicle-Map.git
synced 2021-09-13 01:26:12 +00:00
BigSegmentHeader: system property to specify LOCK_TIMEOUT_SECONDS
The default of 60 seconds may be too long if using Chronicle-Map in a way that prevents real interprocess dead locks, i.e. InterProcessDeadLockException can only be raised if a previous Chronicle-Map process has been killed while holding a lock. In this case, a timeout of e.g 5 seconds (or less) is sufficient to detect the problem and possibly decide to invoke a recovery.
This commit is contained in:
@@ -52,11 +52,21 @@ public final class BigSegmentHeader implements SegmentHeader {
|
||||
|
||||
private static final int TRY_LOCK_NANOS_THRESHOLD = 2_000_000;
|
||||
|
||||
/**
|
||||
* Previously this value was 2 seconds, but GC pauses often take more time that shouldn't
|
||||
* result to InterProcessDeadLockException.
|
||||
*/
|
||||
public static final int LOCK_TIMEOUT_SECONDS = 60;
|
||||
public static final int LOCK_TIMEOUT_SECONDS;
|
||||
|
||||
static {
|
||||
// Previously this value was 2 seconds, but GC pauses often take more time that shouldn't
|
||||
// result to InterProcessDeadLockException.
|
||||
int timeout = 60;
|
||||
try {
|
||||
timeout = Integer.parseInt(System.getProperty("net.openhft.chronicle.map.lockTimeoutSeconds", String.valueOf(timeout)));
|
||||
}
|
||||
catch (NumberFormatException ex) {
|
||||
// ignore
|
||||
}
|
||||
|
||||
LOCK_TIMEOUT_SECONDS = timeout;
|
||||
}
|
||||
|
||||
private static InterProcessDeadLockException deadLock() {
|
||||
return new InterProcessDeadLockException(
|
||||
|
||||
Reference in New Issue
Block a user