use of com.palantir.lock.LockServerOptions in project atlasdb by palantir.
the class LockCreator method createTimeLimitedLockService.
private CloseableLockService createTimeLimitedLockService(long slowLogTriggerMillis) {
LockServerOptions lockServerOptions = LockServerOptions.builder().slowLogTriggerMillis(slowLogTriggerMillis).build();
LockServiceImpl rawLockService = LockServiceImpl.create(lockServerOptions);
if (deprecated.useLockTimeLimiter()) {
return BlockingTimeLimitedLockService.create(rawLockService, deprecated.blockingTimeoutInMs());
}
return rawLockService;
}
use of com.palantir.lock.LockServerOptions in project atlasdb by palantir.
the class LockServiceSerDeTest method testSerialisationAndDeserialisationOfDefaultLockServerOptions.
@Test
public void testSerialisationAndDeserialisationOfDefaultLockServerOptions() throws Exception {
LockServerOptions lockServerOptions = LockServerOptions.DEFAULT;
ObjectMapper mapper = new ObjectMapper();
String serializedForm = mapper.writeValueAsString(lockServerOptions);
LockServerOptions deserialzedLockServerOptions = mapper.readValue(serializedForm, LockServerOptions.class);
assertEquals(deserialzedLockServerOptions, lockServerOptions);
}
use of com.palantir.lock.LockServerOptions in project atlasdb by palantir.
the class LockServiceSerDeTest method testSerialisationAndDeserialisationOfLockServerOptions.
@Test
public void testSerialisationAndDeserialisationOfLockServerOptions() throws Exception {
LockServerOptions lockServerOptions = LockServerOptions.builder().isStandaloneServer(false).slowLogTriggerMillis(10L).build();
ObjectMapper mapper = new ObjectMapper();
String serializedForm = mapper.writeValueAsString(lockServerOptions);
LockServerOptions deserialzedlockServerOptions = mapper.readValue(serializedForm, LockServerOptions.class);
assertEquals(lockServerOptions, deserialzedlockServerOptions);
assertEquals(false, deserialzedlockServerOptions.isStandaloneServer());
assertEquals(10L, deserialzedlockServerOptions.slowLogTriggerMillis());
}
Aggregations