+ @GuardedBy("this")
+ private void sendAskForMasterMountPointWithRetries(final AskForMasterMountPoint askForMasterMountPoint,
+ final ActorSelection masterActor, final int tries, final int updateCount) {
+ final Future<Object> future = Patterns.ask(masterActor, askForMasterMountPoint, actorResponseWaitTime);
+ future.onComplete(new OnComplete<Object>() {
+ @Override
+ public void onComplete(final Throwable failure, final Object response) {
+ synchronized (this) {
+ // Ignore the response if we were since closed or another notification update occurred.
+ if (closed || updateCount != lastUpdateCount) {
+ return;
+ }
+
+ if (failure instanceof AskTimeoutException) {
+ if (tries <= 5 || tries % 10 == 0) {
+ LOG.warn("{}: Failed to send message to {} - retrying...", id, masterActor, failure);
+ }
+ sendAskForMasterMountPointWithRetries(askForMasterMountPoint, masterActor, tries + 1,
+ updateCount);
+ } else if (failure != null) {
+ LOG.error("{}: Failed to send message {} to {}. Slave mount point could not be created",
+ id, askForMasterMountPoint, masterActor, failure);
+ } else {
+ LOG.debug("{}: {} message to {} succeeded", id, askForMasterMountPoint, masterActor);
+ }
+ }
+ }
+ }, setup.getActorSystem().dispatcher());
+ }
+
+ @GuardedBy("this")