Classes | |
enum | Operation |
class | ServiceCollector |
class | ServiceTypeEntry |
class | Shutdown |
Public Member Functions | |
DNSOutgoing | addAnswer (DNSIncoming in, InetAddress addr, int port, DNSOutgoing out, DNSRecord rec) throws IOException |
void | addListener (DNSListener listener, DNSQuestion question) |
void | addServiceListener (String type, ServiceListener listener) |
void | addServiceTypeListener (ServiceTypeListener listener) throws IOException |
boolean | advanceState (DNSTask task) |
void | associateWithTask (DNSTask task, DNSState state) |
boolean | cancelState () |
void | cancelStateTimer () |
void | cancelTimer () |
void | cleanCache () |
void | close () |
boolean | closeState () |
DNSCache | getCache () |
Delegate | getDelegate () |
JmDNSImpl | getDns () |
InetAddress | getGroup () |
String | getHostName () |
InetAddress | getInetAddress () throws IOException |
InetAddress | getInterface () throws IOException |
long | getLastThrottleIncrement () |
HostInfo | getLocalHost () |
String | getName () |
DNSIncoming | getPlannedAnswer () |
ServiceInfo | getServiceInfo (String type, String name) |
ServiceInfo | getServiceInfo (String type, String name, long timeout) |
ServiceInfo | getServiceInfo (String type, String name, boolean persistent) |
ServiceInfo | getServiceInfo (String type, String name, boolean persistent, long timeout) |
Map< String, ServiceInfo > | getServices () |
Map< String, ServiceTypeEntry > | getServiceTypes () |
MulticastSocket | getSocket () |
int | getThrottle () |
void | ioLock () |
void | ioUnlock () |
boolean | isAnnounced () |
boolean | isAnnouncing () |
boolean | isAssociatedWithTask (DNSTask task, DNSState state) |
boolean | isCanceled () |
boolean | isCanceling () |
boolean | isClosed () |
boolean | isClosing () |
boolean | isProbing () |
JmDNSImpl (InetAddress address, String name) throws IOException | |
ServiceInfo[] | list (String type) |
ServiceInfo[] | list (String type, long timeout) |
Map< String, ServiceInfo[]> | listBySubtype (String type) |
Map< String, ServiceInfo[]> | listBySubtype (String type, long timeout) |
void | printServices () |
void | purgeStateTimer () |
void | purgeTimer () |
void | recover () |
boolean | recoverState () |
void | registerService (ServiceInfo infoAbstract) throws IOException |
boolean | registerServiceType (String type) |
void | removeAssociationWithTask (DNSTask task) |
void | removeListener (DNSListener listener) |
void | removeServiceListener (String type, ServiceListener listener) |
void | removeServiceTypeListener (ServiceTypeListener listener) |
void | renewServiceCollector (DNSRecord record) |
void | requestServiceInfo (String type, String name) |
void | requestServiceInfo (String type, String name, boolean persistent) |
void | requestServiceInfo (String type, String name, long timeout) |
void | requestServiceInfo (String type, String name, boolean persistent, long timeout) |
void | respondToQuery (DNSIncoming in) |
boolean | revertState () |
void | send (DNSOutgoing out) throws IOException |
Delegate | setDelegate (Delegate delegate) |
void | setLastThrottleIncrement (long lastThrottleIncrement) |
void | setPlannedAnswer (DNSIncoming plannedAnswer) |
void | setThrottle (int throttle) |
void | startAnnouncer () |
void | startCanceler () |
void | startProber () |
void | startReaper () |
void | startRenewer () |
void | startResponder (DNSIncoming in, int port) |
void | startServiceInfoResolver (ServiceInfoImpl info) |
void | startServiceResolver (String type) |
void | startTypeResolver () |
String | toString () |
void | unregisterAllServices () |
void | unregisterService (ServiceInfo infoAbstract) |
void | updateRecord (long now, DNSRecord rec, Operation operation) |
boolean | waitForAnnounced (long timeout) |
boolean | waitForCanceled (long timeout) |
Static Public Member Functions | |
static Random | getRandom () |
static void | main (String[] argv) |
Protected Attributes | |
Thread | _shutdown |
Package Functions | |
void | __recover () |
ServiceInfoImpl | getServiceInfoFromCache (String type, String name, String subtype, boolean persistent) |
void | handleQuery (DNSIncoming in, InetAddress addr, int port) throws IOException |
void | handleRecord (DNSRecord record, long now) |
void | handleResponse (DNSIncoming msg) throws IOException |
void | handleServiceResolved (ServiceEvent event) |
String | incrementName (String name) |
ServiceInfoImpl | resolveServiceInfo (String type, String name, String subtype, boolean persistent) |
void | setLocalHost (HostInfo localHost) |
Static Package Functions | |
static String | toUnqualifiedName (String type, String qualifiedName) |
Private Member Functions | |
void | addServiceListener (String type, ServiceListener listener, boolean synch) |
void | closeMulticastSocket () |
void | disposeServiceCollectors () |
boolean | makeServiceNameUnique (ServiceInfoImpl info) |
void | openMulticastSocket (HostInfo hostInfo) throws IOException |
void | start (Collection<?extends ServiceInfo > serviceInfos) |
void | waitForInfoData (ServiceInfo info, long timeout) |
Private Attributes | |
final DNSCache | _cache |
volatile Delegate | _delegate |
final ExecutorService | _executor = Executors.newSingleThreadExecutor() |
volatile InetAddress | _group |
Thread | _incomingListener |
final ReentrantLock | _ioLock = new ReentrantLock() |
long | _lastThrottleIncrement |
final List< DNSListener > | _listeners |
HostInfo | _localHost |
final String | _name |
DNSIncoming | _plannedAnswer |
final Object | _recoverLock = new Object() |
final ConcurrentMap< String, ServiceCollector > | _serviceCollectors |
final ConcurrentMap< String, List< ServiceListenerStatus > > | _serviceListeners |
final ConcurrentMap< String, ServiceInfo > | _services |
final ConcurrentMap< String, ServiceTypeEntry > | _serviceTypes |
volatile MulticastSocket | _socket |
int | _throttle |
final Set < ServiceTypeListenerStatus > | _typeListeners |
Static Private Attributes | |
static final Random | _random = new Random() |
static Logger | logger = Logger.getLogger(JmDNSImpl.class.getName()) |
mDNS implementation in Java.
Definition at line 57 of file JmDNSImpl.java.
javax.jmdns.impl.JmDNSImpl.JmDNSImpl | ( | InetAddress | address, |
String | name | ||
) | throws IOException [inline] |
Create an instance of JmDNS and bind it to a specific network interface given its IP-address.
address | IP address to bind to. |
name | name of the newly created JmDNS |
IOException |
Definition at line 393 of file JmDNSImpl.java.
void javax.jmdns.impl.JmDNSImpl.__recover | ( | ) | [inline, package] |
Definition at line 1743 of file JmDNSImpl.java.
DNSOutgoing javax.jmdns.impl.JmDNSImpl.addAnswer | ( | DNSIncoming | in, |
InetAddress | addr, | ||
int | port, | ||
DNSOutgoing | out, | ||
DNSRecord | rec | ||
) | throws IOException [inline] |
Add an answer to a question. Deal with the case when the outgoing packet overflows
in | |
addr | |
port | |
out | |
rec |
IOException |
Definition at line 1529 of file JmDNSImpl.java.
void javax.jmdns.impl.JmDNSImpl.addListener | ( | DNSListener | listener, |
DNSQuestion | question | ||
) | [inline] |
Add a listener for a question. The listener will receive updates of answers to the question as they arrive, or from the cache if they are already available.
listener | DSN listener |
question | DNS query |
Definition at line 1221 of file JmDNSImpl.java.
void javax.jmdns.impl.JmDNSImpl.addServiceListener | ( | String | type, |
ServiceListener | listener | ||
) | [inline, virtual] |
Listen for services of a given type. The type has to be a fully qualified type name such as _http._tcp.local.
.
type | full qualified service type, such as _http._tcp.local. . |
listener | listener for service updates |
Implements javax.jmdns.JmDNS.
Definition at line 919 of file JmDNSImpl.java.
void javax.jmdns.impl.JmDNSImpl.addServiceListener | ( | String | type, |
ServiceListener | listener, | ||
boolean | synch | ||
) | [inline, private] |
Definition at line 923 of file JmDNSImpl.java.
void javax.jmdns.impl.JmDNSImpl.addServiceTypeListener | ( | ServiceTypeListener | listener | ) | throws IOException [inline, virtual] |
Listen for service types.
listener | listener for service types |
IOException | if there is an error in the underlying protocol, such as a TCP error. |
Implements javax.jmdns.JmDNS.
Definition at line 894 of file JmDNSImpl.java.
boolean javax.jmdns.impl.JmDNSImpl.advanceState | ( | DNSTask | task | ) | [inline] |
Sets the state and notifies all objects that wait on the ServiceInfo.
task | associated task |
true</code if the state was changed by this thread, false
otherwise.
DNSState::advance()
Implements javax.jmdns.impl.DNSStatefulObject.
Definition at line 516 of file JmDNSImpl.java.
void javax.jmdns.impl.JmDNSImpl.associateWithTask | ( | DNSTask | task, |
DNSState | state | ||
) | [inline] |
Sets the task associated with this Object.
task | associated task |
state | state of the task |
Implements javax.jmdns.impl.DNSStatefulObject.
Definition at line 564 of file JmDNSImpl.java.
boolean javax.jmdns.impl.JmDNSImpl.cancelState | ( | ) | [inline] |
Sets the state and notifies all objects that wait on the ServiceInfo.
true</code if the state was changed by this thread, false
otherwise.
Implements javax.jmdns.impl.DNSStatefulObject.
Definition at line 532 of file JmDNSImpl.java.
void javax.jmdns.impl.JmDNSImpl.cancelStateTimer | ( | ) | [inline] |
Cancel the state task timer
Implements javax.jmdns.impl.DNSTaskStarter.
Definition at line 1607 of file JmDNSImpl.java.
void javax.jmdns.impl.JmDNSImpl.cancelTimer | ( | ) | [inline] |
Cancel the generals task timer
Implements javax.jmdns.impl.DNSTaskStarter.
Definition at line 1598 of file JmDNSImpl.java.
void javax.jmdns.impl.JmDNSImpl.cleanCache | ( | ) | [inline] |
Definition at line 1802 of file JmDNSImpl.java.
void javax.jmdns.impl.JmDNSImpl.close | ( | ) | [inline] |
Definition at line 1825 of file JmDNSImpl.java.
void javax.jmdns.impl.JmDNSImpl.closeMulticastSocket | ( | ) | [inline, private] |
Definition at line 467 of file JmDNSImpl.java.
boolean javax.jmdns.impl.JmDNSImpl.closeState | ( | ) | [inline] |
Sets the state and notifies all objects that wait on the ServiceInfo.
true</code if the state was changed by this thread, false
otherwise.
Implements javax.jmdns.impl.DNSStatefulObject.
Definition at line 540 of file JmDNSImpl.java.
void javax.jmdns.impl.JmDNSImpl.disposeServiceCollectors | ( | ) | [inline, private] |
This method disposes all ServiceCollector instances which have been created by calls to method list(type)
.
Definition at line 2022 of file JmDNSImpl.java.
DNSCache javax.jmdns.impl.JmDNSImpl.getCache | ( | ) | [inline] |
Return the DNSCache associated with the cache variable
Definition at line 661 of file JmDNSImpl.java.
Delegate javax.jmdns.impl.JmDNSImpl.getDelegate | ( | ) | [inline, virtual] |
Returns the instance delegate
Implements javax.jmdns.JmDNS.
Definition at line 2251 of file JmDNSImpl.java.
JmDNSImpl javax.jmdns.impl.JmDNSImpl.getDns | ( | ) | [inline] |
Returns the DNS associated with this object.
Implements javax.jmdns.impl.DNSStatefulObject.
Definition at line 556 of file JmDNSImpl.java.
InetAddress javax.jmdns.impl.JmDNSImpl.getGroup | ( | ) | [inline] |
Definition at line 2246 of file JmDNSImpl.java.
String javax.jmdns.impl.JmDNSImpl.getHostName | ( | ) | [inline, virtual] |
Return the HostName associated with this JmDNS instance. Note: May not be the same as what started. The host name is subject to negotiation.
Implements javax.jmdns.JmDNS.
Definition at line 677 of file JmDNSImpl.java.
InetAddress javax.jmdns.impl.JmDNSImpl.getInetAddress | ( | ) | throws IOException [inline, virtual] |
Return the address of the interface to which this instance of JmDNS is bound.
IOException | if there is an error in the underlying protocol, such as a TCP error. |
Implements javax.jmdns.JmDNS.
Definition at line 694 of file JmDNSImpl.java.
InetAddress javax.jmdns.impl.JmDNSImpl.getInterface | ( | ) | throws IOException [inline, virtual] |
Return the address of the interface to which this instance of JmDNS is bound.
IOException | if there is an error in the underlying protocol, such as a TCP error. |
Implements javax.jmdns.JmDNS.
Definition at line 703 of file JmDNSImpl.java.
long javax.jmdns.impl.JmDNSImpl.getLastThrottleIncrement | ( | ) | [inline] |
Definition at line 2202 of file JmDNSImpl.java.
HostInfo javax.jmdns.impl.JmDNSImpl.getLocalHost | ( | ) | [inline] |
String javax.jmdns.impl.JmDNSImpl.getName | ( | ) | [inline, virtual] |
Return the name of the JmDNS instance. This is an arbitrary string that is useful for distinguishing instances.
Implements javax.jmdns.JmDNS.
Definition at line 669 of file JmDNSImpl.java.
DNSIncoming javax.jmdns.impl.JmDNSImpl.getPlannedAnswer | ( | ) | [inline] |
Definition at line 2230 of file JmDNSImpl.java.
static Random javax.jmdns.impl.JmDNSImpl.getRandom | ( | ) | [inline, static] |
Definition at line 2214 of file JmDNSImpl.java.
ServiceInfo javax.jmdns.impl.JmDNSImpl.getServiceInfo | ( | String | type, |
String | name | ||
) | [inline, virtual] |
Get service information. If the information is not cached, the method will block until updated information is received. Usage note: Do not call this method from the AWT event dispatcher thread. You will make the user interface unresponsive.
type | fully qualified service type, such as _http._tcp.local. . |
name | unqualified service name, such as foobar . |
Implements javax.jmdns.JmDNS.
Definition at line 711 of file JmDNSImpl.java.
ServiceInfo javax.jmdns.impl.JmDNSImpl.getServiceInfo | ( | String | type, |
String | name, | ||
long | timeout | ||
) | [inline, virtual] |
Get service information. If the information is not cached, the method will block for the given timeout until updated information is received. Usage note: If you call this method from the AWT event dispatcher thread, use a small timeout, or you will make the user interface unresponsive.
type | full qualified service type, such as _http._tcp.local. . |
name | unqualified service name, such as foobar . |
timeout | timeout in milliseconds. Typical timeout should be 5s. |
Implements javax.jmdns.JmDNS.
Definition at line 719 of file JmDNSImpl.java.
ServiceInfo javax.jmdns.impl.JmDNSImpl.getServiceInfo | ( | String | type, |
String | name, | ||
boolean | persistent | ||
) | [inline, virtual] |
Get service information. If the information is not cached, the method will block until updated information is received. Usage note: Do not call this method from the AWT event dispatcher thread. You will make the user interface unresponsive.
type | fully qualified service type, such as _http._tcp.local. . |
name | unqualified service name, such as foobar . |
persistent | if true ServiceListener.resolveService will be called whenever new new information is received. |
Implements javax.jmdns.JmDNS.
Definition at line 727 of file JmDNSImpl.java.
ServiceInfo javax.jmdns.impl.JmDNSImpl.getServiceInfo | ( | String | type, |
String | name, | ||
boolean | persistent, | ||
long | timeout | ||
) | [inline, virtual] |
Get service information. If the information is not cached, the method will block for the given timeout until updated information is received. Usage note: If you call this method from the AWT event dispatcher thread, use a small timeout, or you will make the user interface unresponsive.
type | full qualified service type, such as _http._tcp.local. . |
name | unqualified service name, such as foobar . |
timeout | timeout in milliseconds. Typical timeout should be 5s. |
persistent | if true ServiceListener.resolveService will be called whenever new new information is received. |
Implements javax.jmdns.JmDNS.
Definition at line 735 of file JmDNSImpl.java.
ServiceInfoImpl javax.jmdns.impl.JmDNSImpl.getServiceInfoFromCache | ( | String | type, |
String | name, | ||
String | subtype, | ||
boolean | persistent | ||
) | [inline, package] |
Definition at line 757 of file JmDNSImpl.java.
Map<String, ServiceInfo> javax.jmdns.impl.JmDNSImpl.getServices | ( | ) | [inline] |
Definition at line 2194 of file JmDNSImpl.java.
Map<String, ServiceTypeEntry> javax.jmdns.impl.JmDNSImpl.getServiceTypes | ( | ) | [inline] |
Definition at line 2238 of file JmDNSImpl.java.
MulticastSocket javax.jmdns.impl.JmDNSImpl.getSocket | ( | ) | [inline] |
Definition at line 2242 of file JmDNSImpl.java.
int javax.jmdns.impl.JmDNSImpl.getThrottle | ( | ) | [inline] |
Definition at line 2210 of file JmDNSImpl.java.
void javax.jmdns.impl.JmDNSImpl.handleQuery | ( | DNSIncoming | in, |
InetAddress | addr, | ||
int | port | ||
) | throws IOException [inline, package] |
Handle an incoming query. See if we can answer any part of it given our service infos.
in | |
addr | |
port |
IOException |
Definition at line 1469 of file JmDNSImpl.java.
void javax.jmdns.impl.JmDNSImpl.handleRecord | ( | DNSRecord | record, |
long | now | ||
) | [inline, package] |
Definition at line 1350 of file JmDNSImpl.java.
void javax.jmdns.impl.JmDNSImpl.handleResponse | ( | DNSIncoming | msg | ) | throws IOException [inline, package] |
Handle an incoming response. Cache answers, and pass them on to the appropriate questions.
IOException |
Definition at line 1437 of file JmDNSImpl.java.
void javax.jmdns.impl.JmDNSImpl.handleServiceResolved | ( | ServiceEvent | event | ) | [inline, package] |
Definition at line 868 of file JmDNSImpl.java.
String javax.jmdns.impl.JmDNSImpl.incrementName | ( | String | name | ) | [inline, package] |
Definition at line 1197 of file JmDNSImpl.java.
void javax.jmdns.impl.JmDNSImpl.ioLock | ( | ) | [inline] |
Definition at line 2218 of file JmDNSImpl.java.
void javax.jmdns.impl.JmDNSImpl.ioUnlock | ( | ) | [inline] |
Definition at line 2222 of file JmDNSImpl.java.
boolean javax.jmdns.impl.JmDNSImpl.isAnnounced | ( | ) | [inline] |
Returns true, if this is an announced state.
true
if announced state, false
otherwiseImplements javax.jmdns.impl.DNSStatefulObject.
Definition at line 604 of file JmDNSImpl.java.
boolean javax.jmdns.impl.JmDNSImpl.isAnnouncing | ( | ) | [inline] |
Returns true, if this is an announcing state.
true
if announcing state, false
otherwiseImplements javax.jmdns.impl.DNSStatefulObject.
Definition at line 596 of file JmDNSImpl.java.
boolean javax.jmdns.impl.JmDNSImpl.isAssociatedWithTask | ( | DNSTask | task, |
DNSState | state | ||
) | [inline] |
Checks if this object is associated with the task and in the same state.
task | associated task |
state | state of the task |
true
is the task is associated with this object, false
otherwise.Implements javax.jmdns.impl.DNSStatefulObject.
Definition at line 580 of file JmDNSImpl.java.
boolean javax.jmdns.impl.JmDNSImpl.isCanceled | ( | ) | [inline] |
Returns true, if this is a canceled state.
true
if canceled state, false
otherwiseImplements javax.jmdns.impl.DNSStatefulObject.
Definition at line 620 of file JmDNSImpl.java.
boolean javax.jmdns.impl.JmDNSImpl.isCanceling | ( | ) | [inline] |
Returns true, if this is a canceling state.
true
if canceling state, false
otherwiseImplements javax.jmdns.impl.DNSStatefulObject.
Definition at line 612 of file JmDNSImpl.java.
boolean javax.jmdns.impl.JmDNSImpl.isClosed | ( | ) | [inline] |
Returns true, if this is a closed state.
true
if closed state, false
otherwiseImplements javax.jmdns.impl.DNSStatefulObject.
Definition at line 636 of file JmDNSImpl.java.
boolean javax.jmdns.impl.JmDNSImpl.isClosing | ( | ) | [inline] |
Returns true, if this is a closing state.
true
if closing state, false
otherwiseImplements javax.jmdns.impl.DNSStatefulObject.
Definition at line 628 of file JmDNSImpl.java.
boolean javax.jmdns.impl.JmDNSImpl.isProbing | ( | ) | [inline] |
Returns true, if this is a probing state.
true
if probing state, false
otherwiseImplements javax.jmdns.impl.DNSStatefulObject.
Definition at line 588 of file JmDNSImpl.java.
ServiceInfo [] javax.jmdns.impl.JmDNSImpl.list | ( | String | type | ) | [inline, virtual] |
Returns a list of service infos of the specified type.
type | Service type name, such as _http._tcp.local. . |
Implements javax.jmdns.JmDNS.
Definition at line 1932 of file JmDNSImpl.java.
ServiceInfo [] javax.jmdns.impl.JmDNSImpl.list | ( | String | type, |
long | timeout | ||
) | [inline, virtual] |
Returns a list of service infos of the specified type.
type | Service type name, such as _http._tcp.local. . |
timeout | timeout in milliseconds. Typical timeout should be 6s. |
Implements javax.jmdns.JmDNS.
Definition at line 1940 of file JmDNSImpl.java.
Map<String, ServiceInfo[]> javax.jmdns.impl.JmDNSImpl.listBySubtype | ( | String | type | ) | [inline, virtual] |
Returns a list of service infos of the specified type sorted by subtype. Any service that do not register a subtype is listed in the empty subtype section.
type | Service type name, such as _http._tcp.local. . |
Implements javax.jmdns.JmDNS.
Definition at line 1989 of file JmDNSImpl.java.
Map<String, ServiceInfo[]> javax.jmdns.impl.JmDNSImpl.listBySubtype | ( | String | type, |
long | timeout | ||
) | [inline, virtual] |
Returns a list of service infos of the specified type sorted by subtype. Any service that do not register a subtype is listed in the empty subtype section.
type | Service type name, such as _http._tcp.local. . |
timeout | timeout in milliseconds. Typical timeout should be 6s. |
Implements javax.jmdns.JmDNS.
Definition at line 1997 of file JmDNSImpl.java.
static void javax.jmdns.impl.JmDNSImpl.main | ( | String[] | argv | ) | [inline, static] |
Main method to display API information if run from java -jar
argv | the command line arguments |
Definition at line 365 of file JmDNSImpl.java.
boolean javax.jmdns.impl.JmDNSImpl.makeServiceNameUnique | ( | ServiceInfoImpl | info | ) | [inline, private] |
Generate a possibly unique name for a service using the information we have in the cache.
Definition at line 1162 of file JmDNSImpl.java.
void javax.jmdns.impl.JmDNSImpl.openMulticastSocket | ( | HostInfo | hostInfo | ) | throws IOException [inline, private] |
Definition at line 442 of file JmDNSImpl.java.
void javax.jmdns.impl.JmDNSImpl.printServices | ( | ) | [inline, virtual] |
List Services and serviceTypes. Debugging Only
Implements javax.jmdns.JmDNS.
Definition at line 1878 of file JmDNSImpl.java.
void javax.jmdns.impl.JmDNSImpl.purgeStateTimer | ( | ) | [inline] |
Purge the state task timer
Implements javax.jmdns.impl.DNSTaskStarter.
Definition at line 1589 of file JmDNSImpl.java.
void javax.jmdns.impl.JmDNSImpl.purgeTimer | ( | ) | [inline] |
Purge the general task timer
Implements javax.jmdns.impl.DNSTaskStarter.
Definition at line 1580 of file JmDNSImpl.java.
void javax.jmdns.impl.JmDNSImpl.recover | ( | ) | [inline] |
Recover jmdns when there is an error.
Definition at line 1714 of file JmDNSImpl.java.
boolean javax.jmdns.impl.JmDNSImpl.recoverState | ( | ) | [inline] |
Sets the state and notifies all objects that wait on the ServiceInfo.
true</code if the state was changed by this thread, false
otherwise.
Implements javax.jmdns.impl.DNSStatefulObject.
Definition at line 548 of file JmDNSImpl.java.
void javax.jmdns.impl.JmDNSImpl.registerService | ( | ServiceInfo | infoAbstract | ) | throws IOException [inline, virtual] |
Register a service. The service is registered for access by other jmdns clients. The name of the service may be changed to make it unique.
Note that the given
ServiceInfo
is bound to this
JmDNS
instance, and should not be reused for any other registerService(ServiceInfo)}.
info | service info to register |
IOException | if there is an error in the underlying protocol, such as a TCP error. |
Implements javax.jmdns.JmDNS.
Definition at line 1007 of file JmDNSImpl.java.
boolean javax.jmdns.impl.JmDNSImpl.registerServiceType | ( | String | type | ) | [inline, virtual] |
Register a service type. If this service type was not already known, all service listeners will be notified of the new service type. Service types are automatically registered as they are discovered.
type | full qualified service type, such as _http._tcp.local. . |
true
if the type or subtype was added, false
if the type was already registered.Register a service type. If this service type was not already known, all service listeners will be notified of the new service type. Service types are automatically registered as they are discovered.
type | full qualified service type, such as _http._tcp.local. . |
true
if the type or subtype was added, false
if the type was already registered.Register a service type. If this service type was not already known, all service listeners will be notified of the new service type. Service types are automatically registered as they are discovered.
type | full qualified service type, such as _http._tcp.local. . |
true
if the type or subtype was added, false
if the type was already registered.Implements javax.jmdns.JmDNS.
Definition at line 1103 of file JmDNSImpl.java.
void javax.jmdns.impl.JmDNSImpl.removeAssociationWithTask | ( | DNSTask | task | ) | [inline] |
Remove the association of the task with this Object.
task | associated task |
Implements javax.jmdns.impl.DNSStatefulObject.
Definition at line 572 of file JmDNSImpl.java.
void javax.jmdns.impl.JmDNSImpl.removeListener | ( | DNSListener | listener | ) | [inline] |
Remove a listener from all outstanding questions. The listener will no longer receive any updates.
listener | DSN listener |
Definition at line 1244 of file JmDNSImpl.java.
void javax.jmdns.impl.JmDNSImpl.removeServiceListener | ( | String | type, |
ServiceListener | listener | ||
) | [inline, virtual] |
Remove listener for services of a given type.
type | full qualified service type, such as _http._tcp.local. . |
listener | listener for service updates |
Remove listener for services of a given type.
type | full qualified service type, such as _http._tcp.local. . |
listener | listener for service updates |
Implements javax.jmdns.JmDNS.
Definition at line 968 of file JmDNSImpl.java.
void javax.jmdns.impl.JmDNSImpl.removeServiceTypeListener | ( | ServiceTypeListener | listener | ) | [inline, virtual] |
Remove listener for service types.
listener | listener for service types |
Implements javax.jmdns.JmDNS.
Definition at line 910 of file JmDNSImpl.java.
void javax.jmdns.impl.JmDNSImpl.renewServiceCollector | ( | DNSRecord | record | ) | [inline] |
Renew a service when the record become stale. If there is no service collector for the type this method does nothing.
record | DNS record |
Definition at line 1254 of file JmDNSImpl.java.
void javax.jmdns.impl.JmDNSImpl.requestServiceInfo | ( | String | type, |
String | name | ||
) | [inline, virtual] |
Request service information. The information about the service is requested and the ServiceListener.resolveService method is called as soon as it is available. Usage note: Do not call this method from the AWT event dispatcher thread. You will make the user interface unresponsive.
type | full qualified service type, such as _http._tcp.local. . |
name | unqualified service name, such as foobar . |
Implements javax.jmdns.JmDNS.
Definition at line 839 of file JmDNSImpl.java.
void javax.jmdns.impl.JmDNSImpl.requestServiceInfo | ( | String | type, |
String | name, | ||
boolean | persistent | ||
) | [inline, virtual] |
Request service information. The information about the service is requested and the ServiceListener.resolveService method is called as soon as it is available. Usage note: Do not call this method from the AWT event dispatcher thread. You will make the user interface unresponsive.
type | full qualified service type, such as _http._tcp.local. . |
name | unqualified service name, such as foobar . |
persistent | if true ServiceListener.resolveService will be called whenever new new information is received. |
Implements javax.jmdns.JmDNS.
Definition at line 847 of file JmDNSImpl.java.
void javax.jmdns.impl.JmDNSImpl.requestServiceInfo | ( | String | type, |
String | name, | ||
long | timeout | ||
) | [inline, virtual] |
Request service information. The information about the service is requested and the ServiceListener.resolveService method is called as soon as it is available.
type | full qualified service type, such as _http._tcp.local. . |
name | unqualified service name, such as foobar . |
timeout | timeout in milliseconds |
Implements javax.jmdns.JmDNS.
Definition at line 855 of file JmDNSImpl.java.
void javax.jmdns.impl.JmDNSImpl.requestServiceInfo | ( | String | type, |
String | name, | ||
boolean | persistent, | ||
long | timeout | ||
) | [inline, virtual] |
Request service information. The information about the service is requested and the ServiceListener.resolveService method is called as soon as it is available.
type | full qualified service type, such as _http._tcp.local. . |
name | unqualified service name, such as foobar . |
persistent | if true ServiceListener.resolveService will be called whenever new new information is received. |
timeout | timeout in milliseconds |
Implements javax.jmdns.JmDNS.
Definition at line 863 of file JmDNSImpl.java.
ServiceInfoImpl javax.jmdns.impl.JmDNSImpl.resolveServiceInfo | ( | String | type, |
String | name, | ||
String | subtype, | ||
boolean | persistent | ||
) | [inline, package] |
Definition at line 741 of file JmDNSImpl.java.
void javax.jmdns.impl.JmDNSImpl.respondToQuery | ( | DNSIncoming | in | ) | [inline] |
Definition at line 1507 of file JmDNSImpl.java.
boolean javax.jmdns.impl.JmDNSImpl.revertState | ( | ) | [inline] |
Sets the state and notifies all objects that wait on the ServiceInfo.
true</code if the state was changed by this thread, false
otherwise.
DNSState::revert()
Implements javax.jmdns.impl.DNSStatefulObject.
Definition at line 524 of file JmDNSImpl.java.
void javax.jmdns.impl.JmDNSImpl.send | ( | DNSOutgoing | out | ) | throws IOException [inline] |
Send an outgoing multicast DNS message.
out |
IOException |
Definition at line 1553 of file JmDNSImpl.java.
Delegate javax.jmdns.impl.JmDNSImpl.setDelegate | ( | Delegate | delegate | ) | [inline] |
Definition at line 2256 of file JmDNSImpl.java.
void javax.jmdns.impl.JmDNSImpl.setLastThrottleIncrement | ( | long | lastThrottleIncrement | ) | [inline] |
Definition at line 2198 of file JmDNSImpl.java.
void javax.jmdns.impl.JmDNSImpl.setLocalHost | ( | HostInfo | localHost | ) | [inline, package] |
Definition at line 2234 of file JmDNSImpl.java.
void javax.jmdns.impl.JmDNSImpl.setPlannedAnswer | ( | DNSIncoming | plannedAnswer | ) | [inline] |
Definition at line 2226 of file JmDNSImpl.java.
void javax.jmdns.impl.JmDNSImpl.setThrottle | ( | int | throttle | ) | [inline] |
Definition at line 2206 of file JmDNSImpl.java.
void javax.jmdns.impl.JmDNSImpl.start | ( | Collection<?extends ServiceInfo > | serviceInfos | ) | [inline, private] |
Definition at line 427 of file JmDNSImpl.java.
void javax.jmdns.impl.JmDNSImpl.startAnnouncer | ( | ) | [inline] |
Start a new announcer task
Implements javax.jmdns.impl.DNSTaskStarter.
Definition at line 1625 of file JmDNSImpl.java.
void javax.jmdns.impl.JmDNSImpl.startCanceler | ( | ) | [inline] |
Start a new canceler task
Implements javax.jmdns.impl.DNSTaskStarter.
Definition at line 1643 of file JmDNSImpl.java.
void javax.jmdns.impl.JmDNSImpl.startProber | ( | ) | [inline] |
Start a new prober task
Implements javax.jmdns.impl.DNSTaskStarter.
Definition at line 1616 of file JmDNSImpl.java.
void javax.jmdns.impl.JmDNSImpl.startReaper | ( | ) | [inline] |
Start a new reaper task. There is only supposed to be one reaper running at a time.
Implements javax.jmdns.impl.DNSTaskStarter.
Definition at line 1652 of file JmDNSImpl.java.
void javax.jmdns.impl.JmDNSImpl.startRenewer | ( | ) | [inline] |
Start a new renewer task
Implements javax.jmdns.impl.DNSTaskStarter.
Definition at line 1634 of file JmDNSImpl.java.
void javax.jmdns.impl.JmDNSImpl.startResponder | ( | DNSIncoming | in, |
int | port | ||
) | [inline] |
Start a new responder task
in | incoming message |
port | incoming port |
Implements javax.jmdns.impl.DNSTaskStarter.
Definition at line 1688 of file JmDNSImpl.java.
void javax.jmdns.impl.JmDNSImpl.startServiceInfoResolver | ( | ServiceInfoImpl | info | ) | [inline] |
Start a new service info resolver task
info | service info to resolve |
Implements javax.jmdns.impl.DNSTaskStarter.
Definition at line 1661 of file JmDNSImpl.java.
void javax.jmdns.impl.JmDNSImpl.startServiceResolver | ( | String | type | ) | [inline] |
Start a new service resolver task
type | service type to resolve |
Implements javax.jmdns.impl.DNSTaskStarter.
Definition at line 1679 of file JmDNSImpl.java.
void javax.jmdns.impl.JmDNSImpl.startTypeResolver | ( | ) | [inline] |
Start a new service type resolver task
Implements javax.jmdns.impl.DNSTaskStarter.
Definition at line 1670 of file JmDNSImpl.java.
String javax.jmdns.impl.JmDNSImpl.toString | ( | ) | [inline] |
Definition at line 1886 of file JmDNSImpl.java.
static String javax.jmdns.impl.JmDNSImpl.toUnqualifiedName | ( | String | type, |
String | qualifiedName | ||
) | [inline, static, package] |
Definition at line 2185 of file JmDNSImpl.java.
void javax.jmdns.impl.JmDNSImpl.unregisterAllServices | ( | ) | [inline, virtual] |
Unregister all services.
Implements javax.jmdns.JmDNS.
Definition at line 1070 of file JmDNSImpl.java.
void javax.jmdns.impl.JmDNSImpl.unregisterService | ( | ServiceInfo | infoAbstract | ) | [inline, virtual] |
Unregister a service. The service should have been registered. Note: Unregistered services will not disappear form the list of services immediately. According to the specification, when unregistering services we send goodbye packets and then wait 1s before purging the cache.
This is support for shared records that can be rescued by some other cooperation DNS.
Clients receiving a Multicast DNS Response with a TTL of zero SHOULD NOT immediately delete the record from the cache, but instead record a TTL of 1 and then delete the record one second later.
info | service info to remove |
Implements javax.jmdns.JmDNS.
Definition at line 1049 of file JmDNSImpl.java.
void javax.jmdns.impl.JmDNSImpl.updateRecord | ( | long | now, |
DNSRecord | rec, | ||
Operation | operation | ||
) | [inline] |
Notify all listeners that a record was updated.
now | update date |
rec | DNS record |
operation | DNS cache operation |
Definition at line 1273 of file JmDNSImpl.java.
boolean javax.jmdns.impl.JmDNSImpl.waitForAnnounced | ( | long | timeout | ) | [inline] |
Waits for the object to be announced.
timeout | the maximum time to wait in milliseconds. |
true
if the object is announced, false
otherwiseImplements javax.jmdns.impl.DNSStatefulObject.
Definition at line 644 of file JmDNSImpl.java.
boolean javax.jmdns.impl.JmDNSImpl.waitForCanceled | ( | long | timeout | ) | [inline] |
Waits for the object to be canceled.
timeout | the maximum time to wait in milliseconds. |
true
if the object is canceled, false
otherwiseImplements javax.jmdns.impl.DNSStatefulObject.
Definition at line 652 of file JmDNSImpl.java.
void javax.jmdns.impl.JmDNSImpl.waitForInfoData | ( | ServiceInfo | info, |
long | timeout | ||
) | [inline, private] |
Definition at line 816 of file JmDNSImpl.java.
final DNSCache javax.jmdns.impl.JmDNSImpl._cache [private] |
Cache for DNSEntry's.
Definition at line 91 of file JmDNSImpl.java.
volatile Delegate javax.jmdns.impl.JmDNSImpl._delegate [private] |
Definition at line 105 of file JmDNSImpl.java.
final ExecutorService javax.jmdns.impl.JmDNSImpl._executor = Executors.newSingleThreadExecutor() [private] |
Definition at line 318 of file JmDNSImpl.java.
volatile InetAddress javax.jmdns.impl.JmDNSImpl._group [private] |
This is the multicast group, we are listening to for multicast DNS messages.
Definition at line 67 of file JmDNSImpl.java.
Thread javax.jmdns.impl.JmDNSImpl._incomingListener [private] |
Definition at line 306 of file JmDNSImpl.java.
final ReentrantLock javax.jmdns.impl.JmDNSImpl._ioLock = new ReentrantLock() [private] |
This lock is used to coordinate processing of incoming and outgoing messages. This is needed, because the Rendezvous Conformance Test does not forgive race conditions.
Definition at line 340 of file JmDNSImpl.java.
long javax.jmdns.impl.JmDNSImpl._lastThrottleIncrement [private] |
Last throttle increment.
Definition at line 316 of file JmDNSImpl.java.
final List<DNSListener> javax.jmdns.impl.JmDNSImpl._listeners [private] |
Holds instances of JmDNS.DNSListener. Must by a synchronized collection, because it is updated from concurrent threads.
Definition at line 76 of file JmDNSImpl.java.
Handle on the local host
Definition at line 304 of file JmDNSImpl.java.
final String javax.jmdns.impl.JmDNSImpl._name [private] |
Definition at line 357 of file JmDNSImpl.java.
If an incoming package which needs an answer is truncated, we store it here. We add more incoming DNSRecords to it, until the JmDNS.Responder timer picks it up.
FIXME [PJYF June 8 2010]: This does not work well with multiple planned answers for packages that came in from different clients.
Definition at line 346 of file JmDNSImpl.java.
final Random javax.jmdns.impl.JmDNSImpl._random = new Random() [static, private] |
The timer that triggers our announcements. We can't use the main timer object, because that could cause a deadlock where Prober waits on JmDNS.this lock held by close(), close() waits for us to finish, and we wait for Prober to give us back the timer thread so we can announce. (Patch from docbug in 2006-04-19 still wasn't patched .. so I'm doing it!) The source for random values. This is used to introduce random delays in responses. This reduces the potential for collisions on the network.
Definition at line 335 of file JmDNSImpl.java.
final Object javax.jmdns.impl.JmDNSImpl._recoverLock = new Object() [private] |
Definition at line 1709 of file JmDNSImpl.java.
final ConcurrentMap<String, ServiceCollector> javax.jmdns.impl.JmDNSImpl._serviceCollectors [private] |
This hashtable is used to maintain a list of service types being collected by this JmDNS instance. The key of the hashtable is a service type name, the value is an instance of JmDNS.ServiceCollector.
Definition at line 355 of file JmDNSImpl.java.
final ConcurrentMap<String, List<ServiceListenerStatus> > javax.jmdns.impl.JmDNSImpl._serviceListeners [private] |
Holds instances of ServiceListener's. Keys are Strings holding a fully qualified service type. Values are LinkedList's of ServiceListener's.
Definition at line 81 of file JmDNSImpl.java.
final ConcurrentMap<String, ServiceInfo> javax.jmdns.impl.JmDNSImpl._services [private] |
This hashtable holds the services that have been registered. Keys are instances of String which hold an all lower-case version of the fully qualified service name. Values are instances of ServiceInfo.
Definition at line 96 of file JmDNSImpl.java.
final ConcurrentMap<String, ServiceTypeEntry> javax.jmdns.impl.JmDNSImpl._serviceTypes [private] |
This hashtable holds the service types that have been registered or that have been received in an incoming datagram.
Keys are instances of String which hold an all lower-case version of the fully qualified service type.
Values hold the fully qualified service type.
Definition at line 103 of file JmDNSImpl.java.
Thread javax.jmdns.impl.JmDNSImpl._shutdown [protected] |
This is the shutdown hook, we registered with the java runtime.
Definition at line 299 of file JmDNSImpl.java.
volatile MulticastSocket javax.jmdns.impl.JmDNSImpl._socket [private] |
This is our multicast socket.
Definition at line 71 of file JmDNSImpl.java.
int javax.jmdns.impl.JmDNSImpl._throttle [private] |
Throttle count. This is used to count the overall number of probes sent by JmDNS. When the last throttle increment happened .
Definition at line 311 of file JmDNSImpl.java.
final Set<ServiceTypeListenerStatus> javax.jmdns.impl.JmDNSImpl._typeListeners [private] |
Holds instances of ServiceTypeListener's.
Definition at line 86 of file JmDNSImpl.java.
Logger javax.jmdns.impl.JmDNSImpl.logger = Logger.getLogger(JmDNSImpl.class.getName()) [static, private] |
Definition at line 58 of file JmDNSImpl.java.