Author: mlovett
Date: Thu Jan 25 08:34:45 2007
New Revision: 499838

URL: http://svn.apache.org/viewvc?view=rev&rev=499838
Log:
Stop threads from ending too soon, add in trace, and delete some dead code

Modified:
    webservices/sandesha/trunk/java/src/org/apache/sandesha2/SandeshaModule.java
    
webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/inmemory/InMemorySenderBeanMgr.java
    
webservices/sandesha/trunk/java/src/org/apache/sandesha2/workers/SandeshaThread.java

Modified: 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/SandeshaModule.java
URL: 
http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/SandeshaModule.java?view=diff&rev=499838&r1=499837&r2=499838
==============================================================================
--- 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/SandeshaModule.java 
(original)
+++ 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/SandeshaModule.java 
Thu Jan 25 08:34:45 2007
@@ -53,8 +53,9 @@
        // initialize the module
        public void init(ConfigurationContext configContext,
                        AxisModule module) throws AxisFault {
+               if(log.isDebugEnabled()) log.debug("Entry: 
SandeshaModule::init, " + configContext);
 
-               //storing the Sadesha module as a property.
+               //storing the Sandesha module as a property.
                
configContext.setProperty(Sandesha2Constants.MODULE_CLASS_LOADER,module.getModuleClassLoader());
 
                //init the i18n messages
@@ -127,9 +128,12 @@
                                        }
                                }
                );
+
+               if(log.isDebugEnabled()) log.debug("Exit: 
SandeshaModule::init");
        }
 
        public void engageNotify(AxisDescription axisDescription) throws 
AxisFault {
+               if(log.isDebugEnabled()) log.debug("Entry: 
SandeshaModule::engageNotify, " + axisDescription);
                
                SandeshaPolicyBean parentPropertyBean = 
SandeshaUtil.getPropertyBean(axisDescription);
                if (parentPropertyBean==null) 
@@ -144,6 +148,8 @@
                        parameter.setValue(axisDescPropertyBean);
                        axisDescription.addParameter(parameter);
                }
+
+               if(log.isDebugEnabled()) log.debug("Exit: 
SandeshaModule::engageNotify");
        }
 
        public PolicyExtension getPolicyExtension() {
@@ -151,9 +157,11 @@
        }
 
        public void shutdown(ConfigurationContext configurationContext) throws 
AxisFault {
+               if(log.isDebugEnabled()) log.debug("Entry: 
SandeshaModule::shutdown, " + configurationContext);
                SandeshaUtil.
                        getSandeshaStorageManager(configurationContext, 
configurationContext.getAxisConfiguration())
                                .shutdown();
+               if(log.isDebugEnabled()) log.debug("Exit: 
SandeshaModule::shutdown");
        }
 
     public void applyPolicy(Policy policy, AxisDescription axisDescription) 
throws AxisFault {

Modified: 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/inmemory/InMemorySenderBeanMgr.java
URL: 
http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/inmemory/InMemorySenderBeanMgr.java?view=diff&rev=499838&r1=499837&r2=499838
==============================================================================
--- 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/inmemory/InMemorySenderBeanMgr.java
 (original)
+++ 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/inmemory/InMemorySenderBeanMgr.java
 Thu Jan 25 08:34:45 2007
@@ -63,74 +63,6 @@
                return super.find(temp);
        }
        
-       protected boolean match(RMBean matchInfo, RMBean candidate, boolean 
ignoreBooleans) {
-               if(log.isDebugEnabled()) log.debug("Entry: 
InMemorySenderBeanMgr::match");
-               SenderBean bean = (SenderBean)matchInfo;
-               SenderBean temp = (SenderBean) candidate;
-               
-               boolean add = true;
-
-               if (bean.getMessageContextRefKey() != null && 
!bean.getMessageContextRefKey().equals(temp.getMessageContextRefKey())) {
-                       log.debug("MessageContextRefKey didn't match");
-                       add = false;
-               }
-               // Time is a bit special - we match all the beans that should 
be sent
-               // before the moment in time that the match criteria give us.
-               if (bean.getTimeToSend() > 0
-                               && bean.getTimeToSend() < temp.getTimeToSend()) 
{
-                       log.debug("MessageContextRefKey didn't match");
-                       add = false;
-               }
-               
-               if (bean.getMessageID() != null
-                               && 
!bean.getMessageID().equals(temp.getMessageID())) {
-                       log.debug("MessageID didn't match");
-                       add = false;
-               }
-               
-               if (bean.getInternalSequenceID() != null
-                               && !bean.getInternalSequenceID().equals("")
-                               && !bean.getInternalSequenceID().equals(
-                                               temp.getInternalSequenceID())) {
-                       log.debug("InternalSequenceID didn't match");
-                       add = false;
-               }
-               
-               if (bean.getMessageNumber() > 0
-                               && bean.getMessageNumber() != 
temp.getMessageNumber()) {
-                       log.debug("MessageNumber didn't match");
-                       add = false;
-               }
-               
-               if (bean.getMessageType() != 
Sandesha2Constants.MessageTypes.UNKNOWN
-                               && bean.getMessageType() != 
temp.getMessageType()) {
-                       log.debug("MessageType didn't match");
-                       add = false;
-               }
-
-               if (!ignoreBooleans && bean.isSend() != temp.isSend()) {
-                       log.debug("isSend didn't match");
-                       add = false;
-               }
-               
-               if (bean.getToAddress() != null
-                               && !bean.getToAddress().equals("")
-                               && 
!bean.getToAddress().equals(temp.getToAddress())) {
-                       log.debug("ToAddress didn't match");
-                       add = false;
-               }
-
-               // Do not use the isReSend flag to match messages, as it can 
stop us from
-               // detecting RM messages during 'getNextMsgToSend'
-               //if (bean.isReSend() != temp.isReSend()) {
-               //      log.debug("isReSend didn't match");
-               //      add = false;
-               //}
-
-               if(log.isDebugEnabled()) log.debug("Exit: 
InMemorySenderBeanMgr::match, " + add);
-               return add;
-       }
-
        public List find(SenderBean bean) throws SandeshaStorageException {
                return super.find(bean);
        }

Modified: 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/workers/SandeshaThread.java
URL: 
http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/workers/SandeshaThread.java?view=diff&rev=499838&r1=499837&r2=499838
==============================================================================
--- 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/workers/SandeshaThread.java
 (original)
+++ 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/workers/SandeshaThread.java
 Thu Jan 25 08:34:45 2007
@@ -59,9 +59,11 @@
                if (log.isDebugEnabled())
                        log.debug("Enter: 
SandeshaThread::stopThreadForSequence, " + sequenceID);
                
+               // We do not actually stop the thread here, as the workers are 
smart enough
+               // to sleep when there is no work to do. If we were to exit the 
thread then
+               // we wouldn't be able to start back up when the thread gets 
some more work
+               // to do.
                workingSequences.remove(sequenceID);
-               if (workingSequences.size() == 0) 
-                       runThread = false;              
                
                if (log.isDebugEnabled())
                        log.debug("Exit: 
SandeshaThread::stopThreadForSequence");               
@@ -106,7 +108,7 @@
        
        public synchronized void stopRunning() {
                if (log.isDebugEnabled())
-                       log.debug("Enter: SandeshaThread::stopRunning");
+                       log.debug("Enter: SandeshaThread::stopRunning, " + 
this);
 
                //NOTE: we do not take acount of pausing when stopping.
                //The call to stop will wait until the invoker has exited the 
loop
@@ -124,7 +126,7 @@
                }
                
                if (log.isDebugEnabled())
-                       log.debug("Exit: SandeshaThread::stopRunning");
+                       log.debug("Exit: SandeshaThread::stopRunning, " + this);
        }
        
        public synchronized boolean isThreadStarted() {
@@ -137,19 +139,29 @@
        
 
        public synchronized void runThreadForSequence(ConfigurationContext 
context, String sequenceID){
-               if (!workingSequences.contains(sequenceID))
-                       workingSequences.add(sequenceID);
+               if(log.isDebugEnabled()) log.debug("Entry: 
SandeshaThread::runThreadForSequence, " + this);
+
+               if (!workingSequences.contains(sequenceID))     
workingSequences.add(sequenceID);
+               
                if (!isThreadStarted()) {
+                       if(log.isDebugEnabled()) log.debug("Starting thread");
+
                        this.context = context;
                        // Get the axis2 thread pool
                        threadPool = context.getThreadPool();
                        
                        runThread = true; // so that isStarted()=true.
+                       
                        super.start();
                        
                        // Set the SandeshaThread to have the same context 
classloader as the application
                        
this.setContextClassLoader(Thread.currentThread().getContextClassLoader());
-               }               
+               } else {
+                       if(log.isDebugEnabled()) log.debug("Waking thread");
+                       wakeThread();
+               }
+
+               if(log.isDebugEnabled()) log.debug("Exit: 
SandeshaThread::runThreadForSequence");
        }
        
        public synchronized ArrayList getSequences() {
@@ -222,6 +234,7 @@
                        // flag that we have exited the run loop and notify any 
waiting
                        // threads
                        synchronized (this) {
+                               if(log.isDebugEnabled()) 
log.debug("SandeshaThread really stopping " + this);
                                hasStoppedRunning = true;
                                notify();
                        }



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to