/*
@desc - Synchronous del
174603
function(key) {
    var filepath = this._makeFilepath(key);

    if (!fs.existsSync(filepath)) {
      return;
    }

    fs.unlinkSync(filepath);
  }
618203
public void deleteAll(final SuccessCallback<Integer> successCallback, final ErrorCallback errorCallback) {
        delete(null, null, successCallback, errorCallback);
    }
127971
private static int doDeleteAll(CallInfo callInfo, Table table) {
    DB db = table.getDB();
    return db.access(callInfo, () -> {
      String sql = DELETE_FROM_ + table.getName();
      db.logSetup(callInfo, sql);
      try (WrappedStatement ws = db.compile(sql)) {
        return ws.getStatement().executeUpdate();
      }
    });
  }
888151
@Override
    public void deleteGroup(IEntityGroup group) throws GroupsException {
        throwExceptionIfNotInternallyManaged();
        synchronizeGroupMembersOnDelete(group);
        getGroupStore().delete(group);
        if (cacheInUse()) {
            cacheRemove(group);
        }
    }
1023087
public void destroy() {
		// Synchronize, in case multiCadiFilters are used.
		synchronized(CadiHTTPManip.noAdditional) {
			if(--count<=0 && httpChecker!=null) {
				httpChecker.destroy();
				httpChecker=null;
				access=null;
				pathExceptions=null;
			}
		}
	}
957840
@Override
	public void delete() throws JMSException
    {
        BlockBasedDataStoreTools.delete(queueDef.getName(), 
                                        queueDef.getDataFolder(), 
                                        false);  
    }
1024495
void channelCloses(final SynchronizeFXTomcatChannel synchronizeFXTomcatChannel) {
        synchronized (channels) {
            if (isCurrentlyShutingDown) {
                return;
            }
        }
        synchronized (channels) {
            // Maybe a bit inefficient but the alternative would be to pass cannelName and SynchronizeFxServer to the
            // channel just to be able to close itself.
            final Iterator<Entry<String, SynchronizeFXTomcatChannel>> channelIterator = channels.entrySet().iterator();
            while (channelIterator.hasNext()) {
                if (channelIterator.next().getValue().equals(synchronizeFXTomcatChannel)) {
                    channelIterator.remove();
                }
            }

            final Iterator<Entry<SynchronizeFxServer, SynchronizeFXTomcatChannel>> serverIterator =
                    servers.entrySet().iterator();
            while (serverIterator.hasNext()) {
                if (serverIterator.next().getValue().equals(synchronizeFXTomcatChannel)) {
                    serverIterator.remove();
                }
            }
        }
    }
1141477
function () {
                this.$destructor(); // call $destructor
                // TODO - cleanup object
                if (this._listeners) {
                    this._listeners = null;
                    delete this._listeners;
                }
                if (this.__$interceptors) {
                    this.__$interceptors = null;
                    delete this.__$interceptors;
                }
                if (this.__$interfaces) {
                    require("./Interfaces").disposeInterfaces(this);
                }
            }
198641
function(_id,_clazz){
            if (_cache[_id]!==-1){
                _cache[_id] = -1;
                _e._$delClassName(_id,_clazz);
            }
        }
1142780
function postDeleteXSetMember (req, res, next) {
  let key = req.body.key;
  let timestamp = req.body.timestamp;
  let connectionId = req.body.connectionId;
  getConnection(req, res, function () {
      deleteXSetMember(key, timestamp, res, next);
  }, connectionId);
}
948632
protected synchronized boolean cancel(Object x) {
        // First check the expedited buffer
        synchronized (lock) {
            if (expeditedPutIndex > expeditedTakeIndex) {
                for (int i = expeditedTakeIndex; i < expeditedPutIndex; i++) {
                    if (expeditedBuffer[i] == x) {
                        System.arraycopy(expeditedBuffer, i + 1, expeditedBuffer, i, expeditedPutIndex - i - 1);
                        expeditedPutIndex--;
                        expeditedBuffer[expeditedPutIndex] = null;
                        numberOfUsedExpeditedSlots.getAndDecrement(); // D615053
                        return true;
                    }
                }
            } else if (expeditedPutIndex != expeditedTakeIndex || expeditedBuffer[expeditedTakeIndex] != null) {
                for (int i = expeditedTakeIndex; i < buffer.length; i++) {
                    if (expeditedBuffer[i] == x) {
                        if (i != expeditedBuffer.length - 1) {
                            System.arraycopy(expeditedBuffer, i + 1, expeditedBuffer, i, expeditedBuffer.length - i - 1);
                        }

                        if (expeditedPutIndex != 0) {
                            expeditedBuffer[expeditedBuffer.length - 1] = expeditedBuffer[0];
                            System.arraycopy(expeditedBuffer, 1, expeditedBuffer, 0, expeditedPutIndex - 1);
                            expeditedPutIndex--;
                        } else {
                            expeditedPutIndex = expeditedBuffer.length - 1;
                        }

                        expeditedBuffer[expeditedPutIndex] = null;
                        numberOfUsedExpeditedSlots.getAndDecrement(); // D615053
                        return true;
                    }
                }

                // D610567 - Scan first section of expedited BoundedBuffer
                for (int i = 0; i < expeditedPutIndex; i++) {
                    if (expeditedBuffer[i] == x) {
                        System.arraycopy(expeditedBuffer, i + 1, expeditedBuffer, i, expeditedPutIndex - i - 1);
                        expeditedPutIndex--;
                        expeditedBuffer[expeditedPutIndex] = null;
                        numberOfUsedExpeditedSlots.getAndDecrement(); // D615053
                        return true;
                    }
                }

            }
            // Next check the main buffer
            if (putIndex > takeIndex) {
                for (int i = takeIndex; i < putIndex; i++) {
                    if (buffer[i] == x) {
                        System.arraycopy(buffer, i + 1, buffer, i, putIndex - i - 1);
                        putIndex--;
                        buffer[putIndex] = null;
                        numberOfUsedSlots.getAndDecrement(); // D615053
                        return true;
                    }
                }
            } else if (putIndex != takeIndex || buffer[takeIndex] != null) {
                for (int i = takeIndex; i < buffer.length; i++) {
                    if (buffer[i] == x) {
                        if (i != buffer.length - 1) {
                            System.arraycopy(buffer, i + 1, buffer, i, buffer.length - i - 1);
                        }

                        if (putIndex != 0) {
                            buffer[buffer.length - 1] = buffer[0];
                            System.arraycopy(buffer, 1, buffer, 0, putIndex - 1);
                            putIndex--;
                        } else {
                            putIndex = buffer.length - 1;
                        }

                        buffer[putIndex] = null;
                        numberOfUsedSlots.getAndDecrement(); // D615053
                        return true;
                    }
                }

                // D610567 - Scan first section of BoundedBuffer
                for (int i = 0; i < putIndex; i++) {
                    if (buffer[i] == x) {
                        System.arraycopy(buffer, i + 1, buffer, i, putIndex - i - 1);
                        putIndex--;
                        buffer[putIndex] = null;
                        numberOfUsedSlots.getAndDecrement(); // D615053
                        return true;
                    }
                }

            }
        }

        return false;
    }
1221254
public void delCacheEntry(ValueSet removeList, int cause, int source, boolean fromDepIdTemplateInvalidation, boolean fireEvent) {
        htod.delCacheEntry(removeList, cause, source, fromDepIdTemplateInvalidation, fireEvent);
    }
663457
@Override
	public final int delete(int handle) throws DataStoreException
    {
        if (SAFE_MODE) checkHandle(handle);
        
        int previousHandle = previousBlock[handle];
          
        int current = handle;
        int nextHandle = -1;
        while (current != -1)
        {
            nextHandle = nextBlock[current];
            boolean isEndBlock = (flags[current] & FLAG_END_BLOCK) > 0;
            
            // Clear block entry
            flags[current] = 0;
            allocatedSize[current] = -1;
            previousBlock[current] = -1;
            nextBlock[current] = -1;
            locks.clear(current);
            
            // Update used blocks count
            blocksInUse--;
            
            writeAllocationBlock(current);
            
            if (isEndBlock)
                break;  
            current = nextHandle;
        }     
        // Reconnect chain
        if (nextHandle != -1)
        {
            previousBlock[nextHandle] = previousHandle;
            writeAllocationBlock(nextHandle);
        }
        if (previousHandle != -1)
        {
            nextBlock[previousHandle] = nextHandle;
            writeAllocationBlock(previousHandle);
        }

        // Update first block if necessary
        if (firstBlock == handle)
        {
            firstBlock = nextHandle;
            writeFirstBlock();
        }
        
        size--;
        
        flush();
        
        // Find previous object start from previous block handle
        while (previousHandle != -1 && (flags[previousHandle] & FLAG_START_BLOCK) == 0)
        	previousHandle = previousBlock[previousHandle];
        
        return previousHandle;
    }
960527
private function cleanup(OutputInterface $output, NodeInterface $node, $rootPath, $dryRun)
    {
        foreach ($node->getNodes() as $childNode) {
            $this->cleanup($output, $childNode, $rootPath, $dryRun);
        }

        $path = ltrim(str_replace($rootPath, '', $node->getPath()), '/');

        if (!$node->getPropertyValueWithDefault('sulu:history', false)) {
            $output->writeln(
                '<info>Processing aborted: </info>/' .
                $path . ' <comment>(no history url)</comment>'
            );

            return;
        }

        if (false === $dryRun) {
            $node->remove();
        }
        $output->writeln('<info>Processing: </info>/' . $path);
    }
388521
@Override
    public Collection<Bean> delete(String schemaName, Collection<String> instanceIds)
            throws AbortRuntimeException {
        init();
        Map<BeanId, Bean> deleted = list(schemaName, instanceIds);
        Set<HBeanRow> rows = new HashSet<>();
        for (String id : instanceIds) {
            rows.add(new HBeanRow(BeanId.create(id, schemaName), uids));
        }
        try {
            rows = table.getEager(rows).getRows();
            ArrayList<BeanId> predecessors = new ArrayList<>();
            for (HBeanRow row : rows) {
                for (BeanId id : row.getPredecessorsBeanIds()) {
                    predecessors.add(id);
                }
            }
            if (predecessors.size() > 0) {
                throw Events.CFG302_CANNOT_DELETE_BEAN(predecessors);
            }
        } catch (HBeanNotFoundException e) {
            throw Events.CFG304_BEAN_DOESNT_EXIST(e.getNotFound().iterator().next());
        }
        table.delete(rows);
        return deleted.values();
    }
541810
@CheckReturnValue
  LocalSyncWriteModelContainer desyncDocumentsFromRemote(
      final NamespaceSynchronizationConfig nsConfig,
      final BsonValue... documentIds) {
    this.waitUntilInitialized();
    final MongoNamespace namespace = nsConfig.getNamespace();
    final Lock lock = this.syncConfig.getNamespaceConfig(namespace).getLock().writeLock();
    lock.lock();
    final DeleteManyModel<CoreDocumentSynchronizationConfig> configsToDelete;
    try {
      ongoingOperationsGroup.enter();
      configsToDelete = syncConfig.removeSynchronizedDocuments(namespace, documentIds);
    } finally {
      lock.unlock();
      ongoingOperationsGroup.exit();
    }

    LocalSyncWriteModelContainer container = null;
    if (configsToDelete != null) {
      container = newWriteModelContainer(nsConfig);
      container.addDocIDs(documentIds);
      container.addLocalWrite(new DeleteManyModel<>(
          new BsonDocument("_id",
              new BsonDocument("$in", new BsonArray(Arrays.asList(documentIds))))
      ));
      container.addConfigWrite(configsToDelete);
    }

    return container;
  }
674555
@Override
	public void purge(long tillWhen){
		Long t;
		while((t = ((NavigableMap<Long, AtomicLong>)counters.getMap()).firstKey()) != null && t < tillWhen){
			counters.remove(t);
		}
	}