notnoop/java-apns — pull request #120 by flozano (2013-07-06 16:20:15+00:00)
Title: Add a configuration parameter to set the read timeout in sockets before reading data from them.

I have found a weird behavior in one of my servers:
````
"task-scheduler-0" prio=10 tid=0x00007fef2d642800 nid=0x3c5b runnable [0x00007fef007d0000]
java.lang.Thread.State: RUNNABLE
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:150)
at java.net.SocketInputStream.read(SocketInputStream.java:121)
at sun.security.ssl.InputRecord.readFully(InputRecord.java:442)
at sun.security.ssl.InputRecord.read(InputRecord.java:480)
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:927)
- locked <0x0000000786f6a120> (a java.lang.Object)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1312)
- locked <0x0000000786f6a0e0> (a java.lang.Object)
at sun.security.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:882)
at sun.security.ssl.AppInputStream.read(AppInputStream.java:102)
- locked <0x0000000786f722d0> (a sun.security.ssl.AppInputStream)
at sun.security.ssl.AppInputStream.read(AppInputStream.java:69)
- locked <0x0000000786f722d0> (a sun.security.ssl.AppInputStream)
at java.io.DataInputStream.readInt(DataInputStream.java:387)
at com.notnoop.apns.internal.Utilities.parseFeedbackStreamRaw(Utilities.java:200)
at com.notnoop.apns.internal.Utilities.parseFeedbackStream(Utilities.java:219)
at com.notnoop.apns.internal.ApnsFeedbackConnection.getInactiveDevicesImpl(ApnsFeedbackConnection.java:105)
at com.notnoop.apns.internal.ApnsFeedbackConnection.getInactiveDevices(ApnsFeedbackConnection.java:74)
at com.notnoop.apns.internal.AbstractApnsService.getInactiveDevices(AbstractApnsService.java:132)
at com.notnoop.apns.internal.ApnsServiceImpl.getInactiveDevices(ApnsServiceImpl.java:36)
````

This thread is in this state for ages already. I would like to be able to set a read timeout to avoid the ApnsService#getInactiveDevices() call to be locked this long.