Classes | Public Member Functions | Static Public Member Functions | Protected Attributes | Package Functions | Static Package Functions | Private Member Functions | Private Attributes | Static Private Attributes
javax.jmdns.impl.JmDNSImpl Class Reference
Inheritance diagram for javax.jmdns.impl.JmDNSImpl:
Inheritance graph
[legend]

List of all members.

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, ServiceInfogetServices ()
Map< String, ServiceTypeEntrygetServiceTypes ()
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())

Detailed Description

mDNS implementation in Java.

Author:
Arthur van Hoff, Rick Blair, Jeff Sonstein, Werner Randelshofer, Pierre Frisch, Scott Lewis

Definition at line 57 of file JmDNSImpl.java.


Constructor & Destructor Documentation

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.

Parameters:
addressIP address to bind to.
namename of the newly created JmDNS
Exceptions:
IOException

Definition at line 393 of file JmDNSImpl.java.


Member Function Documentation

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

Parameters:
in
addr
port
out
rec
Returns:
outgoing answer
Exceptions:
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.

Parameters:
listenerDSN listener
questionDNS 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..

Parameters:
typefull qualified service type, such as _http._tcp.local..
listenerlistener 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.

Parameters:
listenerlistener for service types
Exceptions:
IOExceptionif 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.

Sets the state and notifies all objects that wait on the ServiceInfo.

Parameters:
taskassociated task
Returns:
true</code if the state was changed by this thread, false otherwise.
See also:
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.

Parameters:
taskassociated task
statestate of the task

Implements javax.jmdns.impl.DNSStatefulObject.

Definition at line 564 of file JmDNSImpl.java.

Sets the state and notifies all objects that wait on the ServiceInfo.

Returns:
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.

Cancel the state task timer

Implements javax.jmdns.impl.DNSTaskStarter.

Definition at line 1607 of file JmDNSImpl.java.

Cancel the generals task timer

Implements javax.jmdns.impl.DNSTaskStarter.

Definition at line 1598 of file JmDNSImpl.java.

Definition at line 1802 of file JmDNSImpl.java.

Definition at line 1825 of file JmDNSImpl.java.

Definition at line 467 of file JmDNSImpl.java.

Sets the state and notifies all objects that wait on the ServiceInfo.

Returns:
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.

This method disposes all ServiceCollector instances which have been created by calls to method list(type).

See also:
list

Definition at line 2022 of file JmDNSImpl.java.

Return the DNSCache associated with the cache variable

Returns:
DNS cache

Definition at line 661 of file JmDNSImpl.java.

Delegate javax.jmdns.impl.JmDNSImpl.getDelegate ( ) [inline, virtual]

Returns the instance delegate

Returns:
instance delegate

Implements javax.jmdns.JmDNS.

Definition at line 2251 of file JmDNSImpl.java.

Returns the DNS associated with this object.

Returns:
DNS resolver

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.

Returns:
Host name

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.

Returns:
Internet Address
Exceptions:
IOExceptionif 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.

Returns:
Internet Address
Exceptions:
IOExceptionif there is an error in the underlying protocol, such as a TCP error.
Deprecated:
do not use this implementation yields unpredictable results use getInetAddress()

Implements javax.jmdns.JmDNS.

Definition at line 703 of file JmDNSImpl.java.

Definition at line 2202 of file JmDNSImpl.java.

Returns the local host info

Returns:
local host info

Definition at line 686 of file JmDNSImpl.java.

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.

Returns:
name of the JmDNS

Implements javax.jmdns.JmDNS.

Definition at line 669 of file JmDNSImpl.java.

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.

Parameters:
typefully qualified service type, such as _http._tcp.local. .
nameunqualified service name, such as foobar .
Returns:
null if the service information cannot be obtained

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.

Parameters:
typefull qualified service type, such as _http._tcp.local. .
nameunqualified service name, such as foobar .
timeouttimeout in milliseconds. Typical timeout should be 5s.
Returns:
null if the service information cannot be obtained

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.

Parameters:
typefully qualified service type, such as _http._tcp.local. .
nameunqualified service name, such as foobar .
persistentif true ServiceListener.resolveService will be called whenever new new information is received.
Returns:
null if the service information cannot be obtained

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.

Parameters:
typefull qualified service type, such as _http._tcp.local. .
nameunqualified service name, such as foobar .
timeouttimeout in milliseconds. Typical timeout should be 5s.
persistentif true ServiceListener.resolveService will be called whenever new new information is received.
Returns:
null if the service information cannot be obtained

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.

Definition at line 2194 of file JmDNSImpl.java.

Definition at line 2238 of file JmDNSImpl.java.

MulticastSocket javax.jmdns.impl.JmDNSImpl.getSocket ( ) [inline]

Definition at line 2242 of file JmDNSImpl.java.

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.

Parameters:
in
addr
port
Exceptions:
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.

Exceptions:
IOException

Definition at line 1437 of file JmDNSImpl.java.

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.

Definition at line 2218 of file JmDNSImpl.java.

Definition at line 2222 of file JmDNSImpl.java.

Returns true, if this is an announced state.

Returns:
true if announced state, false otherwise

Implements javax.jmdns.impl.DNSStatefulObject.

Definition at line 604 of file JmDNSImpl.java.

Returns true, if this is an announcing state.

Returns:
true if announcing state, false otherwise

Implements 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.

Parameters:
taskassociated task
statestate of the task
Returns:
true is the task is associated with this object, false otherwise.

Implements javax.jmdns.impl.DNSStatefulObject.

Definition at line 580 of file JmDNSImpl.java.

Returns true, if this is a canceled state.

Returns:
true if canceled state, false otherwise

Implements javax.jmdns.impl.DNSStatefulObject.

Definition at line 620 of file JmDNSImpl.java.

Returns true, if this is a canceling state.

Returns:
true if canceling state, false otherwise

Implements javax.jmdns.impl.DNSStatefulObject.

Definition at line 612 of file JmDNSImpl.java.

Returns true, if this is a closed state.

Returns:
true if closed state, false otherwise

Implements javax.jmdns.impl.DNSStatefulObject.

Definition at line 636 of file JmDNSImpl.java.

Returns true, if this is a closing state.

Returns:
true if closing state, false otherwise

Implements javax.jmdns.impl.DNSStatefulObject.

Definition at line 628 of file JmDNSImpl.java.

Returns true, if this is a probing state.

Returns:
true if probing state, false otherwise

Implements 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.

Parameters:
typeService type name, such as _http._tcp.local..
Returns:
An array of service instance.

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.

Parameters:
typeService type name, such as _http._tcp.local..
timeouttimeout in milliseconds. Typical timeout should be 6s.
Returns:
An array of service instance.

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.

Parameters:
typeService type name, such as _http._tcp.local..
Returns:
A dictionary of service info by subtypes.

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.

Parameters:
typeService type name, such as _http._tcp.local..
timeouttimeout in milliseconds. Typical timeout should be 6s.
Returns:
A dictionary of service info by subtypes.

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

Parameters:
argvthe command line arguments

Definition at line 365 of file JmDNSImpl.java.

Generate a possibly unique name for a service using the information we have in the cache.

Returns:
returns true, if the name of the service info had to be changed.

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

Deprecated:
since 3.2.2

Implements javax.jmdns.JmDNS.

Definition at line 1878 of file JmDNSImpl.java.

Purge the state task timer

Implements javax.jmdns.impl.DNSTaskStarter.

Definition at line 1589 of file JmDNSImpl.java.

Purge the general task timer

Implements javax.jmdns.impl.DNSTaskStarter.

Definition at line 1580 of file JmDNSImpl.java.

Recover jmdns when there is an error.

Definition at line 1714 of file JmDNSImpl.java.

Sets the state and notifies all objects that wait on the ServiceInfo.

Returns:
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)}.

Parameters:
infoservice info to register
Exceptions:
IOExceptionif 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.

Parameters:
typefull qualified service type, such as _http._tcp.local..
Returns:
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.

Parameters:
typefull qualified service type, such as _http._tcp.local..
Returns:
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.

Parameters:
typefull qualified service type, such as _http._tcp.local..
Returns:
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.

Remove the association of the task with this Object.

Parameters:
taskassociated task

Implements javax.jmdns.impl.DNSStatefulObject.

Definition at line 572 of file JmDNSImpl.java.

Remove a listener from all outstanding questions. The listener will no longer receive any updates.

Parameters:
listenerDSN 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.

Parameters:
typefull qualified service type, such as _http._tcp.local..
listenerlistener for service updates

Remove listener for services of a given type.

Parameters:
typefull qualified service type, such as _http._tcp.local..
listenerlistener for service updates

Implements javax.jmdns.JmDNS.

Definition at line 968 of file JmDNSImpl.java.

Remove listener for service types.

Parameters:
listenerlistener for service types

Implements javax.jmdns.JmDNS.

Definition at line 910 of file JmDNSImpl.java.

Renew a service when the record become stale. If there is no service collector for the type this method does nothing.

Parameters:
recordDNS 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.

Parameters:
typefull qualified service type, such as _http._tcp.local. .
nameunqualified 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.

Parameters:
typefull qualified service type, such as _http._tcp.local. .
nameunqualified service name, such as foobar .
persistentif 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.

Parameters:
typefull qualified service type, such as _http._tcp.local. .
nameunqualified service name, such as foobar .
timeouttimeout 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.

Parameters:
typefull qualified service type, such as _http._tcp.local. .
nameunqualified service name, such as foobar .
persistentif true ServiceListener.resolveService will be called whenever new new information is received.
timeouttimeout 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.

Definition at line 1507 of file JmDNSImpl.java.

Sets the state and notifies all objects that wait on the ServiceInfo.

Returns:
true</code if the state was changed by this thread, false otherwise.
See also:
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.

Parameters:
out
Exceptions:
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.

Start a new announcer task

Implements javax.jmdns.impl.DNSTaskStarter.

Definition at line 1625 of file JmDNSImpl.java.

Start a new canceler task

Implements javax.jmdns.impl.DNSTaskStarter.

Definition at line 1643 of file JmDNSImpl.java.

Start a new prober task

Implements javax.jmdns.impl.DNSTaskStarter.

Definition at line 1616 of file JmDNSImpl.java.

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.

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

Parameters:
inincoming message
portincoming port

Implements javax.jmdns.impl.DNSTaskStarter.

Definition at line 1688 of file JmDNSImpl.java.

Start a new service info resolver task

Parameters:
infoservice 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

Parameters:
typeservice type to resolve

Implements javax.jmdns.impl.DNSTaskStarter.

Definition at line 1679 of file JmDNSImpl.java.

Start a new service type resolver task

Implements javax.jmdns.impl.DNSTaskStarter.

Definition at line 1670 of file JmDNSImpl.java.

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.

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.
 
Parameters:
infoservice 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.

Parameters:
nowupdate date
recDNS record
operationDNS 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.

Parameters:
timeoutthe maximum time to wait in milliseconds.
Returns:
true if the object is announced, false otherwise

Implements 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.

Parameters:
timeoutthe maximum time to wait in milliseconds.
Returns:
true if the object is canceled, false otherwise

Implements 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.


Member Data Documentation

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.

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.

Last throttle increment.

Definition at line 316 of file JmDNSImpl.java.

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.

See also:
list

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.

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.

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.


The documentation for this class was generated from the following file:


zeroconf_jmdns_suite
Author(s): Daniel Stonier
autogenerated on Thu Aug 27 2015 15:50:27