Stability patterns applied in a RESTful architecture | JavaWorld
The 'Retry' pattern
Apache
Retrying will not help in the case of permanent errors, however. In this case retrying wastes resource and time on both the client and server side.
'Use Timeouts' pattern
Essentially, the Sockets API defines two types of timeouts:
The connection timeout denotes the maximum time elapsed before the connection is established or an error occurs.
The socket timeout defines the maximum period of inactivity between two consecutive data packets arriving on the client side after a connection has been established.
The current version of Jersey uses HttpURLConnection. By default Jersey sets a connection or socket timeout of 0 millis, meaning that the timeout is infinite.
Connection pooling ensures that after performing an HTTP transaction the connection will be reused for further HTTP transactions, assuming the connection is identified as a persistent connection. This approach saves the overhead of establishing new TCP/IP connections, which is significant.
Read full article from Stability patterns applied in a RESTful architecture | JavaWorld
The 'Retry' pattern
Apache
HttpClient
and other network clients implement some stability features out of the box. For instance, the client might execute retries internally under some circumstances. This strategy helps to handle transient network errors such as dropped connections or server failovers. Retrying will not help in the case of permanent errors, however. In this case retrying wastes resource and time on both the client and server side.
'Use Timeouts' pattern
Essentially, the Sockets API defines two types of timeouts:
The connection timeout denotes the maximum time elapsed before the connection is established or an error occurs.
The socket timeout defines the maximum period of inactivity between two consecutive data packets arriving on the client side after a connection has been established.
The current version of Jersey uses HttpURLConnection. By default Jersey sets a connection or socket timeout of 0 millis, meaning that the timeout is infinite.
Connection pooling ensures that after performing an HTTP transaction the connection will be reused for further HTTP transactions, assuming the connection is identified as a persistent connection. This approach saves the overhead of establishing new TCP/IP connections, which is significant.
Read full article from Stability patterns applied in a RESTful architecture | JavaWorld