/*
- * Copyright (c) 2016 Brocade Communications Systems, Inc. and others. All rights reserved.
+ * Copyright © 2016, 2017 Brocade Communications Systems, Inc. and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
package org.opendaylight.ovsdb.hwvtepsouthbound.reconciliation;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.ThreadFactory;
+import java.util.concurrent.TimeUnit;
+import org.opendaylight.mdsal.binding.api.DataBroker;
import org.opendaylight.yangtools.util.concurrent.SpecialExecutors;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.util.concurrent.*;
-
/**
- * Copied from org.opendaylight.ovsdb.southbound.reconciliation.ReconciliationManager
+ * Copied from org.opendaylight.ovsdb.southbound.reconciliation.ReconciliationManager.
*
+ * <p>
* This class provides the implementation of ovsdb southbound plugins
* configuration reconciliation engine. This engine provide interfaces
* to enqueue (one time retry)/ enqueueForRetry(periodic retry)/ dequeue
* Ideally, addition of any type of reconciliation task should not require
* any change in this reconciliation manager execution engine.
*
+ * <p>
* 3-Node Cluster:
* Reconciliation manager is agnostic of whether it's running in single
* node cluster or 3-node cluster. It's a responsibility of the task
* the 3-nodes in the cluster, because connection to individual controller
* can be interrupted for various reason.
*
+ * <p>
* Created by Anil Vishnoi (avishnoi@Brocade.com) on 3/9/16.
*/
public class ReconciliationManager implements AutoCloseable {
public ReconciliationManager(final DataBroker db) {
this.db = db;
- reconcilers = SpecialExecutors.newBoundedCachedThreadPool(NO_OF_RECONCILER, RECON_TASK_QUEUE_SIZE, "ovsdb-reconciler");
+ reconcilers =
+ SpecialExecutors.newBoundedCachedThreadPool(NO_OF_RECONCILER, RECON_TASK_QUEUE_SIZE, "ovsdb-reconciler",
+ getClass());
ThreadFactory threadFact = new ThreadFactoryBuilder()
.setNameFormat("ovsdb-recon-task-triager-%d").build();
public void enqueueForRetry(final ReconciliationTask task) {
LOG.trace("Reconciliation task re-queued for re-execution {}",task);
reconTaskManager.cacheTask(task, taskTriager.schedule(
- new Runnable() {
- @Override
- public void run() {
- task.checkReadinessAndProcess();
- }
- }, task.retryDelayInMills(), TimeUnit.MILLISECONDS
+ task::checkReadinessAndProcess, task.retryDelayInMills(), TimeUnit.MILLISECONDS
)
);
}