pvm14
pvm14

Reputation: 544

SocketTimeoutException in EJB client call

I'm getting the reference to a remote EJB instance without any kind of problem but, sometimes, when I invoke one of its methods a "java.net.SocketTimeoutException: Read timed out" is thrown from the client side. There seem to be no problems at the server side

Is there a way to set EJB client timeout on a per-invocation basis?

I'm using a pretty old JBoss version (4.2.1 GA)

Regards

Upvotes: 1

Views: 1695

Answers (1)

Nayan Wadekar
Nayan Wadekar

Reputation: 11602

  1. You can configure InvokerLocater attribute for Connector MBean.

    <attribute name="InvokerLocator">socket://{jboss.bind.address}:3873/?socketTimeout=60000</attribute>

  2. Can provide more finer details for the config element under Configuration attribute. By default it's one minute.

    <attribute name="socketTimeout">60000</attribute>

  3. Providing timeout parameters in the JNDI properties file.

    jnp.timeout : The connection timeout in milliseconds. The default value is 0 which means the connection will block until the VM TCP/IP layer times out.

    jnp.sotimeout : The connected socket read timeout in milliseconds. The default value is 0 which means reads will block. This is the value passed to the Socket.setSoTimeout on the newly connected socket.

    To manually configure timeout for individual invocations, you have to create initial context with appropriate property values.

Upvotes: 1

Related Questions