in computer-k8s-operator/src/main/java/org/apache/hugegraph/computer/k8s/operator/common/AbstractController.java [154:203]
protected abstract void handleFailOverLimit(OperatorRequest request,
Exception e);
private void startWorker() {
while (!this.executor.isShutdown() &&
!this.workQueue.isShutdown() &&
!Thread.currentThread().isInterrupted()) {
LOG.debug("Trying to get item from work queue of {}-controller",
this.kind);
OperatorRequest request = null;
try {
request = this.workQueue.get();
} catch (InterruptedException e) {
LOG.warn("The {}-controller worker interrupted...",
this.kind, e);
}
if (request == null) {
LOG.info("The {}-controller worker exiting...", this.kind);
break;
}
OperatorResult result;
try {
LOG.debug("Start reconcile request: {}", request);
result = this.reconcile(request);
} catch (Exception e) {
LOG.error("Reconcile occur error, requeue request: ", e);
int maxReconcileRetry = this.config.get(
OperatorOptions.MAX_RECONCILE_RETRY);
if (request.retryIncrGet() > maxReconcileRetry) {
try {
this.handleFailOverLimit(request, e);
} catch (Exception e2) {
LOG.error("Reconcile fail over limit occur error:", e2);
}
result = OperatorResult.NO_REQUEUE;
} else {
result = OperatorResult.REQUEUE;
}
}
try {
if (result.requeue()) {
this.enqueueRequest(request);
}
} finally {
LOG.debug("End reconcile request: {}", request);
this.workQueue.done(request);
}
}
}