本文整理汇总了Java中com.google.common.base.Throwables.propagate方法的典型用法代码示例。如果您正苦于以下问题:Java Throwables.propagate方法的具体用法?Java Throwables.propagate怎么用?Java Throwables.propagate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.common.base.Throwables
的用法示例。
在下文中一共展示了Throwables.propagate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toBytes
import com.google.common.base.Throwables; //导入方法依赖的package包/类
@Override
public void toBytes(ByteBuf buf) {
ByteArrayOutputStream obj = new ByteArrayOutputStream();
try {
GZIPOutputStream gzip = new GZIPOutputStream(obj);
ObjectOutputStream objStream = new ObjectOutputStream(gzip);
objStream.writeObject(values);
objStream.close();
}
catch (IOException e) {
Throwables.propagate(e);
}
buf.writeShort(obj.size());
buf.writeBytes(obj.toByteArray());
}
示例2: findResource
import com.google.common.base.Throwables; //导入方法依赖的package包/类
@Override
public InputStream findResource(URI systemId)
{
try
{
String path = systemId.toString();
if( !path.startsWith(basePath) )
{
path = PathUtils.filePath(basePath, path);
}
return fileSystemService.read(handle, path);
}
catch( IOException e )
{
throw Throwables.propagate(e);
}
}
示例3: before
import com.google.common.base.Throwables; //导入方法依赖的package包/类
private void before(final AgentClusterRule clusterRule) throws IOException {
clusterRule.before();
AgentConfig agentConfig = clusterRule.agentConfig();
File configFile = temporaryFolder.newFile();
Files.writeTo(configFile, agentConfig.toJson());
agentBootstrapThread = new Thread(() -> {
try {
AgentBootstrap.main(new String[]{configFile.getAbsolutePath()});
} catch (Exception e) {
Throwables.propagate(e);
}
});
registryClusterClient = clusterRule.agentRegistryClusterClient();
}
示例4: getSigningCredential
import com.google.common.base.Throwables; //导入方法依赖的package包/类
private Credential getSigningCredential(final RoleDescriptorResolver resolver, final RequestAbstractType profileRequest) {
try {
final MetadataCredentialResolver kekCredentialResolver = new MetadataCredentialResolver();
final SignatureValidationConfiguration config = getSignatureValidationConfiguration();
kekCredentialResolver.setRoleDescriptorResolver(resolver);
kekCredentialResolver.setKeyInfoCredentialResolver(
DefaultSecurityConfigurationBootstrap.buildBasicInlineKeyInfoCredentialResolver());
kekCredentialResolver.initialize();
final CriteriaSet criteriaSet = new CriteriaSet();
criteriaSet.add(new SignatureValidationConfigurationCriterion(config));
criteriaSet.add(new UsageCriterion(UsageType.SIGNING));
buildEntityCriteriaForSigningCredential(profileRequest, criteriaSet);
return kekCredentialResolver.resolveSingle(criteriaSet);
} catch (final Exception e) {
throw Throwables.propagate(e);
}
}
示例5: toLong
import com.google.common.base.Throwables; //导入方法依赖的package包/类
/**
* Milliseconds since 'epoch' in UTC time.
*
* @return
*/
@Override
public long toLong()
{
if( conceptualValue != null )
{
try
{
return new UtcDate(Dates.ISO_DATE_ONLY.parse(conceptualValue, DateHelper.UTC_TIMEZONE).getTime())
.toLong();
}
catch( ParseException pe )
{
throw Throwables.propagate(pe);
}
}
return utc;
}
示例6: getGlobalTask
import com.google.common.base.Throwables; //导入方法依赖的package包/类
@Override
public GlobalTaskStartInfo getGlobalTask(ClusteredTask globalTask, long millis)
{
if( !globalTask.isGlobal() )
throw new Error("Isn't a global task");
String globalId = globalTask.getGlobalId();
String existingTaskId = getRunningGlobalTask(globalId);
if( existingTaskId != null )
{
ensureGlobalTaskRunner(existingTaskId, globalTask);
return new GlobalTaskStartInfo(existingTaskId, true);
}
String globalPath = zookeeperService.getFullPath(ZK_GLOBALTASKPATH, globalId);
try
{
String taskId = UUID.randomUUID().toString();
try
{
curator.create().creatingParentsIfNeeded().forPath(globalPath, taskId.getBytes());
return new GlobalTaskStartInfo(startInternal(globalTask, taskId), false);
}
catch( NodeExistsException nee )
{
final String taskFromZk = new String(curator.getData().forPath(globalPath));
//ensure there *is* a task for this
ensureGlobalTaskRunner(taskFromZk, globalTask);
return new GlobalTaskStartInfo(taskFromZk, false);
}
}
catch( Exception e )
{
throw Throwables.propagate(e);
}
}
示例7: destroy
import com.google.common.base.Throwables; //导入方法依赖的package包/类
/**
* Stops the couchbase client.
*/
@PreDestroy
public void destroy() {
try {
LOGGER.debug("Shutting down Couchbase");
this.couchbase.shutdown();
} catch (final Exception e) {
throw Throwables.propagate(e);
}
}
示例8: close
import com.google.common.base.Throwables; //导入方法依赖的package包/类
@Override
public void close()
{
if( response != null && !consumed )
{
final HttpEntity entity = response.getEntity();
if( entity != null )
{
try
{
EntityUtils.consume(entity);
}
catch( IOException io )
{
throw Throwables.propagate(io);
}
}
consumed = true;
}
try
{
Closeables.close(in, true);
}
catch( IOException ex )
{
// Ignore
}
if( httpMethod != null )
{
httpMethod.releaseConnection();
}
}
示例9: viewMessage
import com.google.common.base.Throwables; //导入方法依赖的package包/类
public Pair<MessageView, List<MessageTrack>> viewMessage(String subject, final String msgId) {
try {
MessageExt messageExt = mqAdminExt.viewMessage(msgId);
List<MessageTrack> messageTrackList = messageTrackDetail(messageExt);
return new Pair<>(MessageView.fromMessageExt(messageExt), messageTrackList);
} catch (Exception e) {
throw Throwables.propagate(e);
}
}
示例10: getBalance
import com.google.common.base.Throwables; //导入方法依赖的package包/类
public BigDecimal getBalance(String accountAddress, Convert.Unit unit) {
try {
BigInteger balance = web3j.ethGetBalance(accountAddress, DefaultBlockParameterName.LATEST).send().getBalance();
return Convert.fromWei(new BigDecimal(balance), unit);
} catch (IOException e) {
throw Throwables.propagate(e);
}
}
示例11: msgToInternalDate
import com.google.common.base.Throwables; //导入方法依赖的package包/类
public static ZonedDateTime msgToInternalDate(ImapMessage msg) {
try {
return msg.getInternalDate();
} catch (UnfetchedFieldException ex) {
throw Throwables.propagate(ex);
}
}
示例12: deleteDocuments
import com.google.common.base.Throwables; //导入方法依赖的package包/类
public void deleteDocuments(Term key) {
committerThread.throwExceptionIfAny();
try {
writer.deleteDocuments(key);
} catch (IOException ex) {
throw Throwables.propagate(ex);
}
}
示例13: OAIProperties
import com.google.common.base.Throwables; //导入方法依赖的package包/类
@Inject
public OAIProperties(@Named("oaiLegacyProps") Properties properties) throws Throwable // NOSONAR
{
this.properties = new OAIExtendedProperties(properties);
try
{
AbstractCatalog.factory(this.properties, null);
}
catch( Exception e )
{
Throwables.propagate(e);
}
}
示例14: doQuery
import com.google.common.base.Throwables; //导入方法依赖的package包/类
private String doQuery(String query, @Nullable String sort, boolean reverse, @Nullable String where,
@Nullable String info, int offset, int length)
{
final Request request = createRequest("search");
//cleanup query
String q = query;
q = q.replaceAll("/", "\\\\/");
request.addParameter("q", q);
request.addParameter("start", offset);
request.addParameter("length", length);
request.addParameter("reverse", Boolean.toString(reverse));
if( sort != null )
{
request.addParameter("order", sort);
}
if( where != null )
{
request.addParameter("where", where);
}
if( info != null )
{
request.addParameter("info", info);
}
try( Response response = httpService.getWebContent(request, configService.getProxyDetails()) )
{
if( response.isOk() )
{
StringWriter sw = new StringWriter();
CharStreams.copy(new InputStreamReader(response.getInputStream()), sw);
return sw.toString();
}
throw new RuntimeException("Unable to query cloud search results: " + response.getMessage());
}
catch( IOException io )
{
throw Throwables.propagate(io);
}
}
示例15: checkedGet
import com.google.common.base.Throwables; //导入方法依赖的package包/类
@Override
public DOMRpcResult checkedGet(final long timeout, final TimeUnit unit) throws TimeoutException, DOMRpcException {
try {
return get(timeout, unit);
} catch (InterruptedException | ExecutionException e) {
// FIXME: Add exception mapping
throw Throwables.propagate(e);
}
}