04 January 2019

Busy Socket

Common issue when reading from a socket without timeout:

"main" prio=10 tid=0x00007f79a4009800 nid=0x32ec runnable [0x00007f79aa67a000]
   java.lang.Thread.State: RUNNABLE
    at java.net.SocketInputStream.socketRead0(Native Method)
    at java.net.SocketInputStream.read(SocketInputStream.java:153)
    at java.net.SocketInputStream.read(SocketInputStream.java:122)
    at java.io.ObjectInputStream$PeekInputStream.read(ObjectInputStream.java:2664)
    at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2680)
    at java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:3157)
    at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:865)
    at java.io.ObjectInputStream.(ObjectInputStream.java:362)
    at com.sun.btrace.client.Client.submit(Client.java:402)
    at com.sun.btrace.client.Main.main(Main.java:206)


---

      sock.setSoTimeout(5 * 1000); //milliseconds

Other details on sockets:



1 comment :

Ram Chauhan said...
This comment has been removed by a blog administrator.

My Blog List

Blog Archive

Disclaimer

The views expressed on this blog are my own and do not necessarily reflect the views of Oracle.