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


Java OperationFuture.addListener方法代码示例

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


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

示例1: setKeyValueInCouchBase

import net.spy.memcached.internal.OperationFuture; //导入方法依赖的package包/类
public void setKeyValueInCouchBase(T tuple)
{
  id++;
  String key = getKey(tuple);
  Object value = getValue(tuple);
  if (!(value instanceof Boolean) && !(value instanceof Integer) && !(value instanceof String) && !(value instanceof Float) && !(value instanceof Double) && !(value instanceof Character) && !(value instanceof Long) && !(value instanceof Short) && !(value instanceof Byte)) {
    if (serializer != null) {
      value = serializer.serialize(value);
    }
  }
  OperationFuture<Boolean> future = processKeyValue(key, value);
  synchronized (syncObj) {
    future.addListener(listener);
    mapFuture.put(future, id);
    if (!mapTuples.containsKey(id)) {
      mapTuples.put(id, tuple);
    }
    numTuples++;
  }

}
 
开发者ID:apache,项目名称:apex-malhar,代码行数:22,代码来源:AbstractCouchBaseOutputOperator.java

示例2: removeData

import net.spy.memcached.internal.OperationFuture; //导入方法依赖的package包/类
@Override
public void removeData(final String sessionId, final int pageId)
{
	final Set<String> keys = keysPerSession.get(sessionId);
	final String key = getKey(sessionId, pageId);

	if (keys != null && keys.contains(key))
	{
		OperationFuture<Boolean> delete = client.delete(key);
		delete.addListener(new OperationCompletionListener()
		{
			@Override
			public void onComplete(OperationFuture<?> future) throws Exception
			{
				keys.remove(key);
				LOG.debug("Removed the data for session '{}' and page id '{}'", sessionId, pageId);
			}
		});
	}
}
 
开发者ID:martin-g,项目名称:wicket-memcached-data-store,代码行数:21,代码来源:MemcachedDataStore.java

示例3: main

import net.spy.memcached.internal.OperationFuture; //导入方法依赖的package包/类
public static void main(String[] args) throws IOException
{
	final MemcachedClient c = new MemcachedClient(new InetSocketAddress("localhost", 11211));
	Object o = c.get(KEY);
	System.err.println("1. get: " + o);
	OperationFuture<Boolean> add = c.add(KEY, 50000, "1");
	add.addListener(new OperationCompletionListener()
	{
		@Override
		public void onComplete(OperationFuture<?> operationFuture) throws Exception
		{
			Object o2 = c.get(KEY);
			System.err.println("2. get: " + o2);

			c.delete(KEY);

			Object o3 = c.get(KEY);
			System.err.println("3. get: " + o3);

			c.shutdown();
		}
	});
}
 
开发者ID:martin-g,项目名称:wicket-memcached-data-store,代码行数:24,代码来源:TestHomePage.java

示例4: EVCacheFutures

import net.spy.memcached.internal.OperationFuture; //导入方法依赖的package包/类
public EVCacheFutures(OperationFuture<Boolean>[] futures, String key, String app, ServerGroup serverGroup, EVCacheLatch latch) {
    this.futures = futures;
    this.app = app;
    this.serverGroup = serverGroup;
    this.key = key;
    this.latch = latch;
    this.completionCounter = new AtomicInteger(futures.length);
    if (latch != null && latch instanceof EVCacheLatchImpl) ((EVCacheLatchImpl) latch).addFuture(this);
    for (int i = 0; i < futures.length; i++) {
        final OperationFuture<Boolean> of = futures[i];
        if (of.isDone()) {
            try {
                onComplete(of);
            } catch (Exception e) {
            }
        } else {
            of.addListener(this);
        }
    }
}
 
开发者ID:Netflix,项目名称:EVCache,代码行数:21,代码来源:EVCacheFutures.java


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