Bugfixes
This commit is contained in:
parent
46bd61e817
commit
e5081a62cd
@ -11,7 +11,6 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.function.Function;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import reactor.core.publisher.Flux;
|
||||
@ -111,7 +110,6 @@ public class DatabaseMapDictionary<T, U> extends DatabaseMapDictionaryDeep<T, U,
|
||||
|
||||
@Override
|
||||
public Mono<Boolean> updateValue(T keySuffix, Function<Optional<U>, Optional<U>> updater) {
|
||||
AtomicBoolean changed = new AtomicBoolean(false);
|
||||
return dictionary.update(toKey(serializeSuffix(keySuffix)),
|
||||
oldSerialized -> updater.apply(oldSerialized.map(this::deserialize)).map(this::serialize)
|
||||
);
|
||||
|
@ -95,7 +95,7 @@ public class LLLocalDictionary implements LLDictionary {
|
||||
}
|
||||
|
||||
private int getLockIndex(byte[] key) {
|
||||
return Arrays.hashCode(key) % STRIPES;
|
||||
return Math.abs(Arrays.hashCode(key) % STRIPES);
|
||||
}
|
||||
|
||||
private IntArrayList getLockIndices(List<byte[]> keys) {
|
||||
|
@ -4,6 +4,7 @@ import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.ByteBufInputStream;
|
||||
import io.netty.buffer.ByteBufOutputStream;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import java.io.IOError;
|
||||
import java.io.IOException;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.warp.commonutils.error.IndexOutOfBoundsException;
|
||||
@ -46,7 +47,7 @@ public class CodecSerializer<A> implements Serializer<A, byte[]> {
|
||||
return serializer.deserialize(is);
|
||||
} catch (IOException ex) {
|
||||
// This shouldn't happen
|
||||
throw new RuntimeException(ex);
|
||||
throw new IOError(ex);
|
||||
}
|
||||
}
|
||||
|
||||
@ -66,7 +67,15 @@ public class CodecSerializer<A> implements Serializer<A, byte[]> {
|
||||
return bytes;
|
||||
} catch (IOException ex) {
|
||||
// This shouldn't happen
|
||||
throw new RuntimeException(ex);
|
||||
throw new IOError(ex);
|
||||
}
|
||||
}
|
||||
|
||||
public int getCodecHeadersBytes() {
|
||||
if (microCodecs) {
|
||||
return Byte.BYTES;
|
||||
} else {
|
||||
return Integer.BYTES;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user