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


Java ExecutionError类代码示例

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


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

示例1: get

import com.google.common.util.concurrent.ExecutionError; //导入依赖的package包/类
public ReloadableSslContext get(
        File trustCertificatesFile,
        Optional<File> clientCertificatesFile,
        Optional<File> privateKeyFile,
        Optional<String> privateKeyPassword,
        long sessionCacheSize,
        Duration sessionTimeout,
        List<String> ciphers)
{
    try {
        return cache.getUnchecked(new SslContextConfig(trustCertificatesFile, clientCertificatesFile, privateKeyFile, privateKeyPassword, sessionCacheSize, sessionTimeout, ciphers));
    }
    catch (UncheckedExecutionException | ExecutionError e) {
        throw new RuntimeException("Error initializing SSL context", e.getCause());
    }
}
 
开发者ID:airlift,项目名称:drift,代码行数:17,代码来源:SslContextFactory.java

示例2: testBulkLoadError

import com.google.common.util.concurrent.ExecutionError; //导入依赖的package包/类
public void testBulkLoadError() throws ExecutionException {
  Error e = new Error();
  CacheLoader<Object, Object> loader = errorLoader(e);
  LoadingCache<Object, Object> cache = CacheBuilder.newBuilder()
      .recordStats()
      .build(bulkLoader(loader));
  CacheStats stats = cache.stats();
  assertEquals(0, stats.missCount());
  assertEquals(0, stats.loadSuccessCount());
  assertEquals(0, stats.loadExceptionCount());
  assertEquals(0, stats.hitCount());

  try {
    cache.getAll(asList(new Object()));
    fail();
  } catch (ExecutionError expected) {
    assertSame(e, expected.getCause());
  }
  stats = cache.stats();
  assertEquals(1, stats.missCount());
  assertEquals(0, stats.loadSuccessCount());
  assertEquals(1, stats.loadExceptionCount());
  assertEquals(0, stats.hitCount());
}
 
开发者ID:zugzug90,项目名称:guava-mock,代码行数:25,代码来源:CacheLoadingTest.java

示例3: get

import com.google.common.util.concurrent.ExecutionError; //导入依赖的package包/类
OnDemandShardState get() throws Exception {
    if (shardActor == null) {
        return OnDemandShardState.newBuilder().build();
    }

    try {
        return ONDEMAND_SHARD_STATE_CACHE.get(shardName, this::retrieveState);
    } catch (ExecutionException | UncheckedExecutionException | ExecutionError e) {
        if (e.getCause() != null) {
            Throwables.propagateIfPossible(e.getCause(), Exception.class);
            throw new RuntimeException("unexpected", e.getCause());
        }

        throw e;
    }
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:17,代码来源:OnDemandShardStateCache.java

示例4: constructDB

import com.google.common.util.concurrent.ExecutionError; //导入依赖的package包/类
private static DB constructDB(String dbFile) {
        DB db;
        try{
            DBMaker dbMaker = DBMaker.newFileDB(new File(dbFile));
            db = dbMaker
                    .transactionDisable()
                    .mmapFileEnable()
                    .asyncWriteEnable()
                    .compressionEnable()
//                     .cacheSize(1024 * 1024) this bloats memory consumption
                    .make();
            return db;
        } catch (ExecutionError | IOError | Exception e) {
            LOG.error("Could not construct db from file.", e);
            return null;
        }
    }
 
开发者ID:conveyal,项目名称:gtfs-lib,代码行数:18,代码来源:GTFSFeed.java

示例5: acquireLock

import com.google.common.util.concurrent.ExecutionError; //导入依赖的package包/类
@Override
public void acquireLock(final StaticBuffer key, final StaticBuffer column, final StaticBuffer expectedValue, final StoreTransaction txh) throws BackendException {
    final DynamoDbStoreTransaction tx = DynamoDbStoreTransaction.getTx(txh);
    final Pair<StaticBuffer, StaticBuffer> keyColumn = Pair.of(key, column);

    final DynamoDbStoreTransaction existing;
    try {
        existing = keyColumnLocalLocks.get(keyColumn, () -> tx);
    } catch (ExecutionException | UncheckedExecutionException | ExecutionError e) {
        throw new TemporaryLockingException("Unable to acquire lock", e);
    }
    if (null != existing && tx != existing) {
        throw new TemporaryLockingException(String.format("tx %s already locked key-column %s when tx %s tried to lock", existing.toString(), keyColumn.toString(), tx.toString()));
    }

    // Titan's locking expects that only the first expectedValue for a given key/column should be used
    tx.putKeyColumnOnlyIfItIsNotYetChangedInTx(this, key, column, expectedValue);
}
 
开发者ID:awslabs,项目名称:dynamodb-janusgraph-storage-backend,代码行数:19,代码来源:AbstractDynamoDbStore.java

示例6: compileJoinOperatorFactory

import com.google.common.util.concurrent.ExecutionError; //导入依赖的package包/类
public OperatorFactory compileJoinOperatorFactory(int operatorId,
        PlanNodeId planNodeId,
        LookupSourceSupplier lookupSourceSupplier,
        List<? extends Type> probeTypes,
        List<Integer> probeJoinChannel,
        Optional<Integer> probeHashChannel,
        JoinType joinType)
{
    try {
        HashJoinOperatorFactoryFactory operatorFactoryFactory = joinProbeFactories.get(new JoinOperatorCacheKey(probeTypes, probeJoinChannel, probeHashChannel, joinType));
        return operatorFactoryFactory.createHashJoinOperatorFactory(operatorId, planNodeId, lookupSourceSupplier, probeTypes, probeJoinChannel, joinType);
    }
    catch (ExecutionException | UncheckedExecutionException | ExecutionError e) {
        throw Throwables.propagate(e.getCause());
    }
}
 
开发者ID:y-lan,项目名称:presto,代码行数:17,代码来源:JoinProbeCompiler.java

示例7: testBulkLoadError

import com.google.common.util.concurrent.ExecutionError; //导入依赖的package包/类
public void testBulkLoadError() throws ExecutionException {
  Error e = new Error();
  CacheLoader<Object, Object> loader = errorLoader(e);
  LoadingCache<Object, Object> cache =
      CacheBuilder.newBuilder().recordStats().build(bulkLoader(loader));
  CacheStats stats = cache.stats();
  assertEquals(0, stats.missCount());
  assertEquals(0, stats.loadSuccessCount());
  assertEquals(0, stats.loadExceptionCount());
  assertEquals(0, stats.hitCount());

  try {
    cache.getAll(asList(new Object()));
    fail();
  } catch (ExecutionError expected) {
    assertSame(e, expected.getCause());
  }
  stats = cache.stats();
  assertEquals(1, stats.missCount());
  assertEquals(0, stats.loadSuccessCount());
  assertEquals(1, stats.loadExceptionCount());
  assertEquals(0, stats.hitCount());
}
 
开发者ID:google,项目名称:guava,代码行数:24,代码来源:CacheLoadingTest.java

示例8: get

import com.google.common.util.concurrent.ExecutionError; //导入依赖的package包/类
V get(K key, int hash, CacheLoader<? super K, V> loader) throws ExecutionException {
  checkNotNull(key);
  checkNotNull(loader);
  try {
    if (count != 0) { // read-volatile
      // don't call getLiveEntry, which would ignore loading values
      ReferenceEntry<K, V> e = getEntry(key, hash);
      if (e != null) {
        long now = map.ticker.read();
        V value = getLiveValue(e, now);
        if (value != null) {
          recordRead(e, now);
          statsCounter.recordHits(1);
          return scheduleRefresh(e, key, hash, value, now, loader);
        }
        ValueReference<K, V> valueReference = e.getValueReference();
        if (valueReference.isLoading()) {
          return waitForLoadingValue(e, key, valueReference);
        }
      }
    }

    // at this point e is either null or expired;
    return lockedGetOrLoad(key, hash, loader);
  } catch (ExecutionException ee) {
    Throwable cause = ee.getCause();
    if (cause instanceof Error) {
      throw new ExecutionError((Error) cause);
    } else if (cause instanceof RuntimeException) {
      throw new UncheckedExecutionException(cause);
    }
    throw ee;
  } finally {
    postReadCleanup();
  }
}
 
开发者ID:zugzug90,项目名称:guava-mock,代码行数:37,代码来源:LocalCache.java

示例9: get

import com.google.common.util.concurrent.ExecutionError; //导入依赖的package包/类
V get(K key, int hash, CacheLoader<? super K, V> loader) throws ExecutionException {
        checkNotNull(key);
        checkNotNull(loader);
        try {
    if (count != 0) { // read-volatile
      // don't call getLiveEntry, which would ignore loading values
            ReferenceEntry<K, V> e = getEntry(key, hash);
            if (e != null) {
                long now = map.ticker.read();
                V value = getLiveValue(e, now);
                if (value != null) {
                        recordRead(e, now);
                        statsCounter.recordHits(1);
                        return scheduleRefresh(e, key, hash, value, now, loader);
                }
                ValueReference<K, V> valueReference = e.getValueReference();
                if (valueReference.isLoading()) {
                        return waitForLoadingValue(e, key, valueReference);
                }
            }
    }

    // at this point e is either null or expired;
    return lockedGetOrLoad(key, hash, loader);
        } catch (ExecutionException ee) {
          Throwable cause = ee.getCause();
          if (cause instanceof Error) {
                                                                                       throw new ExecutionError((Error) cause);
          } else if (cause instanceof RuntimeException) {
            throw new UncheckedExecutionException(cause);
          }
          throw ee;
        } finally {
          postReadCleanup();
        }
}
 
开发者ID:antlr,项目名称:codebuff,代码行数:37,代码来源:LocalCache.java

示例10: getOrCreateNodeId

import com.google.common.util.concurrent.ExecutionError; //导入依赖的package包/类
private int getOrCreateNodeId(String nodeIdentifier)
{
    try {
        return nodeIdCache.getUnchecked(nodeIdentifier);
    }
    catch (UncheckedExecutionException | ExecutionError e) {
        throw Throwables.propagate(e.getCause());
    }
}
 
开发者ID:y-lan,项目名称:presto,代码行数:10,代码来源:DatabaseShardManager.java

示例11: compilePagesIndexOrdering

import com.google.common.util.concurrent.ExecutionError; //导入依赖的package包/类
public PagesIndexOrdering compilePagesIndexOrdering(List<Type> sortTypes, List<Integer> sortChannels, List<SortOrder> sortOrders)
{
    requireNonNull(sortTypes, "sortTypes is null");
    requireNonNull(sortChannels, "sortChannels is null");
    requireNonNull(sortOrders, "sortOrders is null");

    try {
        return pagesIndexOrderings.get(new PagesIndexComparatorCacheKey(sortTypes, sortChannels, sortOrders));
    }
    catch (ExecutionException | UncheckedExecutionException | ExecutionError e) {
        throw Throwables.propagate(e.getCause());
    }
}
 
开发者ID:y-lan,项目名称:presto,代码行数:14,代码来源:OrderingCompiler.java

示例12: compileLookupSourceFactory

import com.google.common.util.concurrent.ExecutionError; //导入依赖的package包/类
public LookupSourceFactory compileLookupSourceFactory(List<? extends Type> types, List<Integer> joinChannels)
{
    try {
        return lookupSourceFactories.get(new CacheKey(types, joinChannels));
    }
    catch (ExecutionException | UncheckedExecutionException | ExecutionError e) {
        throw Throwables.propagate(e.getCause());
    }
}
 
开发者ID:y-lan,项目名称:presto,代码行数:10,代码来源:JoinCompiler.java

示例13: compilePagesHashStrategyFactory

import com.google.common.util.concurrent.ExecutionError; //导入依赖的package包/类
public PagesHashStrategyFactory compilePagesHashStrategyFactory(List<Type> types, List<Integer> joinChannels)
{
    requireNonNull(types, "types is null");
    requireNonNull(joinChannels, "joinChannels is null");

    try {
        return new PagesHashStrategyFactory(hashStrategies.get(new CacheKey(types, joinChannels)));
    }
    catch (ExecutionException | UncheckedExecutionException | ExecutionError e) {
        throw Throwables.propagate(e.getCause());
    }
}
 
开发者ID:y-lan,项目名称:presto,代码行数:13,代码来源:JoinCompiler.java

示例14: get

import com.google.common.util.concurrent.ExecutionError; //导入依赖的package包/类
private static <K, V> V get(LoadingCache<K, V> cache, K key)
{
    try {
        return cache.get(key);
    }
    catch (ExecutionException | UncheckedExecutionException | ExecutionError e) {
        throw Throwables.propagate(e.getCause());
    }
}
 
开发者ID:y-lan,项目名称:presto,代码行数:10,代码来源:CachingHiveMetastore.java

示例15: getAll

import com.google.common.util.concurrent.ExecutionError; //导入依赖的package包/类
private static <K, V> Map<K, V> getAll(LoadingCache<K, V> cache, Iterable<K> keys)
{
    try {
        return cache.getAll(keys);
    }
    catch (ExecutionException | UncheckedExecutionException | ExecutionError e) {
        throw Throwables.propagate(e.getCause());
    }
}
 
开发者ID:y-lan,项目名称:presto,代码行数:10,代码来源:CachingHiveMetastore.java


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