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


Java ErrorMessage类代码示例

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


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

示例1: getError

import org.sdnplatform.sync.thrift.ErrorMessage; //导入依赖的package包/类
/**
 * Generate an error message from the provided transaction ID and
 * exception
 * @param transactionId the transaction Id
 * @param error the exception
 * @param type the type of the message that generated the error
 * @return the {@link SyncError} message
 */
protected SyncMessage getError(int transactionId, Exception error, 
                               MessageType type) {
    int ec = SyncException.ErrorType.GENERIC.getValue();
    if (error instanceof SyncException) {
        ec = ((SyncException)error).getErrorType().getValue();
    } else {
        logger.error("Unexpected error processing message " + transactionId
                     + "(" + type + ")", error);
    }
    SyncError m = new SyncError();
    m.setErrorCode(ec);
    m.setMessage(error.getMessage());
    ErrorMessage em = new ErrorMessage();
    em.setError(m);
    em.setType(type);
    AsyncMessageHeader header = new AsyncMessageHeader();
    header.setTransactionId(transactionId);
    em.setHeader(header);
    SyncMessage bsm = new SyncMessage(MessageType.ERROR);
    bsm.setError(em);
    return bsm;
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:31,代码来源:AbstractRPCChannelHandler.java

示例2: handleError

import org.sdnplatform.sync.thrift.ErrorMessage; //导入依赖的package包/类
@Override
protected void handleError(ErrorMessage error, Channel channel) {            
    ErrorType errType = ErrorType.GENERIC;
    for (ErrorType e : ErrorType.values()) {
        if (e.getValue() == error.getError().getErrorCode()) {
            errType = e;
            break;
        }
    }
    SyncException ex = 
            SyncException.newInstance(errType, 
                                      error.getError().getMessage(), 
                                      null);
    if (ChannelState.CONNECTED.equals(channelState) ||
        ChannelState.OPEN.equals(channelState) ||
        ErrorType.AUTH.equals(errType)) {
        syncManager.channelDisconnected(ex);
        channel.close();
    } else {
        SyncReply reply = new SyncReply(null, null, false, ex, 0);
        syncManager.dispatchReply(error.getHeader().getTransactionId(), 
                                  reply);
    }
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:25,代码来源:RemoteSyncChannelHandler.java

示例3: getError

import org.sdnplatform.sync.thrift.ErrorMessage; //导入依赖的package包/类
/**
 * Generate an error message from the provided transaction ID and
 * exception
 * @param transactionId the transaction Id
 * @param error the exception
 * @param type the type of the message that generated the error
 * @return the {@link SyncError} message
 */
protected SyncMessage getError(int transactionId, Exception error,
                               MessageType type) {
    int ec = SyncException.ErrorType.GENERIC.getValue();
    if (error instanceof SyncException) {
        ec = ((SyncException)error).getErrorType().getValue();
    } else {
        logger.error("Unexpected error processing message " + transactionId
                     + "(" + type + ")", error);
    }
    SyncError m = new SyncError();
    m.setErrorCode(ec);
    m.setMessage(error.getMessage());
    ErrorMessage em = new ErrorMessage();
    em.setError(m);
    em.setType(type);
    AsyncMessageHeader header = new AsyncMessageHeader();
    header.setTransactionId(transactionId);
    em.setHeader(header);
    SyncMessage bsm = new SyncMessage(MessageType.ERROR);
    bsm.setError(em);
    return bsm;
}
 
开发者ID:zhenshengcai,项目名称:floodlight-hardware,代码行数:31,代码来源:AbstractRPCChannelHandler.java

示例4: handleError

import org.sdnplatform.sync.thrift.ErrorMessage; //导入依赖的package包/类
@Override
protected void handleError(ErrorMessage error, Channel channel) {
    ErrorType errType = ErrorType.GENERIC;
    for (ErrorType e : ErrorType.values()) {
        if (e.getValue() == error.getError().getErrorCode()) {
            errType = e;
            break;
        }
    }
    SyncException ex =
            SyncException.newInstance(errType,
                                      error.getError().getMessage(),
                                      null);
    if (ChannelState.CONNECTED.equals(channelState) ||
        ChannelState.OPEN.equals(channelState) ||
        ErrorType.AUTH.equals(errType)) {
        syncManager.channelDisconnected(ex);
        channel.close();
    } else {
        SyncReply reply = new SyncReply(null, null, false, ex, 0);
        syncManager.dispatchReply(error.getHeader().getTransactionId(),
                                  reply);
    }
}
 
开发者ID:zhenshengcai,项目名称:floodlight-hardware,代码行数:25,代码来源:RemoteSyncChannelHandler.java

示例5: handleError

import org.sdnplatform.sync.thrift.ErrorMessage; //导入依赖的package包/类
protected void handleError(ErrorMessage error, Channel channel) {
    logger.error("[{}->{}] Error for message {} ({}): {} ({})", 
                 new Object[]{getLocalNodeIdString(), 
                              getRemoteNodeIdString(),
                              error.getHeader().getTransactionId(),
                              error.getType(),
                              error.getError().getMessage(),
                              error.getError().getErrorCode()});
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:10,代码来源:AbstractRPCChannelHandler.java

示例6: handleError

import org.sdnplatform.sync.thrift.ErrorMessage; //导入依赖的package包/类
@LogMessageDoc(level="ERROR",
               message="[{id}->{id}] Error for message {id} ({type}): " + 
                       "{message} {error code}",
               explanation="Remote client sent an error",
               recommendation=LogMessageDoc.GENERIC_ACTION)
protected void handleError(ErrorMessage error, Channel channel) {
    logger.error("[{}->{}] Error for message {} ({}): {} ({})", 
                 new Object[]{getLocalNodeIdString(), 
                              getRemoteNodeIdString(),
                              error.getHeader().getTransactionId(),
                              error.getType(),
                              error.getError().getMessage(),
                              error.getError().getErrorCode()});
}
 
开发者ID:nsg-ethz,项目名称:iTAP-controller,代码行数:15,代码来源:AbstractRPCChannelHandler.java

示例7: getError

import org.sdnplatform.sync.thrift.ErrorMessage; //导入依赖的package包/类
/**
 * Generate an error message from the provided transaction ID and
 * exception
 * @param transactionId the transaction Id
 * @param error the exception
 * @param type the type of the message that generated the error
 * @return the {@link SyncError} message
 */
@LogMessageDoc(level="ERROR",
               message="Unexpected error processing message {} ({})",
               explanation="An error occurred while processing an " + 
                           "RPC message",
               recommendation=LogMessageDoc.GENERIC_ACTION)
protected SyncMessage getError(int transactionId, Exception error, 
                               MessageType type) {
    int ec = SyncException.ErrorType.GENERIC.getValue();
    if (error instanceof SyncException) {
        ec = ((SyncException)error).getErrorType().getValue();
    } else {
        logger.error("Unexpected error processing message " + transactionId
                     + "(" + type + ")", error);
    }
    SyncError m = new SyncError();
    m.setErrorCode(ec);
    m.setMessage(error.getMessage());
    ErrorMessage em = new ErrorMessage();
    em.setError(m);
    em.setType(type);
    AsyncMessageHeader header = new AsyncMessageHeader();
    header.setTransactionId(transactionId);
    em.setHeader(header);
    SyncMessage bsm = new SyncMessage(MessageType.ERROR);
    bsm.setError(em);
    return bsm;
}
 
开发者ID:nsg-ethz,项目名称:iTAP-controller,代码行数:36,代码来源:AbstractRPCChannelHandler.java

示例8: handleError

import org.sdnplatform.sync.thrift.ErrorMessage; //导入依赖的package包/类
protected void handleError(ErrorMessage error, Channel channel) {
    logger.error("[{}->{}] Error for message {} ({}): {} ({})",
                 new Object[]{getLocalNodeIdString(),
                              getRemoteNodeIdString(),
                              error.getHeader().getTransactionId(),
                              error.getType(),
                              error.getError().getMessage(),
                              error.getError().getErrorCode()});
}
 
开发者ID:zhenshengcai,项目名称:floodlight-hardware,代码行数:10,代码来源:AbstractRPCChannelHandler.java


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