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


Java Throwables.propagate方法代码示例

本文整理汇总了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());
}
 
开发者ID:p455w0rd,项目名称:ToughExpansion,代码行数:17,代码来源:PacketConfigSync.java

示例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);
	}
}
 
开发者ID:equella,项目名称:Equella,代码行数:18,代码来源:FileSystemResourceLocator.java

示例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();
}
 
开发者ID:florentw,项目名称:bench,代码行数:17,代码来源:AgentBootstrapIntegrationTest.java

示例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);
    }
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:20,代码来源:SamlObjectSignatureValidator.java

示例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;
}
 
开发者ID:equella,项目名称:Equella,代码行数:23,代码来源:UtcDate.java

示例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);
	}
}
 
开发者ID:equella,项目名称:Equella,代码行数:35,代码来源:ClusteredTaskServiceImpl.java

示例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);
    }
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:13,代码来源:CouchbaseTicketRegistry.java

示例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();
	}
}
 
开发者ID:equella,项目名称:Equella,代码行数:35,代码来源:HttpServiceImpl.java

示例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);
    }
}
 
开发者ID:didapinchegit,项目名称:rocket-console,代码行数:11,代码来源:MessageServiceImpl.java

示例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);
    }
}
 
开发者ID:papyrusglobal,项目名称:state-channels,代码行数:9,代码来源:EthereumService.java

示例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);
  }
}
 
开发者ID:HubSpot,项目名称:NioImapClient,代码行数:8,代码来源:TestUtils.java

示例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);
  }
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:9,代码来源:LuceneSearchIndex.java

示例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);
	}

}
 
开发者ID:equella,项目名称:Equella,代码行数:15,代码来源:OAIProperties.java

示例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);
	}
}
 
开发者ID:equella,项目名称:Equella,代码行数:41,代码来源:CloudServiceImpl.java

示例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);
    }
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:10,代码来源:LazyDOMRpcResultFuture.java


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