0 Replies Latest reply on Mar 24, 2013 3:40 PM by 801933

    How to set the timeout for stateful EJB

    801933
      I try to set the timeout in weblogic-ejb-jar.xml as follow:
      <?xml version="1.0" encoding="UTF-8"?>
      <wls:weblogic-ejb-jar xmlns:wls="http://xmlns.oracle.com/weblogic/weblogic-ejb-jar"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd
      http://xmlns.oracle.com/weblogic/weblogic-ejb-jar http://xmlns.oracle.com/weblogic/weblogic-ejb-jar/1.2/weblogic-ejb-jar.xsd">
      <weblogic-enterprise-bean>
      <ejb-name>AlsAdminLogSearch</ejb-name>
      <enable-call-by-reference>True</enable-call-by-reference>
      <stateful-session-descriptor>
                     <stateful-session-cache>
                          <!-- <max-beans-in-cache>1</max-beans-in-cache>-->
                          <idle-timeout-seconds>2</idle-timeout-seconds>
                          <session-timeout-seconds>5</session-timeout-seconds>
                     </stateful-session-cache>
                </stateful-session-descriptor>          
      </weblogic-enterprise-bean>
      </wls:weblogic-ejb-jar>

      and in the EJB, I implement @Remove and @PrePassivate as follow:
      @PrePassivate
      public void prePassivate(){
           System.out.println("LogSearchBean prePassivate() is called");
      }

      @Remove
      public LogSearchOutput remove(){
           System.out.println("LogSearchBean remove() is called");
      }

      But I find that, after I created the stateful EJB and let it idle, the EJB will not be passivate and /or remove in a long time (over one hour), I expect the EJB will be passivate after 2 seconds and then remove after 5 second as set in weblogic-ejb-jar.xml.
      What is the problem?