3 Replies Latest reply on Jan 29, 2002 12:02 PM by Horia Muntean

    Force a Bean to Passivate

    Iulian Radulescu Newbie

      Hi,
      Check this problem: In some point in my application, I do the followings:
      1. call a finder who returns a Collection (there are a lot of items in this Collection 1000 - 2000).
      2. for every member of this collection I search for data in other table, using another bean. In this case, I get some 5-6 references of this bean.
      3. In some point of the execution, JBoss just stop, without returning any error.

      I think I could force to passivate every bean from the first Collection after I used it, but I don-t know how to do that.

      Have any idea about this one? Please, neead a suggestion.

      Iulian.

        • 1. Re: Force a Bean to Passivate
          Hermann RANGAMANA Newbie

          > Hi,
          > Check this problem: In some point in my application,
          > I do the followings:
          > 1. call a finder who returns a Collection (there are
          > a lot of items in this Collection 1000 - 2000).
          > 2. for every member of this collection I search for
          > data in other table, using another bean. In this
          > case, I get some 5-6 references of this bean.
          > 3. In some point of the execution, JBoss just stop,
          > without returning any error.
          >
          > I think I could force to passivate every bean from
          > the first Collection after I used it, but I don-t
          > know how to do that.
          >
          > Have any idea about this one? Please, neead a
          > suggestion.
          >
          > Iulian.


          Hi,

          Activation/Passivation is managed by the container. You cannot access it directly .. only the container decides when and how it'll activate/passivate an instance of your bean ...
          But what exactly is happening in point 3 of your problem ? Can you describe in a more detailed manner what step did you follow to make jboss hang? Is there any message error or exception? It may be helpful too that you post here the more relevant part of your source code ..

          Reguards

          --hermann

          • 2. Re: Force a Bean to Passivate
            Iulian Radulescu Newbie

            Hi,

            The problem is that JBoss doesn't throw any exception, or even a message that indicates a problem. I'll try to explain more clearly the situation:

            First, I call a finder for an entity bean who returns a lot of data (some 1000 bean references). Then, for every bean from this collection, I go in another table, witch is related to the first by a foreign key, and run a finder on that table, finder witch returns 5-6 bean references.

            Basically, the code is something like this :

            Collection c_niInt =niHome.findByCriteria(stmt_ni);
            Iterator c_i = c_niIntf.iterator();

            while (c_i.hasNext())
            {
            niIntf = (NomItmIntf) c_i.next();
            if (checkItemCond(niIntf))
            {
            GridLine line_value = loadFieldsValues(niIntf);
            gridValues.add(line_value);
            loadChilds(niIntf.get_nitm_code(), version);
            }
            }

            NomItmIntf is the remote interface for the first bean
            The function checkItemCond verify some extra conditions
            GridLine is a structure in witch a stored data from the two tables.

            The table corresponding to the first bean contains a ierarchy, so in function loadChilds I find the descendents for a particular item, and I stored information adout them in the same structure.

            • 3. Re: Force a Bean to Passivate
              Horia Muntean Newbie

              If u use the default container configuration (standardjoboss.xml) i think the number of rows (i.e. beans)of your find_by_criteria overheads the pool limit so this could be the explanation for jboss lock. so:

              1.try to modify the pool upper limit in the standard configuration or write a new container configuration in your jboss.xml and associate it with your entity bean.
              2.don't use entity bean access at all since u don't update the rows u find. try plain select statements.