Announcement Announcement Module
Collapse
No announcement yet.
RMI timeout from a jsp page in a spring mvc based application Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • RMI timeout from a jsp page in a spring mvc based application

    Hi all ,

    I have a spring mvc application , where I use jsp's for the view. From the jsp's we make rmi calls to rmi server located on a remote machine, which interm runs various shell scripts.

    Now the problem is ,I want my rmi calls to timeout if it takes more than a specified period of time, so say if the shell scripts are running for more than 10 mins I want the rmi calls to get timed out which I handle in my code and give a appropriate message to the user.

    I have been looking around for this , but did not get much success with it. Any suggestions will be of great help.

    Brief code ->
    -------------

    In my mvc web application I have this following bean ->

    <bean id="adminRefreshService" class="org.springframework.remoting.rmi.RmiProxyFa ctoryBean" scope="prototype">
    <property name="serviceUrl" value="#{ rcmUtil.getURLForThisHost() }"/>
    <property name="serviceInterface" value="com.rcmutil.web.service.Service"/>
    </bean>

    In my RMI server code we have the following ->

    <bean class="org.springframework.remoting.rmi.RmiService Exporter">
    <!-- does not necessarily have to be the same name as the bean to be exported -->
    <property name="serviceName" value="adminRefreshService"/>
    <property name="service" ref="policyRefreshService"/>
    <property name="serviceInterface" value="com.bofa.service.Service"/>
    <!-- defaults to 1099 -->
    <property name="registryPort" value="1199"/>
    </bean>

    I am looking for some timeout configuration such that my rmi calls times out after a certain period of time.

    - Andy

  • #2
    Hi, try to overwrite the registryClientSocketFactory property of the RmiProxyFactoryBean’s instance with your own implementation of RMIClientSocketFactory. You can override the createSocket method and just set a timeout on the one created by default.

    Comment

    Working...
    X