You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@synapse.apache.org by ve...@apache.org on 2008/08/11 23:31:26 UTC
svn commit: r684942 -
/synapse/trunk/java/modules/transports/src/main/java/org/apache/synapse/transport/base/AbstractPollingTransportListener.java
Author: veithen
Date: Mon Aug 11 14:31:25 2008
New Revision: 684942
URL: http://svn.apache.org/viewvc?rev=684942&view=rev
Log:
SYNAPSE-425: Modified AbstractPollingTransportListener to properly manage the lifecycle of the Timer and changed the configuration of the timer from daemon to non daemon.
Modified:
synapse/trunk/java/modules/transports/src/main/java/org/apache/synapse/transport/base/AbstractPollingTransportListener.java
Modified: synapse/trunk/java/modules/transports/src/main/java/org/apache/synapse/transport/base/AbstractPollingTransportListener.java
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/transports/src/main/java/org/apache/synapse/transport/base/AbstractPollingTransportListener.java?rev=684942&r1=684941&r2=684942&view=diff
==============================================================================
--- synapse/trunk/java/modules/transports/src/main/java/org/apache/synapse/transport/base/AbstractPollingTransportListener.java (original)
+++ synapse/trunk/java/modules/transports/src/main/java/org/apache/synapse/transport/base/AbstractPollingTransportListener.java Mon Aug 11 14:31:25 2008
@@ -18,8 +18,10 @@
*/
package org.apache.synapse.transport.base;
+import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.description.AxisService;
import org.apache.axis2.description.Parameter;
+import org.apache.axis2.description.TransportInDescription;
import org.apache.axis2.AxisFault;
import java.util.TimerTask;
@@ -36,8 +38,8 @@
/** default interval in ms before polls */
protected int pollInterval = DEFAULT_POLL_INTERVAL;
- /** The main timer that runs as a daemon thread */
- protected final Timer timer = new Timer("PollTimer", true);
+ /** The main timer. */
+ protected Timer timer;
/** is a poll already executing? */
protected boolean pollInProgress = false;
/** a lock to prevent concurrent execution of polling */
@@ -45,6 +47,21 @@
/** a map that keeps track of services to the timer tasks created for them */
protected Map serviceToTimerTaskMap = new HashMap();
+ @Override
+ public void init(ConfigurationContext cfgCtx,
+ TransportInDescription transportIn) throws AxisFault {
+
+ timer = new Timer("PollTimer");
+ super.init(cfgCtx, transportIn);
+ }
+
+ @Override
+ public void destroy() {
+ super.destroy();
+ timer.cancel();
+ timer = null;
+ }
+
/**
* Schedule a repeated poll at the specified interval for the given service
* @param service the service to be polled