コード例 #1
0
ファイル: EIPManager.java プロジェクト: reneploetz/eureka
 @PreDestroy
 public void shutdown() throws Exception {
   timer.cancel();
   for (int i = 0; i < serverConfig.getEIPBindRebindRetries(); i++) {
     try {
       unbindEIP();
       break;
     } catch (Exception e) {
       logger.warn("Cannot unbind the EIP from the instance");
       Thread.sleep(1000);
     }
   }
 }
コード例 #2
0
ファイル: EIPManager.java プロジェクト: reneploetz/eureka
 /**
  * Handles EIP binding process in AWS Cloud.
  *
  * @throws InterruptedException
  */
 private void handleEIPBinding() throws InterruptedException {
   int retries = serverConfig.getEIPBindRebindRetries();
   // Bind to EIP if needed
   for (int i = 0; i < retries; i++) {
     try {
       if (isEIPBound()) {
         break;
       } else {
         bindEIP();
       }
     } catch (Throwable e) {
       logger.error("Cannot bind to EIP", e);
       Thread.sleep(EIP_BIND_SLEEP_TIME_MS);
     }
   }
   // Schedule a timer which periodically checks for EIP binding.
   timer.schedule(new EIPBindingTask(), serverConfig.getEIPBindingRetryIntervalMsWhenUnbound());
 }