X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2Futils%2FDispatchers.java;h=980289fcf9762d8e2167d107060c4f122aad3172;hb=b00bee7547dbba0677347e991a8674f90752f6a2;hp=8de8a9d19304f3572799ee64b728fdf5607b99fa;hpb=64db87e8fb5de25e68ba824ec2eaa17e3f217c96;p=controller.git diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/utils/Dispatchers.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/utils/Dispatchers.java index 8de8a9d193..980289fcf9 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/utils/Dispatchers.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/utils/Dispatchers.java @@ -20,41 +20,42 @@ public class Dispatchers { private final akka.dispatch.Dispatchers dispatchers; - public static enum DispatcherType { + public enum DispatcherType { Client(CLIENT_DISPATCHER_PATH), Transaction(TXN_DISPATCHER_PATH), Shard(SHARD_DISPATCHER_PATH), Notification(NOTIFICATION_DISPATCHER_PATH); private final String path; - private DispatcherType(String path){ + DispatcherType(String path) { this.path = path; } - private String path(akka.dispatch.Dispatchers dispatchers){ - if(dispatchers.hasDispatcher(path)){ + + private String path(akka.dispatch.Dispatchers dispatchers) { + if (dispatchers.hasDispatcher(path)) { return path; } return DEFAULT_DISPATCHER_PATH; } - private ExecutionContext dispatcher(akka.dispatch.Dispatchers dispatchers){ - if(dispatchers.hasDispatcher(path)){ + private ExecutionContext dispatcher(akka.dispatch.Dispatchers dispatchers) { + if (dispatchers.hasDispatcher(path)) { return dispatchers.lookup(path); } return dispatchers.defaultGlobalDispatcher(); } } - public Dispatchers(akka.dispatch.Dispatchers dispatchers){ + public Dispatchers(akka.dispatch.Dispatchers dispatchers) { Preconditions.checkNotNull(dispatchers, "dispatchers should not be null"); this.dispatchers = dispatchers; } - public ExecutionContext getDispatcher(DispatcherType dispatcherType){ + public ExecutionContext getDispatcher(DispatcherType dispatcherType) { return dispatcherType.dispatcher(this.dispatchers); } - public String getDispatcherPath(DispatcherType dispatcherType){ + public String getDispatcherPath(DispatcherType dispatcherType) { return dispatcherType.path(this.dispatchers); } }