Skip to content

Commit 6e8f11a

Browse files
committed
Reduce visibility in sequence number services
This commit reduces the visibility of certain fields and methods in the local and global checkpoint services.
1 parent a5b99c6 commit 6e8f11a

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

core/src/main/java/org/elasticsearch/index/seqno/GlobalCheckpointService.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public class GlobalCheckpointService extends AbstractIndexShardComponent {
6969

7070
private long globalCheckpoint;
7171

72-
public GlobalCheckpointService(final ShardId shardId, final IndexSettings indexSettings, final long globalCheckpoint) {
72+
GlobalCheckpointService(final ShardId shardId, final IndexSettings indexSettings, final long globalCheckpoint) {
7373
super(shardId, indexSettings);
7474
activeLocalCheckpoints = new ObjectLongHashMap<>(1 + indexSettings.getNumberOfReplicas());
7575
inSyncLocalCheckpoints = new ObjectLongHashMap<>(indexSettings.getNumberOfReplicas());
@@ -124,7 +124,7 @@ private boolean updateLocalCheckpointInMap(String allocationId, long localCheckp
124124
* @return true if the checkpoint has been updated or if it can not be updated since one of the local checkpoints
125125
* of one of the active allocations is not known.
126126
*/
127-
synchronized public boolean updateCheckpointOnPrimary() {
127+
synchronized boolean updateCheckpointOnPrimary() {
128128
long minCheckpoint = Long.MAX_VALUE;
129129
if (activeLocalCheckpoints.isEmpty() && inSyncLocalCheckpoints.isEmpty()) {
130130
return false;
@@ -164,7 +164,7 @@ synchronized public long getCheckpoint() {
164164
/**
165165
* updates the global checkpoint on a replica shard (after it has been updated by the primary).
166166
*/
167-
synchronized public void updateCheckpointOnReplica(long globalCheckpoint) {
167+
synchronized void updateCheckpointOnReplica(long globalCheckpoint) {
168168
if (this.globalCheckpoint <= globalCheckpoint) {
169169
this.globalCheckpoint = globalCheckpoint;
170170
logger.trace("global checkpoint updated from primary to [{}]", globalCheckpoint);

core/src/main/java/org/elasticsearch/index/seqno/LocalCheckpointService.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,16 @@ public class LocalCheckpointService extends AbstractIndexShardComponent {
4545
* which marks the seqNo the fist bit in the first array corresponds to.
4646
*/
4747
final LinkedList<FixedBitSet> processedSeqNo;
48-
final int bitArraysSize;
48+
private final int bitArraysSize;
4949
long firstProcessedSeqNo;
5050

5151
/** the current local checkpoint, i.e., all seqNo lower (&lt;=) than this number have been completed */
5252
volatile long checkpoint;
5353

5454
/** the next available seqNo - used for seqNo generation */
55-
volatile long nextSeqNo;
55+
private volatile long nextSeqNo;
5656

57-
public LocalCheckpointService(final ShardId shardId, final IndexSettings indexSettings, final long maxSeqNo, final long checkpoint) {
57+
LocalCheckpointService(final ShardId shardId, final IndexSettings indexSettings, final long maxSeqNo, final long checkpoint) {
5858
super(shardId, indexSettings);
5959
bitArraysSize = SETTINGS_BIT_ARRAYS_SIZE.get(indexSettings.getSettings());
6060
processedSeqNo = new LinkedList<>();
@@ -66,14 +66,14 @@ public LocalCheckpointService(final ShardId shardId, final IndexSettings indexSe
6666
/**
6767
* issue the next sequence number
6868
**/
69-
public synchronized long generateSeqNo() {
69+
synchronized long generateSeqNo() {
7070
return nextSeqNo++;
7171
}
7272

7373
/**
7474
* marks the processing of the given seqNo have been completed
7575
**/
76-
public synchronized void markSeqNoAsCompleted(long seqNo) {
76+
synchronized void markSeqNoAsCompleted(long seqNo) {
7777
// make sure we track highest seen seqNo
7878
if (seqNo >= nextSeqNo) {
7979
nextSeqNo = seqNo + 1;
@@ -96,7 +96,7 @@ public long getCheckpoint() {
9696
}
9797

9898
/** gets the maximum seqno seen so far */
99-
public long getMaxSeqNo() {
99+
long getMaxSeqNo() {
100100
return nextSeqNo - 1;
101101
}
102102

0 commit comments

Comments
 (0)