本文整理汇总了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);
}
示例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);
}
示例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);
}