1 Reply Latest reply: Sep 12, 2013 4:15 AM by Gobinath RSS

    DBConnections and Page Refresh Issue

    Gobinath

      Hi,

      I have a requirement where I need to refresh certain pages in a webcenter application. These pages generally have one taskflow in them.

      I tried two options

      1) -

          FacesContext context = FacesContext.getCurrentInstance();

          String currentView = context.getViewRoot().getViewId();

          ViewHandler vh = context.getApplication().getViewHandler();

          UIViewRoot x = vh.createView(context, currentView);

          context.setViewRoot(x);

       

      This option was not fully functioning, some parts of the page was not refreshing properly and data was not proper (a manual browser refresh sets the page right though)

       

      2)

      String _returnViewId = root.getViewId();

              if (_returnViewId == null)

                  return;

       

              ExternalContext external = context.getExternalContext();

              Application application = context.getApplication();

              ViewHandler viewHandler = application.getViewHandler();

              String actionURL = viewHandler.getActionURL(context, _returnViewId);

              actionURL = external.encodeActionURL(actionURL);

              // Get rid of possible query parameters in the URL to force full page refresh

              String[] comps = actionURL.split("\\?");

              if (comps.length > 0) {

                  actionURL = comps[0];

              }

              try {

                  log.debug("Redirecting to " + actionURL);

                  external.redirect(actionURL);

              } catch (IOException e) {

                  log.error("Cannot redirect to " + actionURL, e);

              }

       

      The second option seemed to work fine until we ran into performance testing. Now it looks like everytime these pages are refreshed the dbconnection count goes up by 1.

      Some more info on the taskflow

      - i have set "use existing transaction if possible" for transaction behaviour of the taskflow

      - when the page loads for the first time there is no increase in dbconnection count, only when redirect-refresh happens there is a increase in dbconnection count.

       

      Any inputs would be highly appreciated

       

      Regards,

        • 1. Re: DBConnections and Page Refresh Issue
          Gobinath

          Hi,

          I did a bit more work on this and it seems that the issue occurs in pages where the taskflow has method which accesses VO int he following manner

           

                         DCIteratorBinding dcIteratorBinding3 = bindings.findIteratorBinding("xxxIterator");

                      ViewObjectImpl xxVO = (ViewObjectImpl)dcIteratorBinding3.getViewObject();

           

          whereas in other pages where taskflow methods use the following way to access VO there is no issue with increase in the connection count

           

                   xxAMImpl am2 = (xxAMImpl)Configuration.createRootApplicationModule(amDef2,config2);

                  ViewObject xxVO = am2.getXxVO1();

           

          Would greatly appreciate any help or pointers