本文整理汇总了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;
}
}
}
}
示例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) {
}
}
示例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();
}
}
示例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);
}
}
示例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();
}
示例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);
}
示例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);
}
示例8: loadAll
import javax.cache.integration.CompletionListener; //导入依赖的package包/类
public void loadAll(Set<? extends K> keys, boolean replaceExistingValues,
CompletionListener completionListener) {
}
示例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();
}
}
}
);
}
示例10: JCacheListener
import javax.cache.integration.CompletionListener; //导入依赖的package包/类
public JCacheListener(CompletionListener listener, Object result) {
_listener = listener;
_result = result;
}
示例11: JCacheLoaderCallbackRunnable
import javax.cache.integration.CompletionListener; //导入依赖的package包/类
public JCacheLoaderCallbackRunnable(CompletionListener listener, Object result) {
_listener = listener;
_result = result;
}
示例12: setCompletionListener
import javax.cache.integration.CompletionListener; //导入依赖的package包/类
public void setCompletionListener(CompletionListener listener) {
_completionListener = listener;
}
示例13: getCompletionListener
import javax.cache.integration.CompletionListener; //导入依赖的package包/类
public CompletionListener getCompletionListener() {
return _completionListener;
}
示例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);
}
示例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.");
}