本文整理汇总了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
}
};
}
示例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();
}
示例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);
}
}
示例4: unlockHandler
import com.twitter.util.Future; //导入方法依赖的package包/类
Future<Void> unlockHandler() {
if (null != lockFuture) {
return lock.asyncClose();
} else {
return Future.Void();
}
}
示例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));
}
示例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();
}
}
示例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();
}
}
示例8: asyncClose
import com.twitter.util.Future; //导入方法依赖的package包/类
@Override
public Future<Void> asyncClose() {
return Future.Void();
}
示例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();
}
示例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;
}
示例11: asyncAbort
import com.twitter.util.Future; //导入方法依赖的package包/类
@Override
public Future<Void> asyncAbort() {
return Future.Void();
}