Code cleanup
This commit is contained in:
parent
2e58189015
commit
bff4d87164
@ -809,8 +809,8 @@ public class LLUtils {
|
|||||||
public static <U> Mono<Delta<U>> mapLLDelta(Mono<LLDelta> mono,
|
public static <U> Mono<Delta<U>> mapLLDelta(Mono<LLDelta> mono,
|
||||||
SerializationFunction<@NotNull Buffer, @Nullable U> mapper) {
|
SerializationFunction<@NotNull Buffer, @Nullable U> mapper) {
|
||||||
return Mono.usingWhen(mono, delta -> Mono.fromCallable(() -> {
|
return Mono.usingWhen(mono, delta -> Mono.fromCallable(() -> {
|
||||||
Buffer prev = delta.previousUnsafe();
|
try (Buffer prev = delta.previousUnsafe();
|
||||||
Buffer curr = delta.currentUnsafe();
|
Buffer curr = delta.currentUnsafe()) {
|
||||||
U newPrev;
|
U newPrev;
|
||||||
U newCurr;
|
U newCurr;
|
||||||
if (prev != null) {
|
if (prev != null) {
|
||||||
@ -824,6 +824,7 @@ public class LLUtils {
|
|||||||
newCurr = null;
|
newCurr = null;
|
||||||
}
|
}
|
||||||
return new Delta<>(newPrev, newCurr);
|
return new Delta<>(newPrev, newCurr);
|
||||||
|
}
|
||||||
}), delta -> Mono.fromRunnable(delta::close));
|
}), delta -> Mono.fromRunnable(delta::close));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -281,10 +281,10 @@ public class DatabaseMapDictionary<T, U> extends DatabaseMapDictionaryDeep<T, U,
|
|||||||
public Mono<Void> putValue(T keySuffix, U value) {
|
public Mono<Void> putValue(T keySuffix, U value) {
|
||||||
var keyMono = Mono.fromCallable(() -> serializeKeySuffixToKey(keySuffix)).single();
|
var keyMono = Mono.fromCallable(() -> serializeKeySuffixToKey(keySuffix)).single();
|
||||||
var valueMono = Mono.fromCallable(() -> serializeValue(value)).single();
|
var valueMono = Mono.fromCallable(() -> serializeValue(value)).single();
|
||||||
return dictionary
|
return Mono.usingWhen(dictionary.put(keyMono, valueMono, LLDictionaryResultType.VOID),
|
||||||
.put(keyMono, valueMono, LLDictionaryResultType.VOID)
|
v -> Mono.empty(),
|
||||||
.doOnNext(Resource::close)
|
v -> Mono.fromRunnable(v::close)
|
||||||
.then();
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -316,7 +316,9 @@ public class DatabaseMapDictionary<T, U> extends DatabaseMapDictionaryDeep<T, U,
|
|||||||
if (oldSerialized == null) {
|
if (oldSerialized == null) {
|
||||||
result = updater.apply(null);
|
result = updater.apply(null);
|
||||||
} else {
|
} else {
|
||||||
result = updater.apply(valueSerializer.deserialize(oldSerialized));
|
try (oldSerialized) {
|
||||||
|
result = updater.apply(valueSerializer.deserialize(oldSerialized));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (result == null) {
|
if (result == null) {
|
||||||
return null;
|
return null;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user