0 Replies Latest reply on Apr 9, 2017 8:32 AM by rbattenfeld

    Wildfly 10.1.0.Final: Question regarding variable visibility after commit

    rbattenfeld

      Hi

       

      I migrated a running app from the old JBoss Community 6 version to the latest wildfly version.

       

      We face a problem for which I don't have an explanation. In say 10 commits, 1 commit hides a list. More specific, before the commit, the list contains elements, after the commit the list is empty. This happens just periodically.

       

        @Override
          public List<U> batchAll(final List<T> listT) {
              List<U> resultList = null;
              try {
                  if (listT.size() == 1) {
                      resultList = new LinkedList<U>();
                      resultList.add(batchSingle(listT.get(0)));
                  } else {
                      getUserTransaction().begin();
                      resultList = processAll(listT);
                      getUserTransaction().commit(); // HERE IS THE COMMIT, resultList IS EMPTY FROM TIME TO TIME
                      postProcess(listT, resultList);
                  }
              } catch (Exception ex) { // NOSONAR we have to catch everything here
                  rollback();
                  handleBatchException(listT, ex);
                  resultList = new LinkedList<U>();
                  for (T t : listT) {
                      resultList.add(batchSingle(t));
                  }
              }
              return resultList;
          }
      

       

      The fun part is, everything is persisted. I tried to migrate this specific code to Container Managed Transactions but I got the same. May this is not related, we had to increase the thread-pool size since the app uses timers a lot.

       

      Any idea what is wrong with this code?