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


Java OperationFuture.cancel方法代码示例

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


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

示例1: gets

import net.spy.memcached.internal.OperationFuture; //导入方法依赖的package包/类
public com.quickserverlab.quickcached.client.CASValue gets(String key, long timeoutMiliSec) 
		throws TimeoutException, com.quickserverlab.quickcached.client.MemcachedException{
	com.quickserverlab.quickcached.client.CASValue value = null;
	try{
		OperationFuture <CASValue<Object>> f =  getCache().asyncGets(key);
		try {
			CASValue<Object> cv = (CASValue<Object>) f.get(timeoutMiliSec, TimeUnit.MILLISECONDS);
			if(cv != null){
				value = new com.quickserverlab.quickcached.client.CASValue(cv.getCas(), cv.getValue());
			}else{
				throw new com.quickserverlab.quickcached.client.MemcachedException("Object not found");
			}
		}catch(InterruptedException ie){
			throw new com.quickserverlab.quickcached.client.MemcachedException("InterruptedException "+ ie);
		}catch(ExecutionException ee){
			throw new com.quickserverlab.quickcached.client.MemcachedException("ExecutionException "+ ee);
		}catch(java.util.concurrent.TimeoutException te){
			throw new TimeoutException("Timeout "+ te);
		}finally{
			f.cancel(false);
		}
	}catch(IllegalStateException ise){
		throw new com.quickserverlab.quickcached.client.MemcachedException("IllegalStateException "+ ise);
	}
	return value;				
}
 
开发者ID:QuickServerLab,项目名称:QuickCached,代码行数:27,代码来源:SpyMemcachedImpl.java

示例2: increment

import net.spy.memcached.internal.OperationFuture; //导入方法依赖的package包/类
public long increment(String key, int delta, long timeoutMiliSec) 
	throws TimeoutException, com.quickserverlab.quickcached.client.MemcachedException {
	long currentValue = 0;
	try{
		OperationFuture <Long> f = getCache().asyncIncr(key, delta);
		try {
			currentValue = (Long) f.get(timeoutMiliSec, TimeUnit.MILLISECONDS);
		}catch(InterruptedException ie){
			throw new com.quickserverlab.quickcached.client.MemcachedException("InterruptedException "+ ie);
		}catch(ExecutionException ee){
			throw new com.quickserverlab.quickcached.client.MemcachedException("ExecutionException "+ ee);
		}catch(java.util.concurrent.TimeoutException te){
			throw new TimeoutException("Timeout "+ te);
		}finally{
			f.cancel(false);
		}
	}catch(IllegalStateException ise){
		throw new com.quickserverlab.quickcached.client.MemcachedException("IllegalStateException "+ ise);
	}
	return currentValue;
}
 
开发者ID:QuickServerLab,项目名称:QuickCached,代码行数:22,代码来源:SpyMemcachedImpl.java

示例3: incrementWithNoReply

import net.spy.memcached.internal.OperationFuture; //导入方法依赖的package包/类
/**
 * Increments the object count, without returns
 * 
 * @param key  
 * @param value  
 * 
 * 
 */
public void incrementWithNoReply(String key, int delta) 
	throws com.quickserverlab.quickcached.client.MemcachedException {    
	long currentValue = 0;
	try{
		OperationFuture <Long> f = getCache().asyncIncr(key, delta);
		try {
			currentValue = (Long) f.get();
		}catch(InterruptedException ie){
			throw new com.quickserverlab.quickcached.client.MemcachedException("InterruptedException "+ ie);
		}catch(ExecutionException ee){
			throw new com.quickserverlab.quickcached.client.MemcachedException("ExecutionException "+ ee);
		}finally{
			f.cancel(false);
		}
	}catch(IllegalStateException ise){
		throw new com.quickserverlab.quickcached.client.MemcachedException("IllegalStateException "+ ise);
	}
}
 
开发者ID:QuickServerLab,项目名称:QuickCached,代码行数:27,代码来源:SpyMemcachedImpl.java

示例4: decrement

import net.spy.memcached.internal.OperationFuture; //导入方法依赖的package包/类
public long decrement(String key, int delta, long timeoutMiliSec) 
		throws TimeoutException, com.quickserverlab.quickcached.client.MemcachedException {
	long currentValue = 0;
	try{
		OperationFuture <Long> f = getCache().asyncDecr(key, delta);
		try {
			currentValue = (Long) f.get(timeoutMiliSec, TimeUnit.MILLISECONDS);
		}catch(InterruptedException ie){
			throw new com.quickserverlab.quickcached.client.MemcachedException("InterruptedException "+ ie);
		}catch(ExecutionException ee){
			throw new com.quickserverlab.quickcached.client.MemcachedException("ExecutionException "+ ee);
		}catch(java.util.concurrent.TimeoutException te){
			throw new TimeoutException("Timeout "+ te);
		}finally{
			f.cancel(false);
		}
	}catch(IllegalStateException ise){
		throw new com.quickserverlab.quickcached.client.MemcachedException("IllegalStateException "+ ise);
	}
	return currentValue;		
}
 
开发者ID:QuickServerLab,项目名称:QuickCached,代码行数:22,代码来源:SpyMemcachedImpl.java

示例5: decrementWithNoReply

import net.spy.memcached.internal.OperationFuture; //导入方法依赖的package包/类
public void decrementWithNoReply(String key, int delta) 
	throws com.quickserverlab.quickcached.client.MemcachedException {    
	long currentValue = 0;
	try{
		OperationFuture <Long> f = getCache().asyncIncr(key, delta);
		try {
			currentValue = (Long) f.get();
		}catch(InterruptedException ie){
			throw new com.quickserverlab.quickcached.client.MemcachedException("InterruptedException "+ ie);
		}catch(ExecutionException ee){
			throw new com.quickserverlab.quickcached.client.MemcachedException("ExecutionException "+ ee);
		}finally{
			f.cancel(false);
		}
	}catch(IllegalStateException ise){
		throw new com.quickserverlab.quickcached.client.MemcachedException("IllegalStateException "+ ise);
	}
}
 
开发者ID:QuickServerLab,项目名称:QuickCached,代码行数:19,代码来源:SpyMemcachedImpl.java

示例6: cancel

import net.spy.memcached.internal.OperationFuture; //导入方法依赖的package包/类
public boolean cancel(boolean mayInterruptIfRunning) {
    if(log.isDebugEnabled()) log.debug("Operation cancelled", new Exception());
    for (OperationFuture<Boolean> future : futures) {
        future.cancel();
    }
    return true;
}
 
开发者ID:Netflix,项目名称:EVCache,代码行数:8,代码来源:EVCacheFutures.java

示例7: gat

import net.spy.memcached.internal.OperationFuture; //导入方法依赖的package包/类
public Object gat(String key, int ttlSec, long timeoutMiliSec) throws TimeoutException {
	OperationFuture <CASValue<Object>> f = getCache().asyncGetAndTouch(key, ttlSec);
	CASValue<Object> casv = null;
	try {
		casv = f.get(timeoutMiliSec, TimeUnit.MILLISECONDS);
	} catch(Exception e) {
		f.cancel(false);
		throw new TimeoutException("Timeout "+e);
	}		
	return casv.getValue();
}
 
开发者ID:QuickServerLab,项目名称:QuickCached,代码行数:12,代码来源:SpyMemcachedImpl.java


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