Search in sources :

Example 1 with LockServerOptions

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;
}
Also used : LockServerOptions(com.palantir.lock.LockServerOptions) LockServiceImpl(com.palantir.lock.impl.LockServiceImpl)

Example 2 with LockServerOptions

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);
}
Also used : LockServerOptions(com.palantir.lock.LockServerOptions) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Test(org.junit.Test)

Example 3 with 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());
}
Also used : LockServerOptions(com.palantir.lock.LockServerOptions) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Test(org.junit.Test)

Aggregations

LockServerOptions (com.palantir.lock.LockServerOptions)3 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 Test (org.junit.Test)2 LockServiceImpl (com.palantir.lock.impl.LockServiceImpl)1