Refresh Your Java - Before Java Interview
We are Agile, believe in less Documentation - Only Quick notes (Java Interview Questions) of Java/J2ee Read more....
Socket Timeout would occur if the Client Socket (may
be Tcp/Http/Soap clients) does not get
the response in
configured timeframe for any given request, in order to avoid this
you need
to change the Client Socket Timeout settings as
shown below.
If you encounter this issue while
making a Web Service call, the APIs like Axis, CFX etc.,
have some default Socket Timeout settings, you may need to
override those.
If you create your own HTTP you need to have that set up on your own.
Either way setting SocketTimeout is really important, if
not the Client may wait for an
undefined amount of time
for the response which may hung your applications.
HTTP
Client:
httpclient.getParams().setParameter("http.socket.timeout",
new Integer(1000));
In Axis 1.4
Override the
Default Value as shown below in the ServicePort class.
AxisProperties.setProperty(org.apache.axis.components.net.
DefaultCommonsHTTPClientProperties.CONNECTION_DEFAULT_SO_TIMEOUT_KEY,
'10000');
AxisProperties.setProperty(org.apache.axis.components.net.
DefaultCommonsHTTPClientProperties.
CONNECTION_DEFAULT_CONNECTION_TIMEOUT_KEY,
10000');
Please note if
this Timeout happens due to network issues or Performance issue ,
you may need
to handle them separately.
This Portal is intended to put all Java/J2ee related topics at one single place for quick referance, not only Technical , but also the Project Management Related thing such as Development Process methodoogies build process, unit testing etc.,
This Portal has More than 500 Java Interview Questions (also could be Considered as Quick Notes) very neatly separated topic by topic with simple diagrams which makes you easily understandable. Importantly these are from our Realtime expericance.