+
+ @Override
+ public void setAddShardReplica (String shardName) {
+ LOG.info ("addShardReplica initiated for shard {}", shardName);
+
+ // TODO addTimeout to be made configurable
+ Timeout addTimeOut = new Timeout(1, TimeUnit.MINUTES);
+ try {
+ Await.result(Patterns.ask(shardManager.getSelf(),
+ new AddShardReplica(shardName), addTimeOut),
+ addTimeOut.duration());
+ } catch (Exception ex) {
+ LOG.debug ("Obtained an exception during addShardReplica", ex);
+ throw (new RuntimeException(ex.getMessage()));
+ }
+ return;
+ }
+
+ @Override
+ public void setRemoveShardReplica (String shardName) {
+ LOG.info ("removeShardReplica initiated for shard {}", shardName);
+
+ // TODO remTimeOut to be made configurable
+ Timeout remTimeOut = new Timeout(30, TimeUnit.SECONDS);
+ try {
+ Await.result(Patterns.ask(shardManager.getSelf(),
+ new RemoveShardReplica(shardName), remTimeOut),
+ remTimeOut.duration());
+ } catch (Exception ex) {
+ LOG.debug ("Obtained an exception during removeShardReplica", ex);
+ throw (new RuntimeException(ex.getMessage()));
+ }
+ return;
+ }