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