Example usage for org.apache.lucene.util Accountable getChildResources

List of usage examples for org.apache.lucene.util Accountable getChildResources

Introduction

In this page you can find the example usage for org.apache.lucene.util Accountable getChildResources.

Prototype

default Collection<Accountable> getChildResources() 

Source Link

Document

Returns nested resources of this class.

Usage

From source file:org.elasticsearch.action.admin.indices.segments.IndicesSegmentResponse.java

License:Apache License

static void toXContent(XContentBuilder builder, Accountable tree) throws IOException {
    builder.startObject();//from w w w . j a  v a  2s .c  o m
    builder.field(Fields.DESCRIPTION, tree.toString());
    builder.byteSizeField(Fields.SIZE_IN_BYTES, Fields.SIZE, new ByteSizeValue(tree.ramBytesUsed()));
    Collection<Accountable> children = tree.getChildResources();
    if (children.isEmpty() == false) {
        builder.startArray(Fields.CHILDREN);
        for (Accountable child : children) {
            toXContent(builder, child);
        }
        builder.endArray();
    }
    builder.endObject();
}

From source file:org.elasticsearch.index.engine.Segment.java

License:Apache License

void writeRamTree(StreamOutput out, Accountable tree) throws IOException {
    out.writeString(tree.toString());//from  w  w  w .  j  a  v a2s .c o  m
    out.writeVLong(tree.ramBytesUsed());
    Collection<Accountable> children = tree.getChildResources();
    out.writeVInt(children.size());
    for (Accountable child : children) {
        writeRamTree(out, child);
    }
}