Ensure event classes are overridable
Add protected or public to unqualified identifiers. Also add some finals
where appropriate.
Change-Id: Id4c98f7fb12ba788518ac9dea8232eea940116d1
diff --git a/src/main/java/com/googlesource/gerrit/plugins/events/fsstore/EventSequence.java b/src/main/java/com/googlesource/gerrit/plugins/events/fsstore/EventSequence.java
index 4a91642..cc26ad2 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/events/fsstore/EventSequence.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/events/fsstore/EventSequence.java
@@ -23,6 +23,7 @@
* event to be delivered for each update to the sequence.
*
* <p>Adds phase 1+, add an event file in the <uuid> dir.
+ *
* <p>Adds phase 2+, move the event to the event store.
*
* <p>The event submitter must perform the first phase of the UpdatableFileValue transaction by
@@ -42,11 +43,11 @@
}
protected class UniqueUpdate extends UpdatableFileValue.UniqueUpdate<Long> {
- final Path event;
- Path destination;
+ protected final Path event;
+ protected Path destination;
/** Advance through phases 2 - 6 */
- UniqueUpdate(String uuid, boolean ours, long maxTries) throws IOException {
+ protected UniqueUpdate(String uuid, boolean ours, long maxTries) throws IOException {
super(EventSequence.this, uuid, ours, maxTries);
event = upaths.udir.resolve(EVENT);
spinFinish();
diff --git a/src/main/java/com/googlesource/gerrit/plugins/events/fsstore/UpdatableFileValue.java b/src/main/java/com/googlesource/gerrit/plugins/events/fsstore/UpdatableFileValue.java
index ee1e9fa..6f41b43 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/events/fsstore/UpdatableFileValue.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/events/fsstore/UpdatableFileValue.java
@@ -63,8 +63,8 @@
/** For Phase 1 */
protected static class UpdateBuilder extends FsTransaction.Builder {
- String uuid = UUID.randomUUID().toString();
- Path udir = dir.resolve(uuid);
+ public final String uuid = UUID.randomUUID().toString();
+ public final Path udir = dir.resolve(uuid);
public UpdateBuilder(BasePaths paths) throws IOException {
super(paths);
@@ -95,7 +95,7 @@
public final Path closed;
public final Path value;
- UpdatePaths(Path base, String uuid) {
+ protected UpdatePaths(Path base, String uuid) {
udir = base.resolve(uuid);
closed = udir.resolve(CLOSED);
value = closed.resolve(VALUE);
@@ -104,25 +104,26 @@
/** Phase 2 -6 helper. */
protected static class UniqueUpdate<T> {
- final UpdatableFileValue<T> updatable;
- final String uuid;
- final UpdatePaths upaths;
- final boolean ours;
- final T currentValue;
- final T next;
+ protected final UpdatableFileValue<T> updatable;
+ protected final String uuid;
+ protected final UpdatePaths upaths;
+ protected final boolean ours;
+ protected final T currentValue;
+ protected final T next;
- long maxTries;
+ protected long maxTries;
- long tries;
- boolean closed;
- boolean preserved;
- boolean committed;
- boolean finished;
+ protected long tries;
+ protected boolean closed;
+ protected boolean preserved;
+ protected boolean committed;
+ protected boolean finished;
- boolean myCommit;
+ protected boolean myCommit;
/** Advance through phase 2 */
- UniqueUpdate(UpdatableFileValue<T> updatable, String uuid, boolean ours, long maxTries)
+ protected UniqueUpdate(
+ UpdatableFileValue<T> updatable, String uuid, boolean ours, long maxTries)
throws IOException {
this.updatable = updatable;
this.uuid = uuid;