org.apache.synapse.transport.base
Class AbstractPollingTransportListener

java.lang.Object
  extended by org.apache.synapse.transport.base.AbstractTransportListener
      extended by org.apache.synapse.transport.base.AbstractPollingTransportListener
All Implemented Interfaces:
TransportListener
Direct Known Subclasses:
MailTransportListener, VFSTransportListener

public abstract class AbstractPollingTransportListener
extends AbstractTransportListener


Field Summary
static int DEFAULT_POLL_INTERVAL
          the default poll interval
protected  boolean pollInProgress
          is a poll already executing?
protected  int pollInterval
          default interval in ms before polls
protected  Object pollLock
          a lock to prevent concurrent execution of polling
protected  Map serviceToTimerTaskMap
          a map that keeps track of services to the timer tasks created for them
protected  Timer timer
          The main timer that runs as a daemon thread
static String TRANSPORT_POLL_INTERVAL
          the parameter in the services.xml that specifies the poll interval for a service
 
Fields inherited from class org.apache.synapse.transport.base.AbstractTransportListener
cfgCtx, engine, isNonBlocking, log, metrics, state, transportName, useAxis2ThreadPool, workerPool
 
Fields inherited from interface org.apache.axis2.transport.TransportListener
HOST_ADDRESS, PARAM_PORT
 
Constructor Summary
AbstractPollingTransportListener()
           
 
Method Summary
 void cancelPoll(AxisService service)
          Cancel any pending timer tasks for the given service
 int getPollInterval()
           
 void maintenenceShutdown(long millis)
          Stop processing new messages, and wait the specified maximum time for in-flight requests to complete before a controlled shutdown for maintenence
 void onPoll()
           
 void pause()
          Pause the listener - Stop accepting/processing new messages, but continues processing existing messages until they complete.
 void resume()
          Resume the lister - Brings the lister into active mode back from a paused state
 void schedulePoll(AxisService service, long pollInterval)
          Schedule a repeated poll at the specified interval for the given service
 void setPollInterval(int pollInterval)
           
protected  void startListeningForService(AxisService service)
           
protected  void stopListeningForService(AxisService service)
           
 
Methods inherited from class org.apache.synapse.transport.base.AbstractTransportListener
createMessageContext, destroy, disableTransportForService, getActiveThreadCount, getBytesReceived, getBytesSent, getEPRForService, getFaultsReceiving, getFaultsSending, getMessagesReceived, getMessagesSent, getMetricsCollector, getQueueSize, getSessionContext, getTransportName, handleException, handleIncomingMessage, init, logException, setTransportName, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.axis2.transport.TransportListener
getEPRsForService
 

Field Detail

TRANSPORT_POLL_INTERVAL

public static final String TRANSPORT_POLL_INTERVAL
the parameter in the services.xml that specifies the poll interval for a service

See Also:
Constant Field Values

DEFAULT_POLL_INTERVAL

public static final int DEFAULT_POLL_INTERVAL
the default poll interval

See Also:
Constant Field Values

pollInterval

protected int pollInterval
default interval in ms before polls


timer

protected final Timer timer
The main timer that runs as a daemon thread


pollInProgress

protected boolean pollInProgress
is a poll already executing?


pollLock

protected final Object pollLock
a lock to prevent concurrent execution of polling


serviceToTimerTaskMap

protected Map serviceToTimerTaskMap
a map that keeps track of services to the timer tasks created for them

Constructor Detail

AbstractPollingTransportListener

public AbstractPollingTransportListener()
Method Detail

schedulePoll

public void schedulePoll(AxisService service,
                         long pollInterval)
Schedule a repeated poll at the specified interval for the given service

Parameters:
service - the service to be polled
pollInterval - the interval between successive polls in seconds

cancelPoll

public void cancelPoll(AxisService service)
Cancel any pending timer tasks for the given service

Parameters:
service - the service for which the timer task should be cancelled

onPoll

public void onPoll()

startListeningForService

protected void startListeningForService(AxisService service)
Specified by:
startListeningForService in class AbstractTransportListener

stopListeningForService

protected void stopListeningForService(AxisService service)
Specified by:
stopListeningForService in class AbstractTransportListener

getPollInterval

public int getPollInterval()

setPollInterval

public void setPollInterval(int pollInterval)

pause

public void pause()
           throws AxisFault
Pause the listener - Stop accepting/processing new messages, but continues processing existing messages until they complete. This helps bring an instance into a maintenence mode

Overrides:
pause in class AbstractTransportListener
Throws:
AxisFault - on error

resume

public void resume()
            throws AxisFault
Resume the lister - Brings the lister into active mode back from a paused state

Overrides:
resume in class AbstractTransportListener
Throws:
AxisFault - on error

maintenenceShutdown

public void maintenenceShutdown(long millis)
                         throws AxisFault
Stop processing new messages, and wait the specified maximum time for in-flight requests to complete before a controlled shutdown for maintenence

Overrides:
maintenenceShutdown in class AbstractTransportListener
Parameters:
millis - a number of milliseconds to wait until pending requests are allowed to complete
Throws:
AxisFault - on error


Copyright © 2005-2008 Apache Software Foundation. All Rights Reserved.