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


Java Cancellable类代码示例

本文整理汇总了Java中org.xnio.Cancellable的典型用法代码示例。如果您正苦于以下问题:Java Cancellable类的具体用法?Java Cancellable怎么用?Java Cancellable使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: asyncCancel

import org.xnio.Cancellable; //导入依赖的package包/类
@Override
public void asyncCancel(boolean interruptionDesired) {
    final List<Cancellable> cancellables;
    synchronized (this) {
        cancellables = this.cancellables;
        if (cancellables == CANCEL_REQUESTED) {
            return;
        }
        this.cancellables = CANCEL_REQUESTED;
        if(cancellables == null) {
            setCancelled();
            return;
        }
    }
    for (Cancellable cancellable : cancellables) {
        cancellable.cancel();
    }
    setCancelled();
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:20,代码来源:ActiveOperationImpl.java

示例2: addCancellable

import org.xnio.Cancellable; //导入依赖的package包/类
@Override
public void addCancellable(final Cancellable cancellable) {
    // Perhaps just use the IOFuture from XNIO...
    synchronized (this) {
        switch (getStatus()) {
            case CANCELLED:
                break;
            case WAITING:
                final List<Cancellable> cancellables = this.cancellables;
                if (cancellables == CANCEL_REQUESTED) {
                    break;
                } else {
                    ((cancellables == null) ? (this.cancellables = new ArrayList<Cancellable>()) : cancellables).add(cancellable);
                }
            default:
                return;
        }
    }
    cancellable.cancel();
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:21,代码来源:ActiveOperationImpl.java

示例3: cancel

import org.xnio.Cancellable; //导入依赖的package包/类
@Override
public Cancellable cancel() {
    if (cancellable && cancelled.compareAndSet(false, true)) {
        final Thread thread = this.thread;
        if(thread != null) {
            thread.interrupt();
            ProtocolLogger.ROOT_LOGGER.cancelledAsyncTask(getClass().getSimpleName(), thread);
        }
    }
    return this;
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:12,代码来源:ManagementRequestContextImpl.java

示例4: addCancellable

import org.xnio.Cancellable; //导入依赖的package包/类
/**
 * Add a cancellation handler.
 *
 * @param cancellable the cancel handler
 */
void addCancellable(final Cancellable cancellable);
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:7,代码来源:ActiveOperation.java


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