Fixed - RedissonAtomicLong#getAndSet() method throws NPE. #2874

pull/2882/head
Nikita Koksharov 5 years ago
parent ca1753a045
commit 5dcfdfd8fc

@ -124,7 +124,7 @@ public class RedissonAtomicLong extends RedissonExpirable implements RAtomicLong
@Override
public RFuture<Long> getAndSetAsync(long newValue) {
return commandExecutor.writeAsync(getName(), LongCodec.INSTANCE, RedisCommands.GETSET, getName(), newValue);
return commandExecutor.writeAsync(getName(), LongCodec.INSTANCE, RedisCommands.GETSET_LONG, getName(), newValue);
}
@Override

@ -297,6 +297,7 @@ public interface RedisCommands {
RedisStrictCommand<Integer> GET_INTEGER = new RedisStrictCommand<Integer>("GET", new IntegerReplayConvertor(0));
RedisStrictCommand<Double> GET_DOUBLE = new RedisStrictCommand<Double>("GET", new DoubleNullSafeReplayConvertor());
RedisCommand<Object> GETSET = new RedisCommand<Object>("GETSET");
RedisCommand<Long> GETSET_LONG = new RedisCommand<>("GETSET", new LongReplayConvertor());
RedisCommand<Void> SET = new RedisCommand<Void>("SET", new VoidReplayConvertor());
RedisCommand<Void> APPEND = new RedisCommand<Void>("APPEND", new VoidReplayConvertor());
RedisCommand<Boolean> SET_BOOLEAN = new RedisCommand<Boolean>("SET", new BooleanNotNullReplayConvertor());

@ -8,6 +8,12 @@ import org.redisson.api.RAtomicLong;
public class RedissonAtomicLongTest extends BaseTest {
@Test
public void testGetAndSet() {
RAtomicLong al = redisson.getAtomicLong("test");
Assert.assertEquals(0, al.getAndSet(12));
}
@Test
public void testGetZero() {
RAtomicLong ad2 = redisson.getAtomicLong("test");

Loading…
Cancel
Save