You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@synapse.apache.org by as...@apache.org on 2008/05/27 13:57:15 UTC

svn commit: r660478 - in /synapse/branches/1.2/modules: core/src/main/java/org/apache/synapse/core/axis2/ transports/src/main/java/org/apache/synapse/transport/mail/ transports/src/main/java/org/apache/synapse/transport/vfs/

Author: asankha
Date: Tue May 27 04:57:13 2008
New Revision: 660478

URL: http://svn.apache.org/viewvc?rev=660478&view=rev
Log:
fix SYNAPSE-332

Modified:
    synapse/branches/1.2/modules/core/src/main/java/org/apache/synapse/core/axis2/ProxyService.java
    synapse/branches/1.2/modules/transports/src/main/java/org/apache/synapse/transport/mail/MailTransportListener.java
    synapse/branches/1.2/modules/transports/src/main/java/org/apache/synapse/transport/vfs/VFSTransportListener.java

Modified: synapse/branches/1.2/modules/core/src/main/java/org/apache/synapse/core/axis2/ProxyService.java
URL: http://svn.apache.org/viewvc/synapse/branches/1.2/modules/core/src/main/java/org/apache/synapse/core/axis2/ProxyService.java?rev=660478&r1=660477&r2=660478&view=diff
==============================================================================
--- synapse/branches/1.2/modules/core/src/main/java/org/apache/synapse/core/axis2/ProxyService.java (original)
+++ synapse/branches/1.2/modules/core/src/main/java/org/apache/synapse/core/axis2/ProxyService.java Tue May 27 04:57:13 2008
@@ -25,6 +25,7 @@
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.description.*;
 import org.apache.axis2.engine.AxisConfiguration;
+import org.apache.axis2.engine.AxisEvent;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.neethi.Policy;
@@ -553,8 +554,10 @@
                 auditWarn("Unable to find the SynapseEnvironment. " +
                     "Components of the proxy service may not be initialized");
             }
-            
-            axisConfig.getServiceForActivation(this.getName()).setActive(true);
+
+            AxisService as = axisConfig.getServiceForActivation(this.getName());
+            as.setActive(true);
+            axisConfig.notifyObservers(AxisEvent.SERVICE_START, as);
             this.setRunning(true);
             auditInfo("Started the proxy service : " + name);
         } else {
@@ -585,9 +588,10 @@
                 AxisService as = axisConfig.getService(this.getName());
                 if (as != null) {
                     as.setActive(false);
+                    axisConfig.notifyObservers(AxisEvent.SERVICE_STOP, as);
                 }
                 this.setRunning(false);
-                auditInfo("Started the proxy service : " + name);
+                auditInfo("Stopped the proxy service : " + name);
             } catch (AxisFault axisFault) {
                 handleException("Error stopping the proxy service : " + name, axisFault);
             }

Modified: synapse/branches/1.2/modules/transports/src/main/java/org/apache/synapse/transport/mail/MailTransportListener.java
URL: http://svn.apache.org/viewvc/synapse/branches/1.2/modules/transports/src/main/java/org/apache/synapse/transport/mail/MailTransportListener.java?rev=660478&r1=660477&r2=660478&view=diff
==============================================================================
--- synapse/branches/1.2/modules/transports/src/main/java/org/apache/synapse/transport/mail/MailTransportListener.java (original)
+++ synapse/branches/1.2/modules/transports/src/main/java/org/apache/synapse/transport/mail/MailTransportListener.java Tue May 27 04:57:13 2008
@@ -57,8 +57,10 @@
     public static final String DELETE = "DELETE";
     public static final String MOVE = "MOVE";
 
-    /** Keep the list of directories/files and poll durations */
+    /** Keep the list of email accounts and poll durations */
     private final List<PollTableEntry> pollTable = new ArrayList<PollTableEntry>();
+    /** Keep the list of removed pollTable entries */
+    private final List<PollTableEntry> removeTable = new ArrayList<PollTableEntry>();
 
     /**
      * Initializes the Mail transport
@@ -78,6 +80,10 @@
      * it is time to scan the contents for new files
      */
     public void onPoll() {
+        if (!removeTable.isEmpty()) {
+            pollTable.removeAll(removeTable);
+        }
+
         for (PollTableEntry entry : pollTable) {
             long startTime = System.currentTimeMillis();
             if (startTime > entry.getNextPollTime()) {
@@ -578,7 +584,7 @@
         for (PollTableEntry entry : pollTable) {
             if (service.getName().equals(entry.getServiceName())) {
                 cancelPoll(service);
-                pollTable.remove(entry);
+                removeTable.add(entry);
             }
         }
     }

Modified: synapse/branches/1.2/modules/transports/src/main/java/org/apache/synapse/transport/vfs/VFSTransportListener.java
URL: http://svn.apache.org/viewvc/synapse/branches/1.2/modules/transports/src/main/java/org/apache/synapse/transport/vfs/VFSTransportListener.java?rev=660478&r1=660477&r2=660478&view=diff
==============================================================================
--- synapse/branches/1.2/modules/transports/src/main/java/org/apache/synapse/transport/vfs/VFSTransportListener.java (original)
+++ synapse/branches/1.2/modules/transports/src/main/java/org/apache/synapse/transport/vfs/VFSTransportListener.java Tue May 27 04:57:13 2008
@@ -105,6 +105,8 @@
 
     /** Keep the list of directories/files and poll durations */
     private final List<PollTableEntry> pollTable = new ArrayList<PollTableEntry>();
+    /** Keep the list of removed pollTable entries */
+    private final List<PollTableEntry> removeTable = new ArrayList<PollTableEntry>();
     /** The VFS file system manager */
     private FileSystemManager fsManager = null;
 
@@ -133,6 +135,10 @@
      * it is time to scan the contents for new files
      */
     public void onPoll() {
+        if (!removeTable.isEmpty()) {
+            pollTable.removeAll(removeTable);
+        }
+        
         for (PollTableEntry entry : pollTable) {
             long startTime = System.currentTimeMillis();
             if (startTime > entry.getNextPollTime()) {
@@ -583,7 +589,7 @@
             PollTableEntry entry = (PollTableEntry) iter.next();
             if (service.getName().equals(entry.getServiceName())) {
                 cancelPoll(service);
-                pollTable.remove(entry);
+                removeTable.add(entry);
             }
         }
     }