本文整理汇总了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;
}
示例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;
}
示例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);
}
}
示例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;
}
示例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);
}
}
示例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;
}
示例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();
}