本文整理匯總了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());
}
}
示例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;
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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;
}
}
示例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);
}
}
示例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);
}
示例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);
}
}
示例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());
}
}
示例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());
}
}
示例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());
}
}
示例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());
}
}
示例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);
}
}
示例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);
}
}