本文整理汇总了Java中org.elasticsearch.common.io.stream.StreamOutput.writeException方法的典型用法代码示例。如果您正苦于以下问题:Java StreamOutput.writeException方法的具体用法?Java StreamOutput.writeException怎么用?Java StreamOutput.writeException使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.elasticsearch.common.io.stream.StreamOutput
的用法示例。
在下文中一共展示了StreamOutput.writeException方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: writeStackTraces
import org.elasticsearch.common.io.stream.StreamOutput; //导入方法依赖的package包/类
/**
* Serializes the given exceptions stacktrace elements as well as it's suppressed exceptions to the given output stream.
*/
public static <T extends Throwable> T writeStackTraces(T throwable, StreamOutput out) throws IOException {
StackTraceElement[] stackTrace = throwable.getStackTrace();
out.writeVInt(stackTrace.length);
for (StackTraceElement element : stackTrace) {
out.writeString(element.getClassName());
out.writeOptionalString(element.getFileName());
out.writeString(element.getMethodName());
out.writeVInt(element.getLineNumber());
}
Throwable[] suppressed = throwable.getSuppressed();
out.writeVInt(suppressed.length);
for (Throwable t : suppressed) {
out.writeException(t);
}
return throwable;
}
示例2: writeTo
import org.elasticsearch.common.io.stream.StreamOutput; //导入方法依赖的package包/类
@Override
public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
if (out.getVersion().before(Version.V_6_0_0_alpha1_UNRELEASED)) {
// legacy version
out.writeLong(-1L);
}
out.writeOptionalString(allocationId);
out.writeBoolean(primary);
if (storeException != null) {
out.writeBoolean(true);
out.writeException(storeException);
} else {
out.writeBoolean(false);
}
}
示例3: writeTo
import org.elasticsearch.common.io.stream.StreamOutput; //导入方法依赖的package包/类
@Override
public void writeTo(StreamOutput out) throws IOException {
node.writeTo(out);
if (out.getVersion().before(Version.V_6_0_0_alpha1_UNRELEASED)) {
// legacy version
out.writeLong(-1L);
}
out.writeOptionalString(allocationId);
allocationStatus.writeTo(out);
if (storeException != null) {
out.writeBoolean(true);
out.writeException(storeException);
} else {
out.writeBoolean(false);
}
}
示例4: writeTo
import org.elasticsearch.common.io.stream.StreamOutput; //导入方法依赖的package包/类
@Override
public void writeTo(StreamOutput out) throws IOException {
out.writeException(reason);
out.writeOptionalString(index);
out.writeOptionalVInt(shardId);
out.writeOptionalString(nodeId);
}
示例5: writeTo
import org.elasticsearch.common.io.stream.StreamOutput; //导入方法依赖的package包/类
@Override
public void writeTo(StreamOutput out) throws IOException {
out.writeOptionalString(this.getMessage());
out.writeException(this.getCause());
writeStackTraces(this, out);
if (out.getVersion().onOrAfter(Version.V_5_3_0_UNRELEASED)) {
out.writeMapOfLists(headers, StreamOutput::writeString, StreamOutput::writeString);
out.writeMapOfLists(metadata, StreamOutput::writeString, StreamOutput::writeString);
} else {
HashMap<String, List<String>> finalHeaders = new HashMap<>(headers.size() + metadata.size());
finalHeaders.putAll(headers);
finalHeaders.putAll(metadata);
out.writeMapOfLists(finalHeaders, StreamOutput::writeString, StreamOutput::writeString);
}
}
示例6: writeTo
import org.elasticsearch.common.io.stream.StreamOutput; //导入方法依赖的package包/类
public void writeTo(StreamOutput out) throws IOException {
out.writeByte((byte) reason.ordinal());
out.writeLong(unassignedTimeMillis);
// Do not serialize unassignedTimeNanos as System.nanoTime() cannot be compared across different JVMs
out.writeBoolean(delayed);
out.writeOptionalString(message);
out.writeException(failure);
out.writeVInt(failedAllocations);
lastAllocationStatus.writeTo(out);
}
示例7: writeTo
import org.elasticsearch.common.io.stream.StreamOutput; //导入方法依赖的package包/类
@Override
public void writeTo(StreamOutput out) throws IOException {
out.writeBoolean(inSync);
out.writeOptionalString(allocationId);
out.writeLong(matchingBytes);
out.writeException(storeException);
}
示例8: writeTo
import org.elasticsearch.common.io.stream.StreamOutput; //导入方法依赖的package包/类
@Override
public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
shardId.writeTo(out);
out.writeString(allocationId);
out.writeVLong(primaryTerm);
out.writeString(message);
out.writeException(failure);
}
示例9: writeTo
import org.elasticsearch.common.io.stream.StreamOutput; //导入方法依赖的package包/类
@Override
public void writeTo(StreamOutput out) throws IOException {
out.writeString(index);
out.writeOptionalString(type);
out.writeString(id);
out.writeException(exception);
}
示例10: writeTo
import org.elasticsearch.common.io.stream.StreamOutput; //导入方法依赖的package包/类
@Override
public void writeTo(StreamOutput out) throws IOException {
if (shardTarget == null) {
out.writeBoolean(false);
} else {
out.writeBoolean(true);
shardTarget.writeTo(out);
}
out.writeString(reason);
RestStatus.writeTo(out, status);
out.writeException(cause);
}
示例11: writeTo
import org.elasticsearch.common.io.stream.StreamOutput; //导入方法依赖的package包/类
@Override
public void writeTo(StreamOutput out) throws IOException {
if (response != null) {
out.writeBoolean(true);
response.writeTo(out);
} else {
out.writeBoolean(false);
out.writeException(exception);
}
}
示例12: writeTo
import org.elasticsearch.common.io.stream.StreamOutput; //导入方法依赖的package包/类
@Override
public void writeTo(StreamOutput out) throws IOException {
out.writeString(nodeId);
out.writeLong(taskId);
out.writeException(reason);
RestStatus.writeTo(out, status);
}
示例13: writeTo
import org.elasticsearch.common.io.stream.StreamOutput; //导入方法依赖的package包/类
@Override
public void writeTo(StreamOutput out) throws IOException {
shardId.writeTo(out);
out.writeOptionalString(nodeId);
out.writeException(cause);
RestStatus.writeTo(out, status);
out.writeBoolean(primary);
}
示例14: writeTo
import org.elasticsearch.common.io.stream.StreamOutput; //导入方法依赖的package包/类
@Override
public void writeTo(StreamOutput out) throws IOException {
if (index == null) {
out.writeBoolean(false);
} else {
out.writeBoolean(true);
out.writeString(index);
}
out.writeVInt(shardId);
out.writeException(reason);
RestStatus.writeTo(out, status);
}
示例15: writeTo
import org.elasticsearch.common.io.stream.StreamOutput; //导入方法依赖的package包/类
@Override
public void writeTo(StreamOutput out) throws IOException {
out.writeString(getIndex());
out.writeString(getType());
out.writeOptionalString(getId());
out.writeException(getCause());
}