mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-11-14 06:18:12 +00:00
include the replication status in the gateway server status at /sailingserver/api/v1/status;
With this, the "available" attribute of the response document already is a good indicator of the instance's availability. The next thing will be to map this to a 5xx resonse code if the instance is not yet available Change-Id: I87a179b04a811843bbd8cf85bba58c1eed81d46c
This commit is contained in:
1 parent
755cb3a06d
commit
9968b239e6
10 files changed
+313
-73
No files matched your search
+27
@@ -45,6 +45,7 @@ import com.sap.sse.replication.ReplicablesProvider.ReplicableLifeCycleListener;
|
||||
import com.sap.sse.replication.ReplicationMasterDescriptor;
|
||||
import com.sap.sse.replication.ReplicationReceiver;
|
||||
import com.sap.sse.replication.ReplicationService;
|
||||
import com.sap.sse.replication.ReplicationStatus;
|
||||
import com.sap.sse.util.HttpUrlConnectionHelper;
|
||||
|
||||
import net.jpountz.lz4.LZ4BlockInputStream;
|
||||
@@ -840,4 +841,30 @@ public class ReplicationServiceImpl implements ReplicationService, OperationsToM
|
||||
public <S, O extends OperationWithResult<S, ?>, T> void scheduleForSending(OperationWithResult<S, T> operationWithResult, OperationsToMasterSender<S, O> sender) {
|
||||
unsentOperationsSenderJob.scheduleForSending(operationWithResult, sender);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized ReplicationStatus getStatus() {
|
||||
final ReplicationReceiver replicationReceiver = getReplicator();
|
||||
final boolean isReplicationStarting = isReplicationStarting();
|
||||
final boolean isReplica = isReplicationStarting || replicationReceiver != null;
|
||||
final boolean suspended = replicationReceiver == null ? false : replicationReceiver.isSuspended();
|
||||
final boolean stopped = replicationReceiver == null ? false : replicationReceiver.isBeingStopped();
|
||||
long messageQueueLength;
|
||||
if (replicationReceiver == null) {
|
||||
messageQueueLength = 0;
|
||||
} else {
|
||||
try {
|
||||
messageQueueLength = replicationReceiver.getMessageQueueSize();
|
||||
} catch (IllegalAccessException e) {
|
||||
logger.warning("Unable to access replication message queue size: "+e.getMessage()+". Reporting as -1");
|
||||
messageQueueLength = -1;
|
||||
}
|
||||
}
|
||||
final Map<String, Integer> operationQueueLengths = replicationReceiver == null ? new HashMap<>() : replicationReceiver.getOperationQueueSizes();
|
||||
final Map<String, Boolean> isInitialLoadRunning = new HashMap<>();
|
||||
for (final Replicable<?, ?> replicable : getAllReplicables()) {
|
||||
isInitialLoadRunning.put(replicable.getId().toString(), replicable.isCurrentlyFillingFromInitialLoad());
|
||||
}
|
||||
return new ReplicationStatusImpl(isReplica, isReplicationStarting, suspended, stopped, messageQueueLength, isInitialLoadRunning, operationQueueLengths);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user