[gatein-commits] gatein SVN: r7911 - in epp/portal/branches/EPP_5_2_Branch/wsrp-integration: extension-war/src/main/webapp/WEB-INF/conf/wsrp and 1 other directory.

do-not-reply at jboss.org do-not-reply at jboss.org
Fri Oct 28 12:11:47 EDT 2011


Author: chris.laprun at jboss.com
Date: 2011-10-28 12:11:47 -0400 (Fri, 28 Oct 2011)
New Revision: 7911

Modified:
   epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/WSRPServiceIntegration.java
   epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/wsrp-configuration.xml
Log:
- JBEPP-1319: Delayed start of ConsumerRegistry to allow for proper publication of WSDL and avoid deadlock. Delay is configurable in wsrp-configuration.xml.

Modified: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/WSRPServiceIntegration.java
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/WSRPServiceIntegration.java	2011-10-28 16:05:37 UTC (rev 7910)
+++ epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/WSRPServiceIntegration.java	2011-10-28 16:11:47 UTC (rev 7911)
@@ -78,6 +78,9 @@
 
 import javax.servlet.ServletContext;
 import java.io.InputStream;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
 
 /**
  * @author <a href="mailto:chris.laprun at jboss.com">Chris Laprun</a>
@@ -90,6 +93,8 @@
    private static final String CLASSPATH = "classpath:/";
    private static final String PRODUCER_CONFIG_LOCATION = "producerConfigLocation";
    private static final String CONSUMERS_CONFIG_LOCATION = "consumersConfigLocation";
+   public static final String CONSUMERS_INIT_DELAY = "consumersInitDelay";
+   public static final int DEFAULT_DELAY = 2;
 
    private final InputStream producerConfigurationIS;
    private final String producerConfigLocation;
@@ -102,6 +107,7 @@
    private final ExoKernelIntegration exoKernelIntegration;
    private final boolean bypass;
    private static final String WSRP_ADMIN_GUI_CONTEXT_PATH = "/wsrp-admin-gui";
+   private int consumersInitDelay;
 
    public WSRPServiceIntegration(ExoContainerContext context, InitParams params, ConfigurationManager configurationManager,
                                  ExoKernelIntegration pc, NodeHierarchyCreator nhc) throws Exception
@@ -117,6 +123,15 @@
          {
             producerConfigLocation = params.getValueParam(PRODUCER_CONFIG_LOCATION).getValue();
             consumersConfigLocation = params.getValueParam(CONSUMERS_CONFIG_LOCATION).getValue();
+            String delayString = params.getValueParam(CONSUMERS_INIT_DELAY).getValue();
+            try
+            {
+               consumersInitDelay = Integer.parseInt(delayString);
+            }
+            catch (NumberFormatException e)
+            {
+               consumersInitDelay = DEFAULT_DELAY;
+            }
          }
          else
          {
@@ -330,7 +345,22 @@
          migrationService.setStructureProvider(structureprovider);
          consumerRegistry.setMigrationService(migrationService);
 
-         consumerRegistry.start();
+         // wait 'delay' seconds before starting the consumers to give JBoss WS a chance to publish the WSDL and not deadlock
+         ScheduledExecutorService scheduledExecutorService = Executors.newScheduledThreadPool(1);
+         scheduledExecutorService.schedule(new Runnable()
+         {
+            public void run()
+            {
+               try
+               {
+                  consumerRegistry.start();
+               }
+               catch (Exception e)
+               {
+                  throw new RuntimeException(e);
+               }
+            }
+         }, consumersInitDelay, TimeUnit.SECONDS);
 
          // set up a PortletInvokerResolver so that when a remote producer is queried, we can start it if needed
          RegisteringPortletInvokerResolver resolver = new RegisteringPortletInvokerResolver();

Modified: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/wsrp-configuration.xml
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/wsrp-configuration.xml	2011-10-28 16:05:37 UTC (rev 7910)
+++ epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/wsrp-configuration.xml	2011-10-28 16:11:47 UTC (rev 7911)
@@ -41,6 +41,11 @@
             <description>Location of the default consumers configuration file</description>
             <value>conf/wsrp-consumers-config.xml</value>
          </value-param>
+         <value-param>
+            <name>consumersInitDelay</name>
+            <description>Time (in seconds) after the start of the WSRP extension, waited before the consumers are started</description>
+            <value>2</value>
+         </value-param>
       </init-params>
    </component>
 



More information about the gatein-commits mailing list