コード例 #1
0
 private int getWaittimeBeforeFirstIPCheck() {
   int ret = 0;
   if (!storage.isIPCheckGloballyDisabled()) {
     // use own ipcheck if possible
     if (this.getActivePlugin().getIPCheckProvider() != null) {
       ret = this.getActivePlugin().getWaittimeBeforeFirstIPCheck();
     } else {
       ret = storage.getSecondsBeforeFirstIPCheck();
     }
   }
   // ip check disabled
   return Math.max(ret, 0);
 }
コード例 #2
0
 /**
  * Performs a reconnect with plugin plg.
  *
  * @param retry
  * @param plg
  * @return
  * @throws InterruptedException
  * @throws ReconnectException
  */
 protected final boolean doReconnect(final RouterPlugin plg, LogSource logger)
     throws InterruptedException, ReconnectException {
   final int waittime = Math.max(this.getWaittimeBeforeFirstIPCheck(), 0);
   // make sure that we have the current ip
   logger.info("IP Before=" + IPController.getInstance().getIP());
   try {
     final ReconnectInvoker invoker = plg.getReconnectInvoker();
     if (invoker == null) {
       throw new ReconnectException(
           "Reconnect Plugin  \"" + plg.getName() + "\" is not set up correctly. Invoker==null");
     }
     invoker.setLogger(logger);
     invoker.run();
     logger.finer("Initial Waittime: " + waittime + " seconds");
     Thread.sleep(waittime * 1000);
     return IPController.getInstance()
         .validateAndWait(
             this.getWaitForIPTime(),
             Math.max(0, storage.getSecondsToWaitForOffline()),
             this.getIpCheckInterval());
   } catch (RuntimeException e) {
     logger.log(e);
     throw new ReconnectException(e);
   } finally {
     logger.info("IP AFTER=" + IPController.getInstance().getIP());
   }
 }
コード例 #3
0
 /**
  * returns how long the controller has to wait between two ip checks
  *
  * @return
  */
 private int getIpCheckInterval() {
   int ret = 0;
   if (!storage.isIPCheckGloballyDisabled()) {
     // use own ipcheck if possible
     if (this.getActivePlugin().getIPCheckProvider() != null) {
       ret = this.getActivePlugin().getIPCheckProvider().getIpCheckInterval();
     } else {
       ret = 5;
     }
   }
   // ip check disabled
   return Math.max(ret, 0);
 }
コード例 #4
0
 /**
  * returns the currently active routerplugin. Only one plugin may be active
  *
  * @return
  */
 public RouterPlugin getActivePlugin() {
   // convert only once
   String id = storage.getActivePluginID();
   if (id == null) {
     id = this.convertFromOldSystem();
     this.storage.setActivePluginID(id);
   }
   RouterPlugin active = ReconnectPluginController.getInstance().getPluginByID(id);
   if (active == null) {
     active = DummyRouterPlugin.getInstance();
     this.storage.setActivePluginID(active.getID());
   }
   return active;
 }
コード例 #5
0
 private int getWaitForIPTime() {
   return Math.max(storage.getSecondsToWaitForIPChange(), 0);
 }