2 Replies Latest reply on Apr 27, 2009 5:27 PM by tomaszatwork

    Stateless <-> Statefull(SCOPETYPE.APPLICATION)

    tomaszatwork

      I send data directly over RMI (1099) to stateless session bean worker that make complicate calculation with it. After the calculation is complete i send the result to the statefull session bean (SCOPE = APPLICATION) to sort and merge the calculated data. Is this stateless --> statefull pattern the right way to realise this task?


      If i start my programm i become warning like this:


        16:29:26,221 WARN  [arjLoggerI18N] [com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator_4] TwoPhaseCoordinator.afterCompletion - returned failure for com.arjuna.ats.internal.jta.resources.arjunacore.SynchronizationImple@7efeedc
      





      hier is the code example:




        ....
      
        @Stateful
        @Scope(ScopeType.APPLICATION)
        @Name("dataSorter")
        public class DataSorter implements DataSorterService {
          @In
          EntityManager entityManager;  
      
          public void send(Long orderId, Object data) {
            map.put(orderId, data);
            //persist data
          }
        }
      
      
        ....
      
        @Stateful
        @Scope(ScopeType.APPLICATION)
        @Name("dataSorter")
        public class DataSorter implements DataSorterService {
          @In
          EntityManager entityManager;  
      
          public void send(Long orderId, Object data) {
            map.put(orderId, data);
            //persist data
          }
        }
      
      




        • 1. Re: Stateless <-> Statefull(SCOPETYPE.APPLICATION)
          gonorrhea

          The code looks identical to me.  ???

          • 2. Re: Stateless <-> Statefull(SCOPETYPE.APPLICATION)
            tomaszatwork

            sorry



              
              @Stateless
              @Name("dataReceiver")
              public class Datareceiver implements DataReceiverService {
                @In
                EntityManager entityManager;  
            
                @In
                DataSorter dataSorter;  
            
            
                public void receive() {
                  //get the next id
                  int orderId = dataSorter.getOrderId();
            
                  //make complicate calculation
                  Object data = ...
            
                  //persist data
             
                  //send the data for sorting
                  dataSorter.send(orderId, data)
                  
                }
              }
            
            
              ....
            
              @Stateful
              @Scope(ScopeType.APPLICATION)
              @Name("dataSorter")
              public class DataSorter implements DataSorterService {
                @In
                EntityManager entityManager;  
            
                public void send(Long orderId, Object data) {
                  map.put(orderId, data);
            
                  //persist data
                  ...
                }
              }