Skip to content

Commit fba9126

Browse files
authored
[improve] Change PersistentMessageFinder's fields modifier to reuse in plugins (#24308)
1 parent 46c2b74 commit fba9126

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentMessageFinder.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,17 @@
3939
* given a timestamp find the first message (position) (published) at or before the timestamp.
4040
*/
4141
public class PersistentMessageFinder implements AsyncCallbacks.FindEntryCallback {
42-
private final ManagedCursor cursor;
43-
private final String subName;
44-
private final int ledgerCloseTimestampMaxClockSkewMillis;
45-
private final String topicName;
46-
private long timestamp = 0;
42+
protected final ManagedCursor cursor;
43+
protected final String subName;
44+
protected final int ledgerCloseTimestampMaxClockSkewMillis;
45+
protected final String topicName;
46+
protected long timestamp = 0;
4747

48-
private static final int FALSE = 0;
49-
private static final int TRUE = 1;
48+
protected static final int FALSE = 0;
49+
protected static final int TRUE = 1;
5050
@SuppressWarnings("unused")
51-
private volatile int messageFindInProgress = FALSE;
52-
private static final AtomicIntegerFieldUpdater<PersistentMessageFinder> messageFindInProgressUpdater =
51+
protected volatile int messageFindInProgress = FALSE;
52+
protected static final AtomicIntegerFieldUpdater<PersistentMessageFinder> MESSAGE_FIND_IN_PROGRESS =
5353
AtomicIntegerFieldUpdater
5454
.newUpdater(PersistentMessageFinder.class, "messageFindInProgress");
5555

@@ -61,7 +61,7 @@ public PersistentMessageFinder(String topicName, ManagedCursor cursor, int ledge
6161
}
6262

6363
public void findMessages(final long timestamp, AsyncCallbacks.FindEntryCallback callback) {
64-
if (messageFindInProgressUpdater.compareAndSet(this, FALSE, TRUE)) {
64+
if (MESSAGE_FIND_IN_PROGRESS.compareAndSet(this, FALSE, TRUE)) {
6565
this.timestamp = timestamp;
6666
if (log.isDebugEnabled()) {
6767
log.debug("[{}] Starting message position find at timestamp {}", subName, timestamp);

0 commit comments

Comments
 (0)