gemmellr commented on a change in pull request #3889:
URL: https://github.com/apache/activemq-artemis/pull/3889#discussion_r774957266
##########
File path:
artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalImpl.java
##########
@@ -1051,12 +1052,18 @@ public void appendUpdateRecord(final long id,
", userRecordType=" +
recordType);
}
-
- SimpleFuture<Boolean> future = new SimpleFutureImpl<>();
-
- internalAppendUpdateRecord(id, recordType, persister, record, sync,
false, (t, v) -> future.set(v), callback);
-
- if (!future.get()) {
+ final SimpleFuture<Boolean> onFoundAddInfo;
+ if (!sync && (callback == null || callback ==
DummyCallback.getInstance())) {
+ onFoundAddInfo = null;
+ } else {
+ onFoundAddInfo = new SimpleFutureImpl<>();
+ }
+ if (onFoundAddInfo == null) {
+ internalAppendUpdateRecord(id, recordType, persister, record, false,
false, null, callback);
+ } else {
+ internalAppendUpdateRecord(id, recordType, persister, record, sync,
false, (t, v) -> onFoundAddInfo.set(v), callback);
+ }
+ if (onFoundAddInfo != null && !onFoundAddInfo.get()) {
Review comment:
Newlines between these would aid readability. Collapsing the second if
with the internalAppendUpdateRecord calls into the first if may also.
##########
File path:
artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalImpl.java
##########
@@ -1161,20 +1168,25 @@ public void run() {
@Override
public void appendDeleteRecord(final long id, final boolean sync, final
IOCompletion callback) throws Exception {
-
if (logger.isTraceEnabled()) {
logger.trace("scheduling appendDeleteRecord::id=" + id);
}
-
-
checkJournalIsLoaded();
lineUpContext(callback);
- SimpleFuture<Boolean> future = new SimpleFutureImpl<>();
- internalAppendDeleteRecord(id, sync, (t, v) -> future.set(v), callback);
- if (!future.get()) {
+ final SimpleFuture<Boolean> onFoundAddInfo;
+ if (!sync && (callback == null || callback ==
DummyCallback.getInstance())) {
+ onFoundAddInfo = null;
+ } else {
+ onFoundAddInfo = new SimpleFutureImpl<>();
+ }
+ if (onFoundAddInfo == null) {
+ internalAppendDeleteRecord(id, false, null, callback);
+ } else {
+ internalAppendDeleteRecord(id, sync, (record, result) ->
onFoundAddInfo.set(result), callback);
+ }
+ if (onFoundAddInfo != null && !onFoundAddInfo.get()) {
Review comment:
Similar to earlier comment. Did we start being charged for newlines and
noone told me? :)
--
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]