コード例 #1
0
 // Note also called reflectively by BrooklynLeakListener
 @Beta
 public static int terminateAll() {
   int closed = 0, dangling = 0;
   for (LocalManagementContext context : getInstances()) {
     try {
       context.terminate();
       closed++;
     } catch (Throwable t) {
       Exceptions.propagateIfFatal(t);
       log.warn("Failed to terminate management context", t);
       dangling++;
     }
   }
   if (dangling > 0) return -dangling;
   return closed;
 }
コード例 #2
0
 @Override
 protected void finalize() {
   terminate();
 }