2 Replies Latest reply on Jun 24, 2004 10:10 AM by Alexei Sadovnikov

    Deploy Stateless Bean before Sheduler starts work

    anny_lut Newbie

      How to make my Stateless bean to be deployed, before sheduler starts to work?

      In other words - is it possible to edit scheduler-service.xml file in such way, that my sheduler task starts after deploying of all my beans.
      Or is it possible to invoke method from my Stateless bean from sheduler task.

      The problem is, that sheduler starts before my Stateless bean deployed
      :((

      here is my scheduler-service.xml

      <mbean code="org.jboss.varia.scheduler.Scheduler"
       name=":service=Scheduler">
       <attribute name="StartAtStartup">true</attribute>
       <attribute name="SchedulableClass">bars.kltoss.mover.MoverScheduler</attribute>
       <attribute name="SchedulableArguments"></attribute>
       <attribute name="SchedulableArgumentTypes"></attribute>
       <attribute name="InitialStartDate">0</attribute>
       <attribute name="SchedulePeriod">15500</attribute>
       <attribute name="InitialRepetitions">-1</attribute>
       </mbean>
      


        • 1. Re: Deploy Stateless Bean before Sheduler starts work
          jae Master

          did you try adding a "depends" tag for the session bean to the scheduler-service.xml file?

          • 2. Re: Deploy Stateless Bean before Sheduler starts work
            Alexei Sadovnikov Newbie

            A possible solution: your MBean can listen for notification event of type EJBDeployer.START_NOTIFICATION.
            1) implement NotificationFilter, NotificationListener
            public boolean isNotificationEnabled(Notification n) {
            return EJBDeployer.START_NOTIFICATION_TYPE.equals(n.getType());
            }
            public void handleNotification(Notification n, Object handback) {
            DeploymentInfo di = (DeploymentInfo) n.getUserObject();
            if (di.shortName.equals("yourbean.ear")) {
            //now start the scheduler
            }
            }

            2) in create() method of your bean:
            ObjectName name = new ObjectName("jboss.ejb:service=EJBDeployer");
            getServer().addNotificationListener(name, this, this, "someName");

            See javax.management.*