当前位置: 首页>>代码示例>>Java>>正文


Java Future.Void方法代码示例

本文整理汇总了Java中com.twitter.util.Future.Void方法的典型用法代码示例。如果您正苦于以下问题:Java Future.Void方法的具体用法?Java Future.Void怎么用?Java Future.Void使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.twitter.util.Future的用法示例。


在下文中一共展示了Future.Void方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: transaction

import com.twitter.util.Future; //导入方法依赖的package包/类
@Override
public Transaction<Object> transaction() {
    return new Transaction<Object>() {
        @Override
        public void addOp(Op<Object> operation) {
            // no-op
        }

        @Override
        public Future<Void> execute() {
            return Future.Void();
        }

        @Override
        public void abort(Throwable reason) {
            // no-op
        }
    };
}
 
开发者ID:twitter,项目名称:distributedlog,代码行数:20,代码来源:DryrunLogSegmentMetadataStoreUpdater.java

示例2: setAcceptNewStream

import com.twitter.util.Future; //导入方法依赖的package包/类
@Override
public Future<Void> setAcceptNewStream(boolean enabled) {
    closeLock.writeLock().lock();
    try {
        logger.info("Set AcceptNewStream = {}", enabled);
        if (ServerStatus.DOWN != serverStatus) {
            if (enabled) {
                serverStatus = ServerStatus.WRITE_AND_ACCEPT;
            } else {
                serverStatus = ServerStatus.WRITE_ONLY;
            }
        }
    } finally {
        closeLock.writeLock().unlock();
    }
    return Future.Void();
}
 
开发者ID:twitter,项目名称:distributedlog,代码行数:18,代码来源:DistributedLogServiceImpl.java

示例3: apply

import com.twitter.util.Future; //导入方法依赖的package包/类
@Override public Future<Void> apply(byte[] responseBytes) {
  TBinaryProtocol iprot = new TBinaryProtocol(new TMemoryInputTransport(responseBytes));
  try {
    if (InternalScribeCodec.readLogResponse(0, iprot)) {
      return Future.Void();
    } else {
      return Future.exception(new IllegalStateException("try later"));
    }
  } catch (Exception e) {
    return Future.exception(e);
  }
}
 
开发者ID:openzipkin,项目名称:zipkin-finagle,代码行数:13,代码来源:ScribeSender.java

示例4: unlockHandler

import com.twitter.util.Future; //导入方法依赖的package包/类
Future<Void> unlockHandler() {
    if (null != lockFuture) {
        return lock.asyncClose();
    } else {
        return Future.Void();
    }
}
 
开发者ID:twitter,项目名称:distributedlog,代码行数:8,代码来源:BKLogWriteHandler.java

示例5: asyncClose

import com.twitter.util.Future; //导入方法依赖的package包/类
@Override
public Future<Void> asyncClose() {
    LOG.info("Stopping Readahead worker for {}", fullyQualifiedName);
    running = false;

    this.zkc.getWatcherManager()
            .unregisterChildWatcher(this.logMetadata.getLogSegmentsPath(), this);

    // Aside from unfortunate naming of variables, this allows
    // the currently active long poll to be interrupted and completed
    AsyncNotification notification;
    synchronized (notificationLock) {
        notification = metadataNotification;
        metadataNotification = null;
    }
    if (null != notification) {
        notification.notifyOnOperationComplete();
    }
    if (null == stopPromise) {
        return Future.Void();
    }
    return FutureUtils.ignore(FutureUtils.within(
            stopPromise,
            2 * conf.getReadAheadWaitTime(),
            TimeUnit.MILLISECONDS,
            new TimeoutException("Timeout on waiting for ReadAhead worker to stop " + fullyQualifiedName),
            scheduler,
            fullyQualifiedName));
}
 
开发者ID:twitter,项目名称:distributedlog,代码行数:30,代码来源:ReadAheadWorker.java

示例6: asyncClose

import com.twitter.util.Future; //导入方法依赖的package包/类
public static Future<Void> asyncClose(@Nullable AsyncCloseable closeable,
                                      boolean swallowIOException) {
    if (null == closeable) {
        return Future.Void();
    } else if (swallowIOException) {
        return FutureUtils.ignore(closeable.asyncClose());
    } else {
        return closeable.asyncClose();
    }
}
 
开发者ID:twitter,项目名称:distributedlog,代码行数:11,代码来源:Utils.java

示例7: asyncAbort

import com.twitter.util.Future; //导入方法依赖的package包/类
public static Future<Void> asyncAbort(@Nullable AsyncAbortable abortable,
                                      boolean swallowIOException) {
    if (null == abortable) {
        return Future.Void();
    } else if (swallowIOException) {
        return FutureUtils.ignore(abortable.asyncAbort());
    } else {
        return abortable.asyncAbort();
    }
}
 
开发者ID:twitter,项目名称:distributedlog,代码行数:11,代码来源:Abortables.java

示例8: asyncClose

import com.twitter.util.Future; //导入方法依赖的package包/类
@Override
public Future<Void> asyncClose() {
    return Future.Void();
}
 
开发者ID:twitter,项目名称:distributedlog,代码行数:5,代码来源:NopDistributedLock.java

示例9: asyncClose

import com.twitter.util.Future; //导入方法依赖的package包/类
@Override
public Future<Void> asyncClose() {
    // No-op
    this.zooKeeperClient.getWatcherManager().unregisterChildWatcher(logMetadata.getLogSegmentsPath(), this);
    return Future.Void();
}
 
开发者ID:twitter,项目名称:distributedlog,代码行数:7,代码来源:BKLogHandler.java

示例10: asyncClose

import com.twitter.util.Future; //导入方法依赖的package包/类
/**
 * Close the distributed log manager, freeing any resources it may hold.
 */
@Override
public Future<Void> asyncClose() {
    Promise<Void> closeFuture;
    BKLogReadHandler readHandlerToClose;
    synchronized (this) {
        if (null != closePromise) {
            return closePromise;
        }
        closeFuture = closePromise = new Promise<Void>();
        readHandlerToClose = readHandlerForListener;
    }

    // NOTE: the resources {scheduler, writerBKC, readerBKC} are mostly from namespace instance.
    //       so they are not blocking call except tests.
    AsyncCloseable resourcesCloseable = new AsyncCloseable() {
        @Override
        public Future<Void> asyncClose() {
            int schedTimeout = conf.getSchedulerShutdownTimeoutMs();

            // Clean up executor state.
            if (ownExecutor) {
                SchedulerUtils.shutdownScheduler(scheduler, schedTimeout, TimeUnit.MILLISECONDS);
                LOG.info("Stopped BKDL executor service for {}.", name);

                if (scheduler != readAheadScheduler) {
                    SchedulerUtils.shutdownScheduler(readAheadScheduler, schedTimeout, TimeUnit.MILLISECONDS);
                    LOG.info("Stopped BKDL ReadAhead Executor Service for {}.", name);
                }

                SchedulerUtils.shutdownScheduler(getLockStateExecutor(false), schedTimeout, TimeUnit.MILLISECONDS);
                LOG.info("Stopped BKDL Lock State Executor for {}.", name);
            }
            if (ownWriterBKC) {
                writerBKC.close();
            }
            if (ownReaderBKC) {
                readerBKC.close();
            }
            return Future.Void();
        }
    };

    Future<Void> closeResult = Utils.closeSequence(null, true,
            readHandlerToClose,
            pendingReaders,
            resourcesCloseable,
            new AsyncCloseable() {
                @Override
                public Future<Void> asyncClose() {
                    return BKDistributedLogManager.super.asyncClose();
                }
            });
    closeResult.proxyTo(closeFuture);
    return closeFuture;
}
 
开发者ID:twitter,项目名称:distributedlog,代码行数:59,代码来源:BKDistributedLogManager.java

示例11: asyncAbort

import com.twitter.util.Future; //导入方法依赖的package包/类
@Override
public Future<Void> asyncAbort() {
    return Future.Void();
}
 
开发者ID:twitter,项目名称:distributedlog,代码行数:5,代码来源:AsyncAbortable.java


注:本文中的com.twitter.util.Future.Void方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。