Code Review
/
controller.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Modify the FindPrimary implementation so that it works correctly with a configuration
[controller.git]
/
opendaylight
/
md-sal
/
sal-distributed-datastore
/
src
/
main
/
java
/
org
/
opendaylight
/
controller
/
cluster
/
datastore
/
utils
/
ActorContext.java
diff --git
a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/utils/ActorContext.java
b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/utils/ActorContext.java
index ba4d4de6bfaeed985bf1e70c626c4a3bd365a0b1..2f1949ec6a8b12c701e87d696b8777dedece947f 100644
(file)
--- a/
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/utils/ActorContext.java
+++ b/
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/utils/ActorContext.java
@@
-12,9
+12,14
@@
import akka.actor.ActorPath;
import akka.actor.ActorRef;
import akka.actor.ActorSelection;
import akka.actor.ActorSystem;
import akka.actor.ActorRef;
import akka.actor.ActorSelection;
import akka.actor.ActorSystem;
+import akka.actor.PoisonPill;
import akka.util.Timeout;
import akka.util.Timeout;
+import org.opendaylight.controller.cluster.datastore.Configuration;
+import org.opendaylight.controller.cluster.datastore.exceptions.PrimaryNotFoundException;
+import org.opendaylight.controller.cluster.datastore.exceptions.TimeoutException;
import org.opendaylight.controller.cluster.datastore.messages.FindPrimary;
import org.opendaylight.controller.cluster.datastore.messages.PrimaryFound;
import org.opendaylight.controller.cluster.datastore.messages.FindPrimary;
import org.opendaylight.controller.cluster.datastore.messages.PrimaryFound;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import scala.concurrent.Await;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import scala.concurrent.Await;
@@
-41,10
+46,14
@@
public class ActorContext {
private final ActorSystem actorSystem;
private final ActorRef shardManager;
private final ActorSystem actorSystem;
private final ActorRef shardManager;
+ private final Configuration configuration;
- public ActorContext(ActorSystem actorSystem, ActorRef shardManager){
+ private SchemaContext schemaContext = null;
+
+ public ActorContext(ActorSystem actorSystem, ActorRef shardManager, Configuration configuration){
this.actorSystem = actorSystem;
this.shardManager = shardManager;
this.actorSystem = actorSystem;
this.shardManager = shardManager;
+ this.configuration = configuration;
}
public ActorSystem getActorSystem() {
}
public ActorSystem getActorSystem() {
@@
-81,7
+90,7
@@
public class ActorContext {
return actorSystem.actorSelection(found.getPrimaryPath());
}
return actorSystem.actorSelection(found.getPrimaryPath());
}
- throw new
RuntimeException("primary was not found"
);
+ throw new
PrimaryNotFoundException(
);
}
/**
}
/**
@@
-99,7
+108,7
@@
public class ActorContext {
try {
return Await.result(future, AWAIT_DURATION);
} catch (Exception e) {
try {
return Await.result(future, AWAIT_DURATION);
} catch (Exception e) {
- throw new
Runtime
Exception(e);
+ throw new
Timeout
Exception(e);
}
}
}
}
@@
-118,7
+127,7
@@
public class ActorContext {
try {
return Await.result(future, AWAIT_DURATION);
} catch (Exception e) {
try {
return Await.result(future, AWAIT_DURATION);
} catch (Exception e) {
- throw new
Runtime
Exception(e);
+ throw new
Timeout
Exception(e);
}
}
}
}
@@
-131,7
+140,8
@@
public class ActorContext {
* @param shardName
* @param message
* @param duration
* @param shardName
* @param message
* @param duration
- * @throws java.lang.RuntimeException when a primary is not found or if the message to the remote shard fails or times out
+ * @throws org.opendaylight.controller.cluster.datastore.exceptions.TimeoutException if the message to the remote shard times out
+ * @throws org.opendaylight.controller.cluster.datastore.exceptions.PrimaryNotFoundException if the primary shard is not found
*
* @return
*/
*
* @return
*/
@@
-141,4
+151,8
@@
public class ActorContext {
return executeRemoteOperation(primary, message, duration);
}
return executeRemoteOperation(primary, message, duration);
}
+ public void shutdown() {
+ shardManager.tell(PoisonPill.getInstance(), null);
+ actorSystem.shutdown();
+ }
}
}