coderzc commented on code in PR #17164:
URL: https://github.com/apache/pulsar/pull/17164#discussion_r963025838
##########
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedCursorImpl.java:
##########
@@ -365,6 +372,50 @@ public void operationFailed(MetaStoreException e) {
return updateCursorPropertiesResult;
}
+ @Override
+ public CompletableFuture<Void> setCursorProperties(Map<String, String>
cursorProperties) {
+ MutableObject<CompletableFuture<Void>> updateCursorPropertiesResultRef
= new MutableObject<>();
+ CURSOR_PROPERTIES_UPDATER.updateAndGet(this, map -> {
+ Map<String, String> newProperties =
+ cursorProperties == null ? new TreeMap<>() : new
TreeMap<>(cursorProperties);
+ if (map != null) {
+ map.forEach((k, v) -> {
+ if (((String)
k).startsWith(CURSOR_INTERNAL_PROPERTY_PREFIX)) {
+ newProperties.put((String) k, (String) v);
+ }
+ });
+
+
updateCursorPropertiesResultRef.setValue(asyncUpdateCursorProperties(newProperties));
Review Comment:
It makes sense, I use non-reentrant lock instead of
`AtomicReferenceFieldUpdater` to ensure the new properties take effect after
they are persisted to storage.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]