|
From: <jbo...@li...> - 2006-06-28 10:32:03
|
Author: hei...@jb...
Date: 2006-06-28 06:31:54 -0400 (Wed, 28 Jun 2006)
New Revision: 504
Modified:
branches/jbossws-1.0/src/main/java/org/jboss/ws/eventing/mgmt/SubscriptionManager.java
Log:
workaround for JBWS-1006
Modified: branches/jbossws-1.0/src/main/java/org/jboss/ws/eventing/mgmt/SubscriptionManager.java
===================================================================
--- branches/jbossws-1.0/src/main/java/org/jboss/ws/eventing/mgmt/SubscriptionManager.java 2006-06-28 10:05:07 UTC (rev 503)
+++ branches/jbossws-1.0/src/main/java/org/jboss/ws/eventing/mgmt/SubscriptionManager.java 2006-06-28 10:31:54 UTC (rev 504)
@@ -105,6 +105,8 @@
*/
private ThreadPoolExecutor threadPool;
+ private boolean isDispatcherBound = false;
+
/**
* subscription watchdog that maintains expirations
*/
@@ -144,10 +146,6 @@
// start the subscription watchdog
watchDog = new WatchDog(subscriptionMapping);
watchDog.startup();
-
- // bind dispatcher to JNDI
- Util.rebind(new InitialContext(), EventingConstants.DISPATCHER_JNDI_NAME, new DispatcherDelegate("localhost"));
- log.info("Bound event dispatcher to java:/" + EventingConstants.DISPATCHER_JNDI_NAME);
}
public void stop()
@@ -192,6 +190,9 @@
*/
public void registerEventSource(EventingEndpointDI deploymentInfo)
{
+ // workaround for JBWS-1006
+ lazyBindEventDispatcher();
+
EventSource eventSource = builder.newEventSource(deploymentInfo);
if (eventSourceMapping.containsKey(eventSource.getNameSpace()) == false)
{
@@ -212,6 +213,24 @@
}
}
+ private void lazyBindEventDispatcher()
+ {
+ if(!isDispatcherBound)
+ {
+ try
+ {
+ // bind dispatcher to JNDI
+ Util.rebind(new InitialContext(), EventingConstants.DISPATCHER_JNDI_NAME, new DispatcherDelegate("localhost"));
+ log.info("Bound event dispatcher to java:/" + EventingConstants.DISPATCHER_JNDI_NAME);
+ isDispatcherBound = true;
+ }
+ catch (NamingException e)
+ {
+ throw new WSException("Unable to bind EventDispatcher ", e);
+ }
+ }
+ }
+
/**
* the of deployment info's is unknown therefore we try to
* update the event source manager EPR anytime.
|