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


Java CompletionListener类代码示例

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


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

示例1: GetCallbackId

import javax.cache.integration.CompletionListener; //导入依赖的package包/类
private short GetCallbackId(CompletionListener completionListener) {
    if (completionListener == null) {
        return -1;
    }
    
    if(_asyncCallbackIDsMap == null) {
        _asyncCallbackIDsMap = new ResourcePool();
    }
    
    if(_asyncCallbacksMap == null) {
        _asyncCallbacksMap = new ResourcePool();
    }
    
    while (true) {
        if(_asyncCallbacksMap.GetResource(completionListener) == null) {
            _jcclInitialVal++;
            _asyncCallbacksMap.AddResource(completionListener, _jcclInitialVal);
            _asyncCallbackIDsMap.AddResource(_jcclInitialVal, completionListener);
            return _jcclInitialVal;
        } else {
            try {
                short clId = (Short) _asyncCallbacksMap.GetResource(completionListener);
                _asyncCallbacksMap.AddResource(completionListener, clId);
                _asyncCallbackIDsMap.AddResource(clId, completionListener);
                return clId;
            }
            catch (java.lang.NullPointerException ex) {
                continue;
            }
        }
    }
}
 
开发者ID:Alachisoft,项目名称:TayzGrid,代码行数:33,代码来源:Cache.java

示例2: getBulkInternal

import javax.cache.integration.CompletionListener; //导入依赖的package包/类
public void getBulkInternal(Set<? extends K> set, boolean bln, CompletionListener cl) throws NullPointerException, IllegalStateException,
        CacheException, ClassCastException
{
    Object[] keys = set.toArray(new Object[set.size()]);
    JCacheLoadAllItem jCacheItems = new JCacheLoadAllItem();
    jCacheItems.setReplaceExistingValues(bln);
    jCacheItems.setCompletionListener(cl);
    try {
        getBulk(keys, DSReadOption.OptionalReadThru, null, jCacheItems, true);
    }
    catch (Exception e) {
    }
}
 
开发者ID:Alachisoft,项目名称:TayzGrid,代码行数:14,代码来源:Cache.java

示例3: loadAll

import javax.cache.integration.CompletionListener; //导入依赖的package包/类
@Override
public void loadAll(Set<? extends K> keys, boolean replaceExistingValues, CompletionListener completionListener) {
    verifyCacheConnectivity();
    if(keys == null)
        throw new NullPointerException("keys cannot be null.");
    try {
        innerCache.getBulkInternal(keys, replaceExistingValues, completionListener);
    }
    catch(Exception e) {
        throw new CacheException();
    }
    
}
 
开发者ID:Alachisoft,项目名称:TayzGrid,代码行数:14,代码来源:TayzGridCache.java

示例4: loadAll

import javax.cache.integration.CompletionListener; //导入依赖的package包/类
/** {@inheritDoc} */
@Override public void loadAll(Set<? extends K> keys, boolean replaceExisting, CompletionListener completionListener) {
    GridCacheGateway<K, V> gate = gate();

    CacheOperationContext prev = onEnter(gate, opCtx);

    try {
        delegate.loadAll(keys, replaceExisting, completionListener);
    }
    finally {
        onLeave(gate, prev);
    }
}
 
开发者ID:apache,项目名称:ignite,代码行数:14,代码来源:GatewayProtectedCacheProxy.java

示例5: loadAll

import javax.cache.integration.CompletionListener; //导入依赖的package包/类
@Override
public void loadAll(Set<? extends K> keys, boolean replaceExistingValues, CompletionListener completionListener) {
  checkClosed();

  if (keys == null) {
    throw new NullPointerException();
  }

  for (K key : keys) {
    if (key == null) {
      throw new NullPointerException();
    }
  }

  completionListener = completionListener != null ? completionListener : NullCompletionListener.INSTANCE;

  if (cacheLoaderWriter == null) {
    completionListener.onCompletion();
    return;
  }

  try {
    jsr107Cache.loadAll(keys, replaceExistingValues, this::loadAllFunction);
  } catch (Exception e) {
    final CacheLoaderException cle;
    cle = getCacheLoaderException(e);
    completionListener.onException(cle);
    return;
  }

  completionListener.onCompletion();
}
 
开发者ID:ehcache,项目名称:ehcache3,代码行数:33,代码来源:Eh107Cache.java

示例6: testLoadAllWithExecptionAndNoCompletionListener

import javax.cache.integration.CompletionListener; //导入依赖的package包/类
/**
 * Added for code coverage.
 */
@Test
public void testLoadAllWithExecptionAndNoCompletionListener() throws Exception {
  FailingCacheLoader<String, String> cacheLoader = new FailingCacheLoader<>();
  cacheLoaderServer.setCacheLoader(cacheLoader);

  HashSet<String> keys = new HashSet<>();
  keys.add("gudday");
  keys.add("hello");
  keys.add("howdy");
  keys.add("bonjour");

  CompletionListener NULL_COMPLETION_LISTENER = null;
  cache.loadAll(keys, false, NULL_COMPLETION_LISTENER);
}
 
开发者ID:cache2k,项目名称:cache2k,代码行数:18,代码来源:CacheLoaderTest.java

示例7: load_noLoaderNoCompletionListener

import javax.cache.integration.CompletionListener; //导入依赖的package包/类
@Test
public void load_noLoaderNoCompletionListener() {

  // Added for code coverage.
  Set<Long> keys = new HashSet<Long>();
  keys.add(1L);
  CompletionListener NULL_COMPLETION_LISTENER = null;
  cache.loadAll(keys, true, NULL_COMPLETION_LISTENER);
}
 
开发者ID:cache2k,项目名称:cache2k,代码行数:10,代码来源:CacheTest.java

示例8: loadAll

import javax.cache.integration.CompletionListener; //导入依赖的package包/类
public void loadAll(Set<? extends K> keys, boolean replaceExistingValues,
        CompletionListener completionListener) {
}
 
开发者ID:zhaojunfei,项目名称:lemon,代码行数:4,代码来源:DefaultCache.java

示例9: loadAll

import javax.cache.integration.CompletionListener; //导入依赖的package包/类
@Override
public void loadAll(final Set<? extends K> keys, final boolean replaceExistingValues, final CompletionListener cl)
{
    checkState();

    if (keys == null || cl == null)
    {
        throw new NullPointerException();
    }

    ExecutorService executorService = Executors.newSingleThreadExecutor();

    executorService.submit
    (
        new Runnable()
        {
            @Override
            public void run()
            {
                try
                {
                    if (cache instanceof LoadingCache)
                    {
                        LoadingCache<K, V> loadingCache = (LoadingCache<K, V>) cache;

                        for (K key : keys)
                        {
                            if (!view.containsKey(key))
                            {
                                loadingCache.get(key);
                            }
                            else if (replaceExistingValues)
                            {
                                loadingCache.refresh(key);
                            }
                        }
                    }
                }
                catch (ExecutionException e)
                {
                    cl.onException(e);
                }
                finally
                {
                    cl.onCompletion();
                }
            }
        }
    );
}
 
开发者ID:ocafebabe,项目名称:guava-jcache,代码行数:51,代码来源:GuavaCache.java

示例10: JCacheListener

import javax.cache.integration.CompletionListener; //导入依赖的package包/类
public JCacheListener(CompletionListener listener, Object result) {
    _listener = listener;
    _result = result;
}
 
开发者ID:Alachisoft,项目名称:TayzGrid,代码行数:5,代码来源:JCacheListener.java

示例11: JCacheLoaderCallbackRunnable

import javax.cache.integration.CompletionListener; //导入依赖的package包/类
public JCacheLoaderCallbackRunnable(CompletionListener listener, Object result) {
    _listener = listener;
    _result = result;
}
 
开发者ID:Alachisoft,项目名称:TayzGrid,代码行数:5,代码来源:JCacheLoaderCallbackRunnable.java

示例12: setCompletionListener

import javax.cache.integration.CompletionListener; //导入依赖的package包/类
public void setCompletionListener(CompletionListener listener) {
    _completionListener = listener;
}
 
开发者ID:Alachisoft,项目名称:TayzGrid,代码行数:4,代码来源:JCacheLoadAllItem.java

示例13: getCompletionListener

import javax.cache.integration.CompletionListener; //导入依赖的package包/类
public CompletionListener getCompletionListener() {
    return _completionListener;
}
 
开发者ID:Alachisoft,项目名称:TayzGrid,代码行数:4,代码来源:JCacheLoadAllItem.java

示例14: loadAll

import javax.cache.integration.CompletionListener; //导入依赖的package包/类
@Override
public void loadAll(Set<? extends K> set, boolean b, CompletionListener completionListener) {
    cache.loadAll(set, b, completionListener);
}
 
开发者ID:hazelcast,项目名称:hazelcast-jet,代码行数:5,代码来源:CacheDecorator.java

示例15: loadAll

import javax.cache.integration.CompletionListener; //导入依赖的package包/类
/** {@inheritDoc} */
@Override public void loadAll(Set<? extends K> keys, boolean replaceExistVals, CompletionListener completionLsnr) {
    throw new UnsupportedOperationException("Operation can't be supported automatically.");
}
 
开发者ID:apache,项目名称:ignite,代码行数:5,代码来源:IgniteCacheProcessProxy.java


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