org.cip4.jdflib.util.net
Class NetPoll

java.lang.Object
  extended by org.cip4.jdflib.util.net.NetPoll

public class NetPoll
extends Object

class to poll a network address

Author:
Rainer Prosi, Heidelberger Druckmaschinen *

Field Summary
protected  int busyWait
           
protected  String contentType
           
protected  int idleWait
           
protected  String method
           
protected  MyMutex mutex
           
protected  IPollHandler poller
           
protected  org.cip4.jdflib.util.net.NetPoll.PollThread pollThread
           
 
Constructor Summary
NetPoll(String url, IPollHandler poller)
          shorthand constructor for single String
NetPoll(VString urls, IPollHandler poller)
           
 
Method Summary
 void addURL(String url)
           
protected  void finalize()
          make sur we stop all threads prior to dying
protected  int getIdleWait()
          get the idle wait period divided by the # of urls to ping
protected  String getUrl(String baseUrl)
          get the URL based on a baseurl
 VString getUrls()
          get the vector of urls
protected  int getUrlSize()
           
 boolean isRunning()
          return true if we are running
protected  IPollDetails poll(String baseUrl)
           
 void setBusyWait(int busyWait)
           
 void setContentType(String contentType)
           
 void setIdleWait(int idleWait)
           
 void setMethod(String method)
           
 void start()
          start the poll loop
 void stop()
          stop the poll loop
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

idleWait

protected int idleWait

busyWait

protected int busyWait

pollThread

protected org.cip4.jdflib.util.net.NetPoll.PollThread pollThread

poller

protected IPollHandler poller

mutex

protected MyMutex mutex

method

protected String method

contentType

protected String contentType
Constructor Detail

NetPoll

public NetPoll(VString urls,
               IPollHandler poller)
Parameters:
urls - the urls to poll - duh!
poller -

NetPoll

public NetPoll(String url,
               IPollHandler poller)
shorthand constructor for single String

Parameters:
url - the url to poll - duh!
poller -
Method Detail

isRunning

public boolean isRunning()
return true if we are running

Returns:

start

public void start()
start the poll loop


stop

public void stop()
stop the poll loop


getUrlSize

protected int getUrlSize()

poll

protected IPollDetails poll(String baseUrl)
Parameters:
baseUrl - the url to write to
Returns:
the details, null if no connection could be made

setMethod

public void setMethod(String method)
Parameters:
method - the http transfer method to set (GET / POST)

addURL

public void addURL(String url)
Parameters:
url - the additional url to add

setContentType

public void setContentType(String contentType)
Parameters:
contentType - the contentType to set

toString

public String toString()
Overrides:
toString in class Object
Returns:
See Also:
Object.toString()

setIdleWait

public void setIdleWait(int idleWait)
Parameters:
idleWait - the number of wait milliseconds to set

setBusyWait

public void setBusyWait(int busyWait)
Parameters:
busyWait - the busyWait to set

getUrl

protected String getUrl(String baseUrl)
get the URL based on a baseurl

Parameters:
baseUrl -
Returns:

getUrls

public VString getUrls()
get the vector of urls

Returns:

finalize

protected void finalize()
                 throws Throwable
make sur we stop all threads prior to dying

Overrides:
finalize in class Object
Throws:
Throwable
See Also:
Object.finalize()

getIdleWait

protected int getIdleWait()
get the idle wait period divided by the # of urls to ping

Returns:


Copyright © 2013. All Rights Reserved.