private class AbstractLookupDiscovery.Requestor extends Thread
An instance of this thread is run at startup, and each time the set of groups to discover is changed.
Thread.State, Thread.UncaughtExceptionHandler
Modifier and Type | Field and Description |
---|---|
private boolean |
delayFlag |
private String[] |
groups
Groups to request
|
private int |
responsePort
Unicast response port
|
private MulticastSocket |
sock
Multicast socket for sending packets
|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
Constructor and Description |
---|
Requestor(String[] groups,
int port,
boolean delayFlag) |
Modifier and Type | Method and Description |
---|---|
void |
run()
This method sends out N (for small N) multicast requests.
|
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
private final MulticastSocket sock
private final int responsePort
private final String[] groups
private final boolean delayFlag
public Requestor(String[] groups, int port, boolean delayFlag) throws IOException
IOException
public void run()
After all requests have been sent, and the ResponseListener has been given the appropriate time to receive and process any multicast responses, if there are no more active instances of this thread, this method terminates (interrupts) the ResponseListener. Note that although it is more desirable to have the ResponseListener set a timeout on the server socket (using setSoTimeout) and then simply exit after a period of time in which both the ResponseListener has been idle, and there have been no active Requestor threads, using setSoTimeout in this way can cause random hangs on the Solaris(TM) operating system.
Copyright 2007-2013, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.