MCPcopy Create free account
hub / github.com/grpc/grpc-java / flush

Method flush

okhttp/src/main/java/io/grpc/okhttp/AsyncSink.java:154–183  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

152 }
153
154 @Override
155 public void flush() throws IOException {
156 if (closed) {
157 throw new IOException("closed");
158 }
159 try (TaskCloseable ignore = PerfMark.traceTask("AsyncSink.flush")) {
160 synchronized (lock) {
161 if (flushEnqueued) {
162 return;
163 }
164 flushEnqueued = true;
165 }
166 serializingExecutor.execute(new WriteRunnable() {
167 final Link link = PerfMark.linkOut();
168 @Override
169 public void doRun() throws IOException {
170 Buffer buf = new Buffer();
171 try (TaskCloseable ignore = PerfMark.traceTask("WriteRunnable.runFlush")) {
172 PerfMark.linkIn(link);
173 synchronized (lock) {
174 buf.write(buffer, buffer.size());
175 flushEnqueued = false;
176 }
177 sink.write(buf, buf.size());
178 sink.flush();
179 }
180 }
181 });
182 }
183 }
184
185 @Override
186 public Timeout timeout() {

Callers

nothing calls this directly

Calls 1

executeMethod · 0.45

Tested by

no test coverage detected