Author: chris.laprun(a)jboss.com
Date: 2011-10-28 12:05:37 -0400 (Fri, 28 Oct 2011)
New Revision: 7910
Modified:
portal/trunk/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/WSRPServiceIntegration.java
portal/trunk/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/wsrp-configuration.xml
Log:
- GTNPORTAL-2241: Delayed start of ConsumerRegistry to allow for proper publication of
WSDL and avoid deadlock. Delay is configurable in wsrp-configuration.xml.
Modified:
portal/trunk/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/WSRPServiceIntegration.java
===================================================================
---
portal/trunk/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/WSRPServiceIntegration.java 2011-10-28
15:06:07 UTC (rev 7909)
+++
portal/trunk/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/WSRPServiceIntegration.java 2011-10-28
16:05:37 UTC (rev 7910)
@@ -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@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
{
@@ -338,7 +353,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:
portal/trunk/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/wsrp-configuration.xml
===================================================================
---
portal/trunk/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/wsrp-configuration.xml 2011-10-28
15:06:07 UTC (rev 7909)
+++
portal/trunk/wsrp-integration/extension-war/src/main/webapp/WEB-INF/conf/wsrp/wsrp-configuration.xml 2011-10-28
16:05:37 UTC (rev 7910)
@@ -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>