Exemplo n.º 1
0
 @Override
 public Boolean remove(Object scope) {
   log.debug("Remove child scope: {}", scope);
   // log.trace("remove - Hold counts - read: {} write: {} queued: {}",
   // internalLock.getReadHoldCount(), internalLock.getWriteHoldCount(),
   // internalLock.hasQueuedThreads());
   if (hasHandler()) {
     IScopeHandler hdlr = getHandler();
     log.debug("Removing child scope: {}", (((IBasicScope) scope).getName()));
     hdlr.removeChildScope((IBasicScope) scope);
     if (scope instanceof Scope) {
       // cast it
       Scope scp = (Scope) scope;
       // stop the scope
       scp.stop();
     }
   } else {
     log.debug("No handler found for {}", this);
   }
   boolean removed = false;
   try {
     if (containsKey(scope)) {
       // remove the entry, ensure removed value is equal to the given object
       removed = super.remove(scope).equals(Boolean.TRUE);
       if (removed) {
         subscopeStats.decrement();
       } else {
         log.debug("Subscope was not removed");
       }
     } else {
       log.debug("Subscope was not removed, it was not found");
     }
   } catch (Exception e) {
     log.warn("Exception on remove", e);
   }
   return removed;
 }