本文整理汇总了Java中org.jboss.remoting3.MessageOutputStream类的典型用法代码示例。如果您正苦于以下问题:Java MessageOutputStream类的具体用法?Java MessageOutputStream怎么用?Java MessageOutputStream使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MessageOutputStream类属于org.jboss.remoting3包,在下文中一共展示了MessageOutputStream类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleReport
import org.jboss.remoting3.MessageOutputStream; //导入依赖的package包/类
@Override
public void handleReport(final MessageSeverity severity, final String message) {
if(true) {
return;
}
try {
// We don't expect any response, so just write the message
final MessageOutputStream os = channelAssociation.getChannel().writeMessage();
try {
final FlushableDataOutput output = ProtocolUtils.wrapAsDataOutput(os);
final ManagementRequestHeader header = new ManagementRequestHeader(ManagementProtocol.VERSION, -1, batchId, ModelControllerProtocol.HANDLE_REPORT_REQUEST);
header.write(output);
output.write(ModelControllerProtocol.PARAM_MESSAGE_SEVERITY);
output.writeUTF(severity.toString());
output.write(ModelControllerProtocol.PARAM_MESSAGE);
output.writeUTF(message);
output.writeByte(ManagementProtocol.REQUEST_END);
output.close();
} finally {
StreamUtils.safeClose(os);
}
} catch (Exception e) {
ControllerLogger.MGMT_OP_LOGGER.error(e.getLocalizedMessage(),e);
}
}
示例2: handlePing
import org.jboss.remoting3.MessageOutputStream; //导入依赖的package包/类
/**
* Handle a simple ping request.
*
* @param channel the channel
* @param header the protocol header
* @throws IOException for any error
*/
private static void handlePing(final Channel channel, final ManagementProtocolHeader header) throws IOException {
final ManagementProtocolHeader response = new ManagementPongHeader(header.getVersion());
final MessageOutputStream output = channel.writeMessage();
try {
writeHeader(response, output);
output.close();
} finally {
StreamUtils.safeClose(output);
}
}
示例3: writeErrorResponse
import org.jboss.remoting3.MessageOutputStream; //导入依赖的package包/类
/**
* Write an error response.
*
* @param channel the channel
* @param header the request
* @param error the error
* @throws IOException
*/
protected static void writeErrorResponse(final Channel channel, final ManagementRequestHeader header, final Throwable error) throws IOException {
final ManagementResponseHeader response = ManagementResponseHeader.create(header, error);
final MessageOutputStream output = channel.writeMessage();
try {
writeHeader(response, output);
output.close();
} finally {
StreamUtils.safeClose(output);
}
}
示例4: writeResponse
import org.jboss.remoting3.MessageOutputStream; //导入依赖的package包/类
protected static void writeResponse(final Channel channel, final ManagementRequestHeader header, final Exception error) throws IOException {
final ManagementResponseHeader response = ManagementResponseHeader.create(header, error);
final MessageOutputStream output = channel.writeMessage();
try {
writeHeader(response, output);
output.write(ManagementProtocol.RESPONSE_END);
output.close();
} finally {
StreamUtils.safeClose(output);
}
}
示例5: writeMessage
import org.jboss.remoting3.MessageOutputStream; //导入依赖的package包/类
@Override
public FlushableDataOutput writeMessage(final ManagementProtocolHeader header) throws IOException {
final MessageOutputStream os = channel.writeMessage();
return AbstractMessageHandler.writeHeader(header, os);
}