public synchronized boolean canBeDeallocate(){
  if (shareCounter > 0 || isBeingDeallocate) {
    return false;
  }
  if (!inCache.get()) {
    isBeingDeallocate=true;
    return true;
  }
  return false;
}

public synchronized boolean canBeDeallocate ( ) { if ( shareCounter > 0 || isBeingDeallocate ) { return false ; } if ( ! inCache . get ( ) ) { isBeingDeallocate = true ; return true ; } return false ; }
asked if can be deallocate ( is not shared in other statement and not in cache ) set deallocate flag to true if so .
