File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
util/src/main/java/io/kubernetes/client/util Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -216,6 +216,24 @@ public WebSocketOutputStream(int stream) {
216
216
this .stream = (byte ) stream ;
217
217
}
218
218
219
+ @ Override
220
+ public void flush () throws IOException {
221
+ if (state == State .CLOSED ) {
222
+ throw new IOException ("Socket is closed!" );
223
+ }
224
+ int i = 0 ;
225
+ while (WebSocketStreamHandler .this .socket .queueSize () > 0 ) {
226
+ try {
227
+ Thread .sleep (100 );
228
+ } catch (InterruptedException ex ) {
229
+ }
230
+ // Wait a maximum of 10 seconds.
231
+ if (i ++ > 100 ) {
232
+ throw new IOException ("Timed out waiting for web-socket to flush." );
233
+ }
234
+ }
235
+ }
236
+
219
237
@ Override
220
238
public void write (int b ) throws IOException {
221
239
write (new byte [] {(byte ) b });
You can’t perform that action at this time.
0 commit comments