Multiple PortalContainerPostInitTask not executed in correct order

Solution Unverified - Updated -

Issue

  • We register 2 different listeners in the web.xml of our content project:
<listener>
  <listener-class>com.sample.FirstInitListener</listener-class>
</listener>
<listener>
  <listener-class>com.sample.SecondInitListener</listener-class>
</listener>

They are executed in correct order.

Each of this listener add's a PortalContainerPostInitTask:

 public void contextInitialized(ServletContextEvent event) {
        final PortalContainerPostInitTask task = new PortalContainerPostInitTask() {

            @Override
            public void execute(ServletContext context, PortalContainer portalContainer) {
                contextInitialized(context, portalContainer);
            }
        };
        PortalContainer.addInitTask(event.getServletContext(), task);
    }

But when the Queue gets executed, the order is wrong, and the second task gets executed before the first one.

Inside the GateIn code we found that an PriorityBlockingQueue is used which should guarantee that FIFO is implied used.

How can we get the init tasks executed in correct order?

Environment

  • Red Hat JBoss Portal
    • 5.1.1

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In