@Override public void registerForServiceAvailability(Operation.CompletionHandler completion, String nodeSelectorPath, boolean checkReplica, String... servicePaths) { if (this.enablePostgres && checkReplica) { PostgresHostUtils.registerForReplicatedServiceAvailability(this, completion, isStarted() ? getSystemAuthorizationContext() : null, nodeSelectorPath, servicePaths); return; } super.registerForServiceAvailability(completion, nodeSelectorPath, checkReplica, servicePaths); }
@Override public boolean handleRequest(Service service, Operation inboundOp) { if (inboundOp == null && service != null) { inboundOp = service.dequeueRequest(); } if (inboundOp == null) { return true; } // Reject remote requests with 503 if node is not started, node stopping or // isRejectRemoteRequests flag is true (which can be used to reject requests before starting // factories) if ((!isStarted() || isStopping() || this.isRejectRemoteRequests) && inboundOp.isRemote()) { PostgresHostUtils.failServerNotAvailable(inboundOp); return true; } return super.handleRequest(null, inboundOp); }