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


Java ServerError类代码示例

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


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

示例1: fromException

import org.apache.cassandra.transport.ServerError; //导入依赖的package包/类
public static ErrorMessage fromException(Throwable e)
{
    int streamId = 0;
    if (e instanceof WrappedException)
    {
        streamId = ((WrappedException)e).streamId;
        e = e.getCause();
    }

    if (e instanceof TransportException)
        return new ErrorMessage((TransportException)e, streamId);

    // Unexpected exception
    logger.error("Unexpected exception during request", e);
    return new ErrorMessage(new ServerError(e), streamId);
}
 
开发者ID:pgaref,项目名称:ACaZoo,代码行数:17,代码来源:ErrorMessage.java

示例2: fromException

import org.apache.cassandra.transport.ServerError; //导入依赖的package包/类
/**
 * @param e the exception
 * @param unexpectedExceptionHandler a callback for handling unexpected exceptions. If null, or if this
 *                                   returns false, the error is logged at ERROR level via sl4fj
 */
public static ErrorMessage fromException(Throwable e, Predicate<Throwable> unexpectedExceptionHandler)
{
    int streamId = 0;
    if (e instanceof WrappedException)
    {
        streamId = ((WrappedException)e).streamId;
        e = e.getCause();
    }

    if (e instanceof TransportException)
        return new ErrorMessage((TransportException)e, streamId);

    // Unexpected exception
    if (unexpectedExceptionHandler == null || !unexpectedExceptionHandler.apply(e))
        logger.error("Unexpected exception during request", e);

    return new ErrorMessage(new ServerError(e), streamId);
}
 
开发者ID:daidong,项目名称:GraphTrek,代码行数:24,代码来源:ErrorMessage.java

示例3: fromException

import org.apache.cassandra.transport.ServerError; //导入依赖的package包/类
/**
 * @param e the exception
 * @param unexpectedExceptionHandler a callback for handling unexpected exceptions. If null, or if this
 *                                   returns false, the error is logged at ERROR level via sl4fj
 */
public static ErrorMessage fromException(Throwable e, Predicate<Throwable> unexpectedExceptionHandler)
{
    int streamId = 0;

    // Netty will wrap exceptions during decoding in a CodecException. If the cause was one of our ProtocolExceptions
    // or some other internal exception, extract that and use it.
    if (e instanceof CodecException)
    {
        Throwable cause = e.getCause();
        if (cause != null && cause instanceof WrappedException)
        {
            streamId = ((WrappedException)cause).streamId;
            e = cause.getCause();
        }
    }
    else if (e instanceof WrappedException)
    {
        streamId = ((WrappedException)e).streamId;
        e = e.getCause();
    }

    if (e instanceof TransportException)
        return new ErrorMessage((TransportException)e, streamId);

    // Unexpected exception
    if (unexpectedExceptionHandler == null || !unexpectedExceptionHandler.apply(e))
        logger.error("Unexpected exception during request", e);

    return new ErrorMessage(new ServerError(e), streamId);
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:36,代码来源:ErrorMessage.java


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