コード例 #1
0
 /**
  * If there are no more blocks, cancel the SubSegment, remove it from the segment, and return
  * true; the caller must call kill(,,true,true). Else return false.
  *
  * @param container
  * @param context
  * @return
  */
 public boolean possiblyRemoveFromParent(ObjectContainer container, ClientContext context) {
   if (persistent) {
     container.activate(this, 1);
     container.activate(segment, 1);
     container.activate(blockNums, 1);
   }
   if (logMINOR) Logger.minor(this, "Possibly removing from parent: " + this);
   synchronized (segment) {
     if (!blockNums.isEmpty()) {
       if (persistent) container.deactivate(blockNums, 1);
       return false;
     }
     if (logMINOR) Logger.minor(this, "Definitely removing from parent: " + this);
     if (!segment.maybeRemoveSeg(this, container)) {
       if (persistent) container.deactivate(blockNums, 1);
       return false;
     }
     cancelled = true;
   }
   return true;
 }