Deprecate the current batch and create a new one. The old one will still
be active until all writers have finished writing their current blocks
to it.
496496
void roll() {
        m_batchLock.writeLock().lock();
        final PeriodicExportContext previous = m_current;
        try {
            m_current = new PeriodicExportContext();

            m_logger.trace("Rolling batch.");

            for( ExportToFileDecoder decoder : m_tableDecoders.values()) {
                decoder.resetWriter();
            }

        }
        finally {
            m_batchLock.writeLock().unlock();
        }
        previous.closeAllWriters();
    }
15021
def reset(self):
        """"""
        if self.shuffle:
            self._shuffle_data()
        # the range below indicate the last batch
        if self.last_batch_handle == 'roll_over' and \
            self.num_data - self.batch_size < self.cursor < self.num_data:
            # (self.cursor - self.num_data) represents the data we have for the last batch
            self.cursor = self.cursor - self.num_data - self.batch_size
        else:
            self.cursor = -self.batch_size
1352410
public void updateBatch(V batch) {

        if (intervalCheck.check()) {
            rolling();
        }
        synchronized (this) {
            unflushed = updater.updateBatch(batch, unflushed);
        }

    }
504952
private function commitBatch() {

        //Check if there are any operations and commit the batch
        if(count($this->batch->getOperations()))
        {
            $this->client->commitBatch();
        }

        //There are no operations, just end the batch
        else
        {
            $this->client->endBatch();
        }

        //Delete the batch
        $this->batch = null;

    }
369906
def rebuild( self ):
        
        plugins.init()
        
        self.blockSignals(True)
        self.setUpdatesEnabled(False)
        
        # clear the old editor
        if ( self._editor ):
            self._editor.close()
            self._editor.setParent(None)
            self._editor.deleteLater()
            self._editor = None
        
        # create a new widget
        plugin_class = plugins.widgets.get(self._columnType)
        if ( plugin_class ):
            self._editor = plugin_class(self)
            self.layout().addWidget(self._editor)
        
        self.blockSignals(False)
        self.setUpdatesEnabled(True)
825244
public void batchWrite(List<? extends Object> objectsToWrite, List<? extends Object> objectsToDelete) {
        batchWrite(objectsToWrite, objectsToDelete, this.config);
    }
773667
public void batchDelete(Object... objectsToDelete) {
        batchWrite(Collections.emptyList(), Arrays.asList(objectsToDelete), this.config);
    }
448331
def removeWriter(self, selectable):
        """"""
        try:
            if selectable.disconnected:
                self._writes[selectable].kill(block=False)
                del self._writes[selectable]
            else:
                self._writes[selectable].pause()
        except KeyError:
            pass
1167579
public boolean abandonBlock(Block b, String src, String holder
  ) throws IOException {
    writeLock();
    try {
      //
      // Remove the block from the pending creates list
      //
      if (NameNode.stateChangeLog.isDebugEnabled()) {
        NameNode.stateChangeLog.debug("BLOCK* NameSystem.abandonBlock: "
          + b + "of file " + src);
      }
      if (isInSafeMode()) {
        throw new SafeModeException("Cannot abandon block " + b +
          " for fle" + src, safeMode);
      }
      INodeFileUnderConstruction file = checkLease(src, holder);
      dir.removeBlock(src, file, b);
      if (NameNode.stateChangeLog.isDebugEnabled()) {
        NameNode.stateChangeLog.debug("BLOCK* NameSystem.abandonBlock: "
          + b
          + " is removed from pendingCreates");
      }
      return true;
    } finally {
      writeUnlock();
    }
  }
78463
def update_next_block(self):
        
        last = self.mem[-1]
        if last.inst not in ('ret', 'jp', 'jr') or last.condition_flag is not None:
            return

        if last.inst == 'ret':
            if self.next is not None:
                self.next.delete_from(self)
                self.delete_goes(self.next)
            return

        if last.opers[0] not in LABELS.keys():
            __DEBUG__("INFO: %s is not defined. No optimization is done." % last.opers[0], 2)
            LABELS[last.opers[0]] = LabelInfo(last.opers[0], 0, DummyBasicBlock(ALL_REGS, ALL_REGS))

        n_block = LABELS[last.opers[0]].basic_block
        if self.next is n_block:
            return

        if self.next.prev == self:
            # The next basic block is not this one since it ends with a jump
            self.next.delete_from(self)
            self.delete_goes(self.next)

        self.next = n_block
        self.next.add_comes_from(self)
        self.add_goes_to(self.next)
488831
def delete_from(self, basic_block):
        
        if basic_block is None:
            return

        if self.lock:
            return

        self.lock = True

        if self.prev is basic_block:
            if self.prev.next is self:
                self.prev.next = None
            self.prev = None

        for i in range(len(self.comes_from)):
            if self.comes_from[i] is basic_block:
                self.comes_from.pop(i)
                break

        self.lock = False
417582
public void addBlocksToDelete(List<Long> blocks) {
    for (long id : blocks) {
      if (mRemovingBlocks.contains(id)) {
        LOG.debug("{} is being removed. Current queue size is {}.", id, mBlocksToRemove.size());
        continue;
      }
      try {
        mBlocksToRemove.put(id);
        mRemovingBlocks.add(id);
      } catch (InterruptedException e) {
        Thread.currentThread().interrupt();
        LOG.warn("AsyncBlockRemover got interrupted while it was putting block {}.", id);
      }
    }
  }
220998
public function reset()
    {
        $this->numRequests  = 0;
        $this->numProcessed = 0;

        $this->currItem                 = null;
        $this->resumptionToken          = null;
        $this->totalRecordsInCollection = null;
        $this->expireDate               = null;

        $this->batch = [];
    }
583733
private void noSuccessor() {
        if (compute == FRAMES) {
            Label l = new Label();
            l.frame = new Frame();
            l.frame.owner = l;
            l.resolve(this, code.length, code.data);
            previousBlock.successor = l;
            previousBlock = l;
        } else {
            currentBlock.outputStackMax = maxStackSize;
        }
        currentBlock = null;
    }
467218
private void clear(Object caller, int version) {
        assert mutation_in_progress(caller, version);
        _buf_limit = 0;
        for (int ii=0; ii<_blocks.size(); ii++) {
            _blocks.get(ii).clearBlock();
            // _blocks.get(ii)._idx = -1; this is done in clearBlock()
        }
        bbBlock first = _blocks.get(0);
        first._idx = 0;                        // cas: 26 dec 2008
        first._offset = 0;
        first._limit = 0;
        _next_block_position = 1;
        return;
    }
463092
@Deprecated
    public void reset() {
        if (!isIoAligned() || getIoThread() == Thread.currentThread()) {
            reset0();
        }
        else {
            getIoExecutor().execute(new Runnable() {
                @Override
                public void run() {
                    reset0();
                }

            });
        }
    }
345369
def _dequeue_batch(self) -> Optional[Batch]:
        
        if self._enqueueing_thread is None:
            raise ValueError('StreamWrapper `{}` with buffer of size `{}` was used outside with-resource environment.'
                             .format(self._name, self._buffer_size))
        if not self._enqueueing_thread.is_alive() and self._queue.empty():
            self._start_thread()
        while True:
            try:
                batch = self._queue.get(timeout=2)
                self._queue.task_done()
                break
            except Empty:
                if not self._enqueueing_thread.is_alive():
                    try:
                        # the enqueueing thread may just finished properly so lets check the queue eagerly
                        batch = self._queue.get_nowait()
                        self._queue.task_done()
                        break
                    except Empty:
                        # so we failed to retrieve a batch and the enqueueing thread is dead
                        # there is no hope, something must went wrong
                        raise ChildProcessError('Enqueueing thread ended unexpectedly.')
        return batch