當前位置: 首頁>>代碼示例>>Java>>正文


Java UncheckedExecutionException.getCause方法代碼示例

本文整理匯總了Java中com.google.common.util.concurrent.UncheckedExecutionException.getCause方法的典型用法代碼示例。如果您正苦於以下問題:Java UncheckedExecutionException.getCause方法的具體用法?Java UncheckedExecutionException.getCause怎麽用?Java UncheckedExecutionException.getCause使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.google.common.util.concurrent.UncheckedExecutionException的用法示例。


在下文中一共展示了UncheckedExecutionException.getCause方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getAssertionConsumerServiceUri

import com.google.common.util.concurrent.UncheckedExecutionException; //導入方法依賴的package包/類
@Timed
public ResourceLocation getAssertionConsumerServiceUri(String entityId, Optional<Integer> assertionConsumerServiceIndex) {

    ImmutableMap<String, String> queryParams = ImmutableMap.of();

    if (assertionConsumerServiceIndex.isPresent()) {
        queryParams = ImmutableMap.of(
                Urls.ConfigUrls.ASSERTION_CONSUMER_SERVICE_INDEX_PARAM,
                assertionConsumerServiceIndex.get().toString());
    }
    final URI uri = getEncodedUri(Urls.ConfigUrls.TRANSACTIONS_ASSERTION_CONSUMER_SERVICE_URI_RESOURCE, queryParams, entityId);
    try {
        return resourceLocation.getUnchecked(uri);
    } catch (UncheckedExecutionException e) {
        Throwables.throwIfUnchecked(e.getCause());
        throw new RuntimeException(e.getCause());
    }
}
 
開發者ID:alphagov,項目名稱:verify-hub,代碼行數:19,代碼來源:TransactionsConfigProxy.java

示例2: resolvePath

import com.google.common.util.concurrent.UncheckedExecutionException; //導入方法依賴的package包/類
static MCRFilesystemNode resolvePath(MCRPath path) throws IOException {
    try {
        String ifsid = nodeCache.getUnchecked(path);
        MCRFilesystemNode node = MCRFilesystemNode.getNode(ifsid);
        if (node != null) {
            return node;
        }
        nodeCache.invalidate(path);
        return resolvePath(path);
    } catch (UncheckedExecutionException e) {
        Throwable cause = e.getCause();
        if (cause instanceof NoSuchFileException) {
            throw (NoSuchFileException) cause;
        }
        if (cause instanceof NotDirectoryException) {
            throw (NotDirectoryException) cause;
        }
        if (cause instanceof IOException) {
            throw (IOException) cause;
        }
        throw e;
    }
}
 
開發者ID:MyCoRe-Org,項目名稱:mycore,代碼行數:24,代碼來源:MCRFileSystemProvider.java

示例3: startUp

import com.google.common.util.concurrent.UncheckedExecutionException; //導入方法依賴的package包/類
@Override
protected void startUp() throws Exception {
  Throwable failureCause = null;

  for (Service service : services) {
    try {
      service.startAndWait();
    } catch (UncheckedExecutionException e) {
      failureCause = e.getCause();
      break;
    }
  }

  if (failureCause != null) {
    // Stop all running services and then throw the failure exception
    try {
      stopAll();
    } catch (Throwable t) {
      // Ignore the stop error. Just log.
      LOG.warn("Failed when stopping all services on start failure", t);
    }

    Throwables.propagateIfPossible(failureCause, Exception.class);
    throw new RuntimeException(failureCause);
  }
}
 
開發者ID:apache,項目名稱:twill,代碼行數:27,代碼來源:CompositeService.java

示例4: next

import com.google.common.util.concurrent.UncheckedExecutionException; //導入方法依賴的package包/類
@Override
public String next(String seqName) throws Exception {
    String routingKey = resolver.get().orNull();
    if( routingKey!=null ) {
        logger.debug("Routing sequence generator lookup key is '{}'", routingKey);
    } else {
        logger.warn("Routing sequence generator lookup key cannot be found in current context!");
        routingKey = "__absent_tenant__";
    }
    try {
        return localResourceStore.getUnchecked(routingKey).next(seqName);
    } catch (UncheckedExecutionException e) {
        Throwable cause = e.getCause();
        throw new IllegalStateException("Cannot determine target DataSource for lookup key [" + routingKey + "]", cause);
    }
}
 
開發者ID:hekailiang,項目名稱:cloud-config,代碼行數:17,代碼來源:SequenceGeneratorFactoryBean.java

示例5: getTableDescriptor

import com.google.common.util.concurrent.UncheckedExecutionException; //導入方法依賴的package包/類
@Override
public HTableDescriptor getTableDescriptor(TableName tableName)
    throws TableNotFoundException, IOException {
  if (tableName == null) {
    return null;
  }

  String bigtableTableName = TableMetadataSetter.getBigtableName(tableName, options);
  GetTableRequest request = GetTableRequest.newBuilder().setName(bigtableTableName).build();

  try {
    return tableAdapter.adapt(bigtableAdminClient.getTable(request));
  } catch (UncheckedExecutionException e) {
    if (e.getCause() != null && e.getCause() instanceof OperationRuntimeException) {
      Status status = ((OperationRuntimeException) e.getCause()).getStatus();
      if (status.getCode() == Status.NOT_FOUND.getCode()) {
        throw new TableNotFoundException(tableName);
      }
    }
    throw new IOException("Failed to getTableDescriptor() on " + tableName, e);
  } catch (Throwable throwable) {
    throw new IOException("Failed to getTableDescriptor() on " + tableName, throwable);
  }
}
 
開發者ID:dmmcerlean,項目名稱:cloud-bigtable-client,代碼行數:25,代碼來源:BigtableAdmin.java

示例6: getCluster

import com.google.common.util.concurrent.UncheckedExecutionException; //導入方法依賴的package包/類
private Cluster getCluster(BigtableClusterAdminClient client, String clusterName) {
  GetClusterRequest request = GetClusterRequest.newBuilder().setName(clusterName).build();
  try {
    Cluster response = client.getCluster(request);
    return response;
  } catch (UncheckedExecutionException e) {
    if (e.getCause() != null && e.getCause() instanceof OperationRuntimeException) {
      Status status = ((OperationRuntimeException) e.getCause()).getStatus();
      if (status.getCode() == Status.NOT_FOUND.getCode()) {
        return null;
      }
    }
    e.printStackTrace();
    throw e;
  }
}
 
開發者ID:dmmcerlean,項目名稱:cloud-bigtable-client,代碼行數:17,代碼來源:TestClusterAPI.java

示例7: getImportedBy

import com.google.common.util.concurrent.UncheckedExecutionException; //導入方法依賴的package包/類
public Collection<ConfigKeyPath> getImportedBy(ConfigKeyPath configKey, Optional<Config> runtimeConfig) {
  if (this.fullImportedByMap != null) {
    return this.fullImportedByMap.get(configKey);
  }

  try {
    return this.ownImportedByMap.get(configKey, () -> this.fallback.getImportedBy(configKey, runtimeConfig));
  } catch (UncheckedExecutionException exc) {
    if (exc.getCause() instanceof UnsupportedOperationException) {
      computeImportedByMap(runtimeConfig);
      return getImportedBy(configKey, runtimeConfig);
    } else {
      throw new RuntimeException(exc);
    }
  } catch (ExecutionException ee) {
    throw new RuntimeException(ee);
  }
}
 
開發者ID:apache,項目名稱:incubator-gobblin,代碼行數:19,代碼來源:InMemoryTopology.java

示例8: write

import com.google.common.util.concurrent.UncheckedExecutionException; //導入方法依賴的package包/類
@Override
public void write(E entity) {
  Preconditions.checkState(state.equals(ReaderWriterState.OPEN),
      "Attempt to write to a writer in state:%s", state);

  reusedKey.reuseFor(entity);

  DatasetWriter<E> writer = cachedWriters.getIfPresent(reusedKey);
  if (writer == null) {
    // get a new key because it is stored in the cache
    StorageKey key = StorageKey.copy(reusedKey);
    try {
      writer = cachedWriters.getUnchecked(key);
    } catch (UncheckedExecutionException ex) {
      // catch & release: the correct exception is that the entity cannot be
      // written because it isn't in the View. But to avoid checking in every
      // write call, check when writers are created, catch the exception, and
      // throw the correct one here.
      throw new IllegalArgumentException(
          "View does not contain entity:" + entity, ex.getCause());
    }
  }

  writer.write(entity);
}
 
開發者ID:cloudera,項目名稱:cdk,代碼行數:26,代碼來源:PartitionedDatasetWriter.java

示例9: getElement

import com.google.common.util.concurrent.UncheckedExecutionException; //導入方法依賴的package包/類
@Override
public Element getElement(final Object id) throws IllegalStateException {
	try {
		return getElementCache().get(id);
	} catch (InvalidCacheLoadException icle) {
		//NTF this is no problem and quite normal
		return null;
	} catch (UncheckedExecutionException uee) {
		Throwable cause = uee.getCause();
		if (cause != null && cause instanceof UserAccessException) {
			throw new UserAccessException(cause.getMessage(), cause);
		} else {
			throw uee;
		}
	} catch (Throwable t) {
		throw new IllegalStateException("Unable to retrieve id " + String.valueOf(id), t);
	}
}
 
開發者ID:OpenNTF,項目名稱:org.openntf.domino,代碼行數:19,代碼來源:DElementStore.java

示例10: getEncryptionCertificate

import com.google.common.util.concurrent.UncheckedExecutionException; //導入方法依賴的package包/類
@Timed
public CertificateDto getEncryptionCertificate(String entityId) {
    URI uri = UriBuilder
            .fromUri(configUri)
            .path(Urls.ConfigUrls.ENCRYPTION_CERTIFICATES_RESOURCE)
            .buildFromEncoded(StringEncoding.urlEncode(entityId));
    try {
        return encryptionCertificates.getUnchecked(uri);
    } catch (UncheckedExecutionException e){
        Throwables.throwIfUnchecked(e.getCause());
        throw new RuntimeException(e.getCause());
    }
}
 
開發者ID:alphagov,項目名稱:verify-hub,代碼行數:14,代碼來源:CertificatesConfigProxy.java

示例11: getSignatureVerificationCertificates

import com.google.common.util.concurrent.UncheckedExecutionException; //導入方法依賴的package包/類
@Timed
public Collection<CertificateDto> getSignatureVerificationCertificates(String entityId) {
    URI uri = UriBuilder
            .fromUri(configUri)
            .path(Urls.ConfigUrls.SIGNATURE_VERIFICATION_CERTIFICATES_RESOURCE)
            .buildFromEncoded(StringEncoding.urlEncode(entityId));
    try {
        return signingCertificates.getUnchecked(uri);
    } catch (UncheckedExecutionException e){
        Throwables.throwIfUnchecked(e.getCause());
        throw new RuntimeException(e.getCause());
    }
}
 
開發者ID:alphagov,項目名稱:verify-hub,代碼行數:14,代碼來源:CertificatesConfigProxy.java

示例12: getShouldHubSignResponseMessages

import com.google.common.util.concurrent.UncheckedExecutionException; //導入方法依賴的package包/類
public Boolean getShouldHubSignResponseMessages(String entityId) {
    final UriBuilder uriBuilder = UriBuilder
            .fromUri(configUri)
            .path(Urls.ConfigUrls.SHOULD_HUB_SIGN_RESPONSE_MESSAGES_RESOURCE);
    for (Map.Entry<String, String> entry : ImmutableMap.<String, String>of().entrySet()) {
        uriBuilder.queryParam(entry.getKey(), entry.getValue());
    }
    URI uri = uriBuilder.buildFromEncoded(StringEncoding.urlEncode(entityId).replace("+", "%20"));
    try {
        return booleanCache.getUnchecked(uri);
    } catch (UncheckedExecutionException e) {
        Throwables.throwIfUnchecked(e.getCause());
        throw new RuntimeException(e.getCause());
    }
}
 
開發者ID:alphagov,項目名稱:verify-hub,代碼行數:16,代碼來源:TransactionsConfigProxy.java

示例13: getShouldHubUseLegacySamlStandard

import com.google.common.util.concurrent.UncheckedExecutionException; //導入方法依賴的package包/類
public Boolean getShouldHubUseLegacySamlStandard(String entityId) {
    final UriBuilder uriBuilder = UriBuilder
            .fromUri(configUri)
            .path(Urls.ConfigUrls.SHOULD_HUB_USE_LEGACY_SAML_STANDARD_RESOURCE);
    for (Map.Entry<String, String> entry : ImmutableMap.<String, String>of().entrySet()) {
        uriBuilder.queryParam(entry.getKey(), entry.getValue());
    }
    URI uri = uriBuilder.buildFromEncoded(StringEncoding.urlEncode(entityId).replace("+", "%20"));
    try {
        return booleanCache.getUnchecked(uri);
    } catch (UncheckedExecutionException e) {
        Throwables.throwIfUnchecked(e.getCause());
        throw new RuntimeException(e.getCause());
    }
}
 
開發者ID:alphagov,項目名稱:verify-hub,代碼行數:16,代碼來源:TransactionsConfigProxy.java

示例14: openDataContext

import com.google.common.util.concurrent.UncheckedExecutionException; //導入方法依賴的package包/類
@Override
public DataContext openDataContext(final String dataSourceName) throws NoSuchDataSourceException {
    try {
        return loadingCache.getUnchecked(dataSourceName);
    } catch (UncheckedExecutionException e) {
        final Throwable cause = e.getCause();
        if (cause instanceof RuntimeException) {
            throw (RuntimeException) cause;
        }
        throw new MetaModelException(
                "Unexpected error happened while getting DataContext '" + dataSourceName + "' from cache", e);
    }
}
 
開發者ID:apache,項目名稱:metamodel-membrane,代碼行數:14,代碼來源:CachedDataSourceRegistryWrapper.java

示例15: getTenantContext

import com.google.common.util.concurrent.UncheckedExecutionException; //導入方法依賴的package包/類
@Override
public TenantContext getTenantContext(String tenantIdentifier) throws NoSuchTenantException {
    try {
        return loadingCache.getUnchecked(tenantIdentifier);
    } catch (UncheckedExecutionException e) {
        final Throwable cause = e.getCause();
        if (cause instanceof RuntimeException) {
            throw (RuntimeException) cause;
        }
        throw new MetaModelException("Unexpected error happened while getting TenantContext '" + tenantIdentifier
                + "' from cache", e);
    }
}
 
開發者ID:apache,項目名稱:metamodel-membrane,代碼行數:14,代碼來源:CachedTenantRegistryWrapper.java


注:本文中的com.google.common.util.concurrent.UncheckedExecutionException.getCause方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。