Package org.cip4.jdflib.util.net
Class NetPoll
java.lang.Object
org.cip4.jdflib.util.net.NetPoll
class to poll a network address
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intprotected Stringprotected intprotected Stringprotected MyMutexprotected IPollHandlerprotected org.cip4.jdflib.util.net.NetPoll.PollThread -
Constructor Summary
ConstructorsConstructorDescriptionNetPoll(String url, IPollHandler poller) shorthand constructor for single StringNetPoll(VString urls, IPollHandler poller) -
Method Summary
Modifier and TypeMethodDescriptionvoidprotected voidfinalize()make sur we stop all threads prior to dyingprotected intget the idle wait period divided by the # of urls to pingprotected Stringget the URL based on a baseurlgetUrls()get the vector of urlsprotected intbooleanreturn true if we are runningprotected IPollDetailsvoidsetBusyWait(int busyWait) voidsetContentType(String contentType) voidsetIdleWait(int idleWait) voidvoidstart()start the poll loopvoidstop()stop the poll looptoString()
-
Field Details
-
idleWait
protected int idleWait -
busyWait
protected int busyWait -
pollThread
protected org.cip4.jdflib.util.net.NetPoll.PollThread pollThread -
poller
-
mutex
-
method
-
contentType
-
-
Constructor Details
-
NetPoll
- Parameters:
urls- the urls to poll - duh!poller-
-
NetPoll
shorthand constructor for single String- Parameters:
url- the url to poll - duh!poller-
-
-
Method Details
-
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
- Parameters:
baseUrl- the url to write to- Returns:
- the details, null if no connection could be made
-
setMethod
- Parameters:
method- the http transfer method to set (GET / POST)
-
addURL
- Parameters:
url- the additional url to add
-
setContentType
- Parameters:
contentType- the contentType to set
-
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
get the URL based on a baseurl- Parameters:
baseUrl-- Returns:
-
getUrls
get the vector of urls- Returns:
-
finalize
make sur we stop all threads prior to dying -
getIdleWait
protected int getIdleWait()get the idle wait period divided by the # of urls to ping- Returns:
-