Package org.apache.bookkeeper.util

Examples of org.apache.bookkeeper.util.SafeRunnable


     * @param ctx
     * @param rc
     */
    void asyncCloseInternal(final CloseCallback cb, final Object ctx, final int rc) {
        bk.mainWorkerPool.submitOrdered(ledgerId, new SafeRunnable() {

            @Override
            public void safeRun() {
                metadata.length = length;
                // Close operation is idempotent, so no need to check if we are
View Full Code Here


            cb.addComplete(BKException.Code.InterruptedException,
                           LedgerHandle.this, -1, ctx);
        }

        try {
            bk.mainWorkerPool.submitOrdered(ledgerId, new SafeRunnable() {
                @Override
                public void safeRun() {
                    if (metadata.isClosed()) {
                        LOG.warn("Attempt to add to closed ledger: " + ledgerId);
                        LedgerHandle.this.opCounterSem.release();
View Full Code Here

        writeLedgerConfig(new StatCallback() {
            @Override
            public void processResult(final int rc, String path, Object ctx, final Stat stat) {

                bk.mainWorkerPool.submitOrdered(ledgerId, new SafeRunnable() {
                    @Override
                    public void safeRun() {
                        if (rc != KeeperException.Code.OK.intValue()) {
                            LOG
                            .error("Could not persist ledger metadata while changing ensemble to: "
View Full Code Here

            channel.close().awaitUninterruptibly();
        }
    }

    void errorOutReadKey(final CompletionKey key) {
        executor.submitOrdered(key.ledgerId, new SafeRunnable() {
            @Override
            public void safeRun() {

                ReadCompletion readCompletion = readCompletions.remove(key);
View Full Code Here

        });
    }

    void errorOutAddKey(final CompletionKey key) {
        executor.submitOrdered(key.ledgerId, new SafeRunnable() {
            @Override
            public void safeRun() {

                AddCompletion addCompletion = addCompletions.remove(key);
View Full Code Here

        } catch (IndexOutOfBoundsException ex) {
            LOG.error("Unparseable response from bookie: " + addr, ex);
            return;
        }

        executor.submitOrdered(ledgerId, new SafeRunnable() {
            @Override
            public void safeRun() {
                switch (header.getOpCode()) {
                case BookieProtocol.ADDENTRY:
                    handleAddResponse(ledgerId, entryId, rc);
View Full Code Here

   * @param ctx
   * @param rc
   */
  private void asyncClose(final CloseCallback cb, final Object ctx, final int rc) {

    bk.mainWorkerPool.submitOrdered(ledgerId, new SafeRunnable() {

      @Override
      public void safeRun() {
        // Close operation is idempotent, so no need to check if we are
        // already closed
View Full Code Here

   * @param ctx
   *          some control object
   */
  public void asyncAddEntry(final byte[] data, final AddCallback cb,
      final Object ctx) {
    bk.mainWorkerPool.submitOrdered(ledgerId, new SafeRunnable() {
      @Override
      public void safeRun() {
        if (metadata.isClosed()) {
          LOG.warn("Attempt to add to closed ledger: " + ledgerId);
          cb.addComplete(BKException.Code.LedgerClosedException,
View Full Code Here

    writeLedgerConfig(new StatCallback() {
      @Override
      public void processResult(final int rc, String path, Object ctx, Stat stat) {

        bk.mainWorkerPool.submitOrdered(ledgerId, new SafeRunnable() {
          @Override
          public void safeRun() {
            if (rc != KeeperException.Code.OK.intValue()) {
              LOG
                  .error("Could not persist ledger metadata while changing ensemble to: "
View Full Code Here

        if (!keepRunning) {
            return;
        }
        try {
            numPendingRequests.incrementAndGet();
            cacheWorkers.submitOrdered(topic, new SafeRunnable() {
                @Override
                public void safeRun() {
                    numPendingRequests.decrementAndGet();
                    obj.performRequest();
                }
View Full Code Here

TOP

Related Classes of org.apache.bookkeeper.util.SafeRunnable

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.