Results 1 to 2 of 2

Thread: RMI timeout from a jsp page in a spring mvc based application

Hybrid View

  1. #1
    Join Date
    Aug 2009
    Posts
    20

    Lightbulb 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. #2
    Join Date
    May 2011
    Location
    Madrid (Spain)
    Posts
    101

    Default

    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.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •