diff --git a/src/main/java/org/cojen/tupl/jmx/DatabaseMBean.java b/src/main/java/org/cojen/tupl/jmx/DatabaseMBean.java index 435811265..260787d45 100644 --- a/src/main/java/org/cojen/tupl/jmx/DatabaseMBean.java +++ b/src/main/java/org/cojen/tupl/jmx/DatabaseMBean.java @@ -43,6 +43,8 @@ public interface DatabaseMBean { long getReplicationBacklog(); + boolean isLeader(); + void flush(); void sync(); @@ -52,4 +54,6 @@ public interface DatabaseMBean { void compactFile(double target); void verify(); + + boolean failover(); } diff --git a/src/main/java/org/cojen/tupl/jmx/Registration.java b/src/main/java/org/cojen/tupl/jmx/Registration.java index b0d7cfa72..5a14780d4 100644 --- a/src/main/java/org/cojen/tupl/jmx/Registration.java +++ b/src/main/java/org/cojen/tupl/jmx/Registration.java @@ -291,6 +291,12 @@ public long getReplicationBacklog() { return stats == null ? 0 : stats.replicationBacklog; } + @Override + public boolean isLeader() { + Database db = db(); + return db == null ? false : db.isLeader(); + } + @Override public void flush() { asyncOp(db -> { @@ -377,6 +383,16 @@ public boolean indexNodeFailed(long id, int level, String message) { } } + @Override + public boolean failover() { + try { + Database db = db(); + return db == null ? false : db.failover(); + } catch (IOException e) { + return false; + } + } + private DatabaseStats stats() { synchronized (this) { DatabaseStats stats = mStats;