Package org.cip4.jdflib.util.net
Class NetPoll
- java.lang.Object
-
- org.cip4.jdflib.util.net.NetPoll
-
public class NetPoll extends java.lang.Objectclass to poll a network address
-
-
Field Summary
Fields Modifier and Type Field Description protected intbusyWaitprotected java.lang.StringcontentTypeprotected intidleWaitprotected java.lang.Stringmethodprotected MyMutexmutexprotected IPollHandlerpollerprotected org.cip4.jdflib.util.net.NetPoll.PollThreadpollThread
-
Constructor Summary
Constructors Constructor Description NetPoll(java.lang.String url, IPollHandler poller)shorthand constructor for single StringNetPoll(VString urls, IPollHandler poller)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddURL(java.lang.String url)protected voidfinalize()make sur we stop all threads prior to dyingprotected intgetIdleWait()get the idle wait period divided by the # of urls to pingprotected java.lang.StringgetUrl(java.lang.String baseUrl)get the URL based on a baseurlVStringgetUrls()get the vector of urlsprotected intgetUrlSize()booleanisRunning()return true if we are runningprotected IPollDetailspoll(java.lang.String baseUrl)voidsetBusyWait(int busyWait)voidsetContentType(java.lang.String contentType)voidsetIdleWait(int idleWait)voidsetMethod(java.lang.String method)voidstart()start the poll loopvoidstop()stop the poll loopjava.lang.StringtoString()
-
-
-
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 java.lang.String method
-
contentType
protected java.lang.String contentType
-
-
Constructor Detail
-
NetPoll
public NetPoll(VString urls, IPollHandler poller)
- Parameters:
urls- the urls to poll - duh!poller-
-
NetPoll
public NetPoll(java.lang.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(java.lang.String baseUrl)
- Parameters:
baseUrl- the url to write to- Returns:
- the details, null if no connection could be made
-
setMethod
public void setMethod(java.lang.String method)
- Parameters:
method- the http transfer method to set (GET / POST)
-
addURL
public void addURL(java.lang.String url)
- Parameters:
url- the additional url to add
-
setContentType
public void setContentType(java.lang.String contentType)
- Parameters:
contentType- the contentType to set
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.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 java.lang.String getUrl(java.lang.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 java.lang.Throwablemake sur we stop all threads prior to dying- Overrides:
finalizein classjava.lang.Object- Throws:
java.lang.Throwable- See Also:
Object.finalize()
-
getIdleWait
protected int getIdleWait()
get the idle wait period divided by the # of urls to ping- Returns:
-
-