Author: jonesde
Date: Wed Feb 2 07:31:21 2011 New Revision: 1066356 URL: http://svn.apache.org/viewvc?rev=1066356&view=rev Log: Bug fix to support multiple delegators; these places has a hard-coded dispatcher name that may have been created with a delegator different from the one that is now active and attempted to be used with the same old dispatcher, resulting in undesired database switching; changed to the convention of using the delegator name for the dispatcher name, which is the normal default and should be used everywhere a special dispatcher name specific to a context, like a webapp, is not used Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/GenericDispatcher.java ofbiz/trunk/framework/service/src/org/ofbiz/service/job/JobManager.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/XmlRpcEventHandler.java Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/GenericDispatcher.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/GenericDispatcher.java?rev=1066356&r1=1066355&r2=1066356&view=diff ============================================================================== --- ofbiz/trunk/framework/service/src/org/ofbiz/service/GenericDispatcher.java (original) +++ ofbiz/trunk/framework/service/src/org/ofbiz/service/GenericDispatcher.java Wed Feb 2 07:31:21 2011 @@ -49,7 +49,7 @@ public class GenericDispatcher extends G public static LocalDispatcher getLocalDispatcher(String dispatcherName, Delegator delegator, Collection<URL> readerURLs, ClassLoader loader, ServiceDispatcher serviceDispatcher) { if (dispatcherName == null) { - dispatcherName = "default"; + dispatcherName = delegator.getDelegatorName(); Debug.logWarning("Got a getGenericDispatcher call with a null dispatcherName, assuming default for the name.", module); } Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/job/JobManager.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/job/JobManager.java?rev=1066356&r1=1066355&r2=1066356&view=diff ============================================================================== --- ofbiz/trunk/framework/service/src/org/ofbiz/service/job/JobManager.java (original) +++ ofbiz/trunk/framework/service/src/org/ofbiz/service/job/JobManager.java Wed Feb 2 07:31:21 2011 @@ -59,7 +59,6 @@ public class JobManager { public static final String instanceId = UtilProperties.getPropertyValue("general.properties", "unique.instanceId", "ofbiz0"); public static final Map<String, Object> updateFields = UtilMisc.<String, Object>toMap("runByInstanceId", instanceId, "statusId", "SERVICE_QUEUED"); public static final String module = JobManager.class.getName(); - public static final String dispatcherName = "JobDispatcher"; public static Map<String, JobManager> registeredManagers = FastMap.newInstance(); protected Delegator delegator; @@ -101,7 +100,7 @@ public class JobManager { /** Returns the ServiceDispatcher. */ public LocalDispatcher getDispatcher() { - LocalDispatcher thisDispatcher = GenericDispatcher.getLocalDispatcher(dispatcherName, delegator); + LocalDispatcher thisDispatcher = GenericDispatcher.getLocalDispatcher(delegator.getDelegatorName(), delegator); return thisDispatcher; } @@ -407,7 +406,7 @@ public class JobManager { } // set the loader name - jFields.put("loaderName", dispatcherName); + jFields.put("loaderName", delegator.getDelegatorName()); // set the max retry jFields.put("maxRetry", Long.valueOf(maxRetry)); Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/XmlRpcEventHandler.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/XmlRpcEventHandler.java?rev=1066356&r1=1066355&r2=1066356&view=diff ============================================================================== --- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/XmlRpcEventHandler.java (original) +++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/XmlRpcEventHandler.java Wed Feb 2 07:31:21 2011 @@ -66,7 +66,6 @@ import org.ofbiz.webapp.control.ConfigXM public class XmlRpcEventHandler extends XmlRpcHttpServer implements EventHandler { public static final String module = XmlRpcEventHandler.class.getName(); - public static final String dispatcherName = "xmlrpc-dispatcher"; protected Delegator delegator; protected LocalDispatcher dispatcher; @@ -76,7 +75,7 @@ public class XmlRpcEventHandler extends public void init(ServletContext context) throws EventHandlerException { String delegatorName = context.getInitParameter("entityDelegatorName"); this.delegator = DelegatorFactory.getDelegator(delegatorName); - this.dispatcher = GenericDispatcher.getLocalDispatcher(dispatcherName, delegator); + this.dispatcher = GenericDispatcher.getLocalDispatcher(delegator.getDelegatorName(), delegator); this.setHandlerMapping(new ServiceRpcHandler()); String extensionsEnabledString = context.getInitParameter("xmlrpc.enabledForExtensions"); |
Free forum by Nabble | Edit this page |