You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2011/09/23 21:22:40 UTC
svn commit: r1174964 - in /ofbiz/trunk/framework:
entity/src/org/ofbiz/entity/Delegator.java
entity/src/org/ofbiz/entity/GenericDelegator.java
service/src/org/ofbiz/service/ServiceDispatcher.java
service/src/org/ofbiz/service/jms/JmsListenerFactory.java
Author: jleroux
Date: Fri Sep 23 19:22:40 2011
New Revision: 1174964
URL: http://svn.apache.org/viewvc?rev=1174964&view=rev
Log:
A patch from Dimitri Unruh "With no DistributionCacheClear JMS is not working anymore." https://issues.apache.org/jira/browse/OFBIZ-4296
Tested in both case (with and w/out dcc), works fine AFAICT
Modified:
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/Delegator.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java
ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceDispatcher.java
ofbiz/trunk/framework/service/src/org/ofbiz/service/jms/JmsListenerFactory.java
Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/Delegator.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/Delegator.java?rev=1174964&r1=1174963&r2=1174964&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/Delegator.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/Delegator.java Fri Sep 23 19:22:40 2011
@@ -603,7 +603,7 @@ public interface Delegator {
public String getGroupHelperName(String groupName);
public GenericHelperInfo getGroupHelperInfo(String entityGroupName);
-
+
/**
* Gets the instance of ModelEntity that corresponds to this delegator and
* the specified entityName
@@ -1208,20 +1208,7 @@ public interface Delegator {
* @throws GenericEntityException
*/
public int storeByCondition(String entityName, Map<String, ? extends Object> fieldsToSet, EntityCondition condition, boolean doCacheClear) throws GenericEntityException;
-
- /**
- * Enables/Disables the JMS listeners globally
- * (this will not effect any dispatchers already running)
- * @param enable
- */
- public void enableJMS(boolean enable);
-
- /**
- * Get Enabled/Disabled JMS listeners status
- * @return boolean true is JMS listeners are enabled
- */
- public boolean getEnabledJMS();
-
+
/**
* Get use of Distributed Cache Clear mechanism status
* @return boolean true if this delegator uses a Distributed Cache Clear mechanism
Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java?rev=1174964&r1=1174963&r2=1174964&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java Fri Sep 23 19:22:40 2011
@@ -320,10 +320,7 @@ public class GenericDelegator implements
try {
Class<?> eecahClass = loader.loadClass(entityEcaHandlerClassName);
this.entityEcaHandler = UtilGenerics.cast(eecahClass.newInstance());
- boolean isJmsEnabled = getEnabledJMS();
- enableJMS(!getDelegatorInfo().useDistributedCacheClear); // To avoid duplicated JMS listeners (OFBIZ-4296)
this.entityEcaHandler.setDelegator(this);
- enableJMS(isJmsEnabled);
} catch (ClassNotFoundException e) {
Debug.logWarning(e, "EntityEcaHandler class with name " + entityEcaHandlerClassName + " was not found, Entity ECA Rules will be disabled", module);
} catch (InstantiationException e) {
@@ -2881,7 +2878,7 @@ public class GenericDelegator implements
}
// If useDistributedCacheClear is false do nothing: the distributedCacheClear member field with a null value would cause dcc code to do nothing
- if (getDelegatorInfo().useDistributedCacheClear) {
+ if (useDistributedCacheClear()) {
//time to do some tricks with manual class loading that resolves circular dependencies, like calling services
ClassLoader loader = Thread.currentThread().getContextClassLoader();
// initialize the distributedCacheClear mechanism
@@ -2904,20 +2901,6 @@ public class GenericDelegator implements
Debug.logVerbose("Distributed Cache Clear System disabled for delegator [" + delegatorFullName + "]", module);
}
}
-
- /* (non-Javadoc)
- * @see org.ofbiz.entity.Delegator#enableJMS()
- */
- public void enableJMS(boolean enable) {
- this.enableJMS = enable;
- }
-
- /* (non-Javadoc)
- * @see org.ofbiz.entity.Delegator#getEnableJMS()
- */
- public boolean getEnabledJMS() {
- return this.enableJMS;
- }
/* (non-Javadoc)
* @see org.ofbiz.entity.Delegator#getEnableJMS()
Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceDispatcher.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceDispatcher.java?rev=1174964&r1=1174963&r2=1174964&view=diff
==============================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceDispatcher.java (original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceDispatcher.java Fri Sep 23 19:22:40 2011
@@ -116,8 +116,8 @@ public class ServiceDispatcher {
}
// make sure we haven't disabled these features from running
- if (enableJMS && this.delegator.getEnabledJMS()) {
- this.jlf = new JmsListenerFactory(this);
+ if (enableJMS) {
+ this.jlf = JmsListenerFactory.getInstance(this);
}
if (enableSvcs) {
Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/jms/JmsListenerFactory.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/jms/JmsListenerFactory.java?rev=1174964&r1=1174963&r2=1174964&view=diff
==============================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/jms/JmsListenerFactory.java (original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/jms/JmsListenerFactory.java Fri Sep 23 19:22:40 2011
@@ -47,12 +47,27 @@ public class JmsListenerFactory implemen
protected static Map<String, GenericMessageListener> listeners = FastMap.newInstance();
protected static Map<String, Element> servers = FastMap.newInstance();
+ protected static JmsListenerFactory jlf = null;
+
protected ServiceDispatcher dispatcher;
protected boolean firstPass = true;
protected int loadable = 0;
protected int connected = 0;
protected Thread thread;
+
+ public static JmsListenerFactory getInstance(ServiceDispatcher dispatcher){
+ if (jlf == null) {
+ synchronized (JmsListenerFactory.class) {
+ if (jlf == null) {
+ jlf = new JmsListenerFactory(dispatcher);
+ }
+ }
+ }
+
+ return jlf;
+ }
+
public JmsListenerFactory(ServiceDispatcher dispatcher) {
this.dispatcher = dispatcher;
thread = new Thread(this, this.toString());