com.croftsoft.core.net.http.msg
Class HttpMessagePoller

java.lang.Object
  extended by com.croftsoft.core.net.http.msg.HttpMessagePoller
All Implemented Interfaces:
Commissionable, Destroyable, Initializable, Lifecycle, Resumable, Startable, Stoppable

public final class HttpMessagePoller
extends Object
implements Lifecycle

Polls a server for messages and downloads them to a local queue.

Since:
2000-04-27
Version:
2003-06-12
Author:
David Wallace Croft

Field Summary
static double DEFAULT_POLLING_PERIOD_DIVI
           
static long DEFAULT_POLLING_PERIOD_INCR
           
static long DEFAULT_POLLING_PERIOD_INIT
           
static long DEFAULT_POLLING_PERIOD_MAX
           
static long DEFAULT_POLLING_PERIOD_MIN
           
static double DEFAULT_POLLING_PERIOD_MULT
           
static String THREAD_NAME
           
static int THREAD_PRIORITY
           
static boolean USE_DAEMON_THREAD
           
 
Constructor Summary
HttpMessagePoller(URL url, String userAgent, String contentType, byte[] requestBytes, Parser contentParser, Queue incomingQueue)
          Convenience constructor using default polling period values.
HttpMessagePoller(URL url, String userAgent, String contentType, byte[] requestBytes, Parser parser, Queue incomingQueue, long pollingPeriodMin, long pollingPeriodMax, long pollingPeriodInit, double pollingPeriodMult, double pollingPeriodDivi, long pollingPeriodIncr)
          All polling period values are in milliseconds.
 
Method Summary
 void destroy()
           
 void init()
           
 long setPollingPeriod(long pollingPeriod)
           
 void setRequestBytes(byte[] requestBytes)
           
 void start()
           
 void stop()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_POLLING_PERIOD_MIN

public static final long DEFAULT_POLLING_PERIOD_MIN
See Also:
Constant Field Values

DEFAULT_POLLING_PERIOD_MAX

public static final long DEFAULT_POLLING_PERIOD_MAX
See Also:
Constant Field Values

DEFAULT_POLLING_PERIOD_INIT

public static final long DEFAULT_POLLING_PERIOD_INIT
See Also:
Constant Field Values

DEFAULT_POLLING_PERIOD_MULT

public static final double DEFAULT_POLLING_PERIOD_MULT
See Also:
Constant Field Values

DEFAULT_POLLING_PERIOD_DIVI

public static final double DEFAULT_POLLING_PERIOD_DIVI
See Also:
Constant Field Values

DEFAULT_POLLING_PERIOD_INCR

public static final long DEFAULT_POLLING_PERIOD_INCR
See Also:
Constant Field Values

THREAD_NAME

public static final String THREAD_NAME
See Also:
Constant Field Values

THREAD_PRIORITY

public static final int THREAD_PRIORITY
See Also:
Constant Field Values

USE_DAEMON_THREAD

public static final boolean USE_DAEMON_THREAD
See Also:
Constant Field Values
Constructor Detail

HttpMessagePoller

public HttpMessagePoller(URL url,
                         String userAgent,
                         String contentType,
                         byte[] requestBytes,
                         Parser parser,
                         Queue incomingQueue,
                         long pollingPeriodMin,
                         long pollingPeriodMax,
                         long pollingPeriodInit,
                         double pollingPeriodMult,
                         double pollingPeriodDivi,
                         long pollingPeriodIncr)
All polling period values are in milliseconds.

Parameters:
pollingPeriodIncr - Minimum incremental change whenever the polling period is increased or decreased, regardless of the pollingPeriodMult or pollingPeriodDivi value.

HttpMessagePoller

public HttpMessagePoller(URL url,
                         String userAgent,
                         String contentType,
                         byte[] requestBytes,
                         Parser contentParser,
                         Queue incomingQueue)
Convenience constructor using default polling period values.

Method Detail

setRequestBytes

public void setRequestBytes(byte[] requestBytes)

setPollingPeriod

public long setPollingPeriod(long pollingPeriod)

init

public void init()
Specified by:
init in interface Initializable

start

public void start()
Specified by:
start in interface Startable

stop

public void stop()
Specified by:
stop in interface Stoppable

destroy

public void destroy()
Specified by:
destroy in interface Destroyable

CroftSoft Javadoc

CroftSoft Core Javadoc (2008-09-28 20:58:02)