MCPcopy Create free account
hub / github.com/apache/nifi-minifi-cpp / getJstacks

Function getJstacks

controller/Controller.h:129–161  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

127}
128
129int getJstacks(std::unique_ptr<minifi::io::Socket> socket, std::ostream &out) {
130 socket->initialize();
131 std::vector<uint8_t> data;
132 uint8_t op = minifi::c2::Operation::DESCRIBE;
133 minifi::io::BufferStream stream;
134 stream.write(&op, 1);
135 stream.write("jstack");
136 if (socket->write(const_cast<uint8_t*>(stream.getBuffer()), gsl::narrow<int>(stream.size())) < 0) {
137 return -1;
138 }
139 // read the response
140 uint8_t resp = 0;
141 socket->read(&resp, 1);
142 if (resp == minifi::c2::Operation::DESCRIBE) {
143
144 uint64_t size = 0;
145 socket->read(size);
146
147 for (int i = 0; i < size; i++) {
148 std::string name;
149 uint64_t lines;
150 socket->read(name);
151 socket->read(lines);
152 for (int j = 0; j < lines; j++) {
153 std::string line;
154 socket->read(line);
155 out << name << " -- " << line << std::endl;
156 }
157
158 }
159 }
160 return 0;
161}
162
163/**
164 * Prints the connection size for the provided connection.

Callers 1

mainFunction · 0.85

Calls 5

initializeMethod · 0.45
writeMethod · 0.45
getBufferMethod · 0.45
sizeMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected