Commit d6da6b12 authored by KGreg's avatar KGreg
Browse files

Observer basic

parent 720f0ce0
<?xml version="1.0" encoding="UTF-8"?>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
<attribute name="maven.pomderived" value="true"/>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attribute name="maven.pomderived" value="true"/>
<classpathentry kind="output" path="target/classes"/>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
This diff is collapsed.
#Fri Jul 23 16:08:24 PDT 2010
#Wed Aug 24 18:27:28 CEST 2011
resourceFilterGoals=process-resources resources\:testResources
language: java
- openjdk7
All changes from 3.4.2 onwards are found online at Github:
CHANGELOG 28 June 2012 Pierre Frisch
Rev the source code to 3.4.2
Update service text - ID: 3400063
Interface Discovery - ID: 3399444
Question about function in - ID: 3400651
StringIndexOutOfBounds in - ID: 3393338
JmDNS 3.4.1 does not answer to PTR requests on sub-types - ID: 3437695
problem with . in name
Incorrect behavior for a query with non-zero RCODE value - ID: 3451306
Incorrect behavior for packets with inconsistent field size - ID: 3451316
Incorrect response for a query with unknown class - ID: 3451753
Incorrect behavior for a query with non-zero OPCODE value - ID: 3451758
incorrect handling of conflicting hostnames which contain"-" - ID: 3454363
Multicast query sending on wrong NIC - ID: 3463811
free Factory's DNSTaskStarter when calling JmDNS.close() - ID: 3513302
multiple ip addresses problem - ID: 3499483
Failure to resolve services - ID: 3517826
ConcurrentModificationException - ID: 3509434
Failing to resolve jmdns registered services - ID: 3435220
UDP portscan causes JmDNS to log excessively - ID: 3529498
JmmDNS improvements - ID: 3532626
Non-daemon threads prevent application shutdown - ID: 3533221
JmmDNS wasn't requesting on loopback - ID: 3532647
getURLs with ipv6 - ID: 3480140
Another thread preventing application shutdown - ID: 3538523
Bug when DNSRecord.Service is evaluated before DNSRecord.TXT - ID: 3601799
CHANGELOG 24 August 2011 Pierre Frisch
Rev the source code to 3.4.1
unregisterService() prevents subsequent registerService() - ID: 3163605
Sometimes race condition causes to use a canceled timer - ID: 3183116
How should addServiceListener be expected to work? - ID: 3186552
ConcurrentModificationException is possible - ID: 3195594
Registering twice same ServiceInfo blocks - ID: 3195632
Error message on second register - ID: 3195656
ServiceInfoImpl returns invalid IPV6 addresses - ID: 3290692
Queries are sent over IPv4 even when binding to IPv6 address - ID: 3293105
Synchronization issue - ID: 3298376
Synchronization issue - ID: 3301269
NPE is possible - ID: 3390168
CHANGELOG 20 January 2011 Pierre Frisch
Rev the source code to 3.4.0
Android does not support IOException(String, Throwable) - ID: 3110982
Replace dots with dashes in hostname instead of truncating - ID: 3111108
Moved the NetworkTopologyDiscovery into a stand alone class instead of JmmDNS inner class.
OSGi Bundle-RequiredExecutionEnvironment broken - ID: 3111738
JmDNS does not preserve service type case
Remove call to isEmpty (for Android) - ID: 3113114
Remove package.html - ID: 3112613
Announcer is causing a ServiceType cache flush - ID: 3113073
Can't resolve if txt field is empty - ID: 3123622
TXT Record not updating for getProperty call - ID: 3126952
********* JmDNS is now case preserving, which was the intent all along. Check your code as JmDNS may return mixed case in instances where it was returning lower case. *********
ServiceInfo doesn't allow more than one IPV4 address.- ID: 3150462
waitForCancelled and waitForAnnounced can cause bad behavior - ID: 3151408
Add support for MANET that need to override timer definition
Reworked the waitForXXX method to make them event driven. Quite a bit more efficient.
CHANGELOG 16 November 2010 Pierre Frisch
Rev the source code to 3.2.2
serviceResolved not working properly - ID: 3032054
Only adds "first" server on Android - ID: 3065602
RecordReaper repeated stacktrace - ID: 3085234
JmDNS 3.2.1 on Android Application - ID: 3059323
Built-in support for multiple network interfaces - ID: 3079530
Create OSGi metadata in maven build - ID: 3085811
Path to prevent JmDNS.create() binding to loopback - ID: 3092443 not available on Android - ID: 3096650
CHANGELOG 31 August 2010 Pierre Frisch
Rev the source code to 3.2.1
ServiceInfo.setText() reannounces updated service only once - ID: 3030016
ServiceListener doesn't see updated ServiceInfo - ID: 3010451
unregisterService - ID: 3040520
Maven depository update - ID: 1432672
Maven POM file - ID: 3047223
********* Call backs are now executed in a separate executor. This should make JmDNS more responsive but may have consequences in the client code. *********
CHANGELOG 08 July 2010 Pierre Frisch
Rev the source code to 3.2.0
Add subtypes - ID: 1582803
CHANGELOG 27 June 2010 Pierre Frisch
Rev the source code to 3.1.8
JmDNS fails to get ServiceInfo from cache - ID: 3018122
Avahi DNS entries lost after an hour - ID: 3015920
No IPv6 address returned by getAddress - ID: 1952439
JmDNS.list() no longer provides results - ID: 3019756
CHANGELOG 10 June 2010 Pierre Frisch
Rev the source code to 3.1.7
********* Reorganization of the locking / timer strategy. Hopefully it should be less deadlock prone. *********
index out of range exception in javax.jmdns.JmDNS - ID: 1414816
Optimization in JmDNS.SocketListener - ID: 1623129
JMDNS reports IPv6 link local addr as service type - ID: 1791481
JmDNSImpl.openMulticastSocket() fails on AIX - ID: 2821919
Service discovery takes about 6 s - FIX - ID: 2910895
Update text field and receive text updates. - ID: 2349331
Make listening interface and port configurable - ID: 3000610
Add extra API to read protocol and domain - ID: 3000616
Replace outdated/inofficial "._mdns._udp." meta query with o - ID: 3000618
Build OSGi bundle as part of ANT build - ID: 3000972
CHANGELOG 5 April 2010 Pierre Frisch
Rev the source code to 3.1.6
Fix an issue in the discovery where the values where not correctly retrieved from the cache.
Bug in method JmDNSImpl.openMulticastSocket - ID: 2980409
JmDNSImpl DNS Cache Entry Removal - ID: 2981167
Bug in Pointer.getServiceInfo() - ID: 2980727
TXT String not set when ServiceInfo retrieved from the Cache - ID: 2982114
CHANGELOG 30 March 2010 Pierre Frisch
Rev the source code to 3.1.5
Reorg or the Responser code to make more modular and easy to understand.
Added support for variable response length from EDNS
Added better usage of cache information that will make the request for service info more responsive.
CHANGELOG 28 March 2010 Pierre Frisch
Rev the source code to 3.1.4
Fixed a bad issue that would prevent proper response to queries.
Adjusted the timeouts to make them work by default.
CHANGELOG 22 March 2010 Pierre Frisch
Rev the source code to 3.1.3
Fixed a NPE in ServiceInfoImpl.getText()
Fixed a case sensitivity issue in the Service Info updateRecord()
Fixed a number of problem with the service listener that did not get called at the right time.
****** Please note the changes in the JavaDoc for ServiceListener ****** This is not a change of behavior but a clarification of the contract.
CHANGELOG 17 March 2010 Pierre Frisch
Rev the source code to 3.1.2
Merged issue: JmDNS.create() with no args doesn't set address properly - ID: 2937206
Merged issue: IllegalStateException in Prober.start() - ID: 2942555
Fixed an NPE exception and tested publishing and discovering the service on the same machine
CHANGELOG 9 March 2010 Pierre Frisch
Rev the source code to 3.1.1
Merged issue: Service listener does not find any services - FIX - ID: 2910899
CHANGELOG 17 December 2009 Rick Blair
1. Changes by Pierre Frisch to compile clean under java 1.5 and java 1.6
2. Patch to close as submitted by Lachian Deck
Thanks all.
CHANGELOG 06 December 2009 Rick Blair
1. Merged in all outstanding patches.
CHANGELOG 06 February 2008 Scott Cytacki
1. Added code to make it easier to debug communication with other mdns implementations.
- keeping track of the the address which sent a dns record
- flag to turning off domain-name compression
- flag to use non domain-name format for targets of SRV records
- checks for conflicts from our own source address.
Added the UNIQUE flag which is referred to the "cache flush bit" by the spec, on SRV
and TXT records sent to announce a Service.
2. Made TimerTasks inside of JmDNSImpl into toplevel classes in a new package:
javax.jmdns.impl.tasks This required making several method publics and encapsulating
several fields with public getters and setters. All these changes were done using Eclipse
refactoring so there is a log chance of error. I will be testing it with the Conformance
Test to make sure it hasn't regressed.
CHANGELOG 05 February 2008 Scott Cytacki
1. Moved implementation classes into a impl package. This paves the way for further
refactoring. By putting all the jmdns api classes and interfaces in one package, the impl
classes can be split up more without exposing public classes and methods that aren't
part of the jmdns api. This change breaks the old api, because the JmDNS and ServiceInfo
classes cannot be instanciated directly. Instead there are factory methods to create them.
CHANGELOG 01 February 2008 Scott Cytacki
1. Fixed an error in the way ServiceInfo was constructing the text array for the TXT
record. The length byte was being omitted if the ServiceInfo constructor was called
with the last argument of a String. Added better handling of unsupported dns label
types. The Apple Bonjour conformance test sends SRV records with target strings that
have lengths longer than 63, so the top 2 bits get used.
CHANGELOG 25 January 2008 Scott Cytacki
1. Consolidated most places where the ServiceInfo object was turned into a set of dns records.
And most places where the localHost (HostInfo) object was turned into dns records.
There is still one place that is duplicated (JmDNS.Responder) because it adds the dns records
to a list first, removes known answers, and finally adds them to DNSOutgoing.
CHANGELOG 17 January 2008 Scott Cytacki
1. Added eclipse project files. Forced the eclipse project to use java 1.4
2. Changed the eclipse project to store built files in eclipse-lib because lib was already
being used.
3. Added eclipse code formating configuration files. They should match follow the turbine
coding standards which have been used in this project:
Also this includes a minor formating clean up of JmDNS class.
4. Changed Logger.getLogger parameter to use class.getName instead of class.toString. This is because
class.toString returns for example "class javax.jmdns.JmDNS" while class.getName returns "javax.jmdns.JmDNS".
The "class " messes up the logging hierarchical structure. This javadoc specifices the string should be
dot separated:
Also this post to the mailing list talks about this issue:
In that case getCanonicalName was used but that is only in Java 1.5 and basically does the same thing
for normal classes.
CHANGELOG 16 July 2005 Rick Blair
1. Added Apache License Version 2.0
2. Added shutdown fix as identifed by Scott Lewis
3. Added copyright notice.
4. General code cleanup.
CHANGELOG 30 November 2004 rawcoder
1. IPv6 support
- RFE 890432: IPv6 support implemented
2. Logging
- Logging is done using the Java Logger API now
3. Bug fixes
- JmDNS reannounces services after their TTL has timed out.
4. Plattform dependency
- Due to the changes done for IPv6 support and the logging,
JmDNS requires now a JVM supporting a J2SE 1.4 API.
CHANGELOG 6 June 2004 rawcoder
1. General API Changes
- RFE 868432: Changed listener API to comply with the commonly used
EventListener/EventObject idiom
- RFE 868433: Added a list method to class JmDNS which can be used to
retrieve a list of available services without having to
implement a ServiceListener.
- RFE 892855: All API's use now unqualified service instance names
2. General implementation changes
- JmDNS now runs through the Rendezvous Conformance Test, when the options
"-M hn" are used.
- Threads are now handled differently. ServiceListeners and
ServiceTypeListeners can not assume anymore that they are invoked from
the AWT event dispatcher thread.
- States are now handled explicitly using class DNSState.
3. DNSCache
- Removed the hash table code and use now a java.util.Hashtable.
- This reduces the overall size of the class.
4. DNSConstants
- Added several new time interval constants.
5. DNSEntry
- Now overrides method hashCode() to return a value, that is consistent with
method equals().
6. DNSIncoming
- Added a warning to constant EMPTY. Using this constant is dangerous, because a Vector
is mutable. Thus it can not be used as a constant this way.
- Made many instance variables and methods private.
- Added more output to method print(), to help me debug JmDNS.
- Optimized StringBuffer handling in method toString().
- Added methods isTruncated() and append().
- DNSIncoming must adjust variables numAnswers, numAuthorities, numAdditionals when skipping records.
7. DNSOutgoing
- Made as many instance variables private as I could.
- Added assertions (using if-Statements) to all add...() methods to prevent construction of
illegal data structures.
8. DNSRecord
- Made as many instance variables private as I could.
- Moved code from class JmDNS into class DNSRecord. The new operations are named: handleQuery()
handleResponse() and addAnswer(). This is to get rid of the big switch-statements that were
in method handleQuery() and handleResponse() of class JmDNS.
This does somehow make the relationship between these two classes a little bit more complex though.
9. JmDNS
- Added comments to some of the instance variables.
- Added an instance variable named 'state' to track the state of the host name published by JmDNS, and of
JmDNS itself.
- Replaced instance variable 'Vector browsers' by a hash map named 'serviceListeners'.
- Got rid of the query cache. All caching is done now by a single cache.
- Added instance variables for counting probe throttles.
- Added an instance variable named 'hostNameCount' to create a new host name, when a conflict was detected.
- Added a java.util.Timer. All outgoing messages and maintenance of the cache is now coordinated using the
timer. This greatly reduces the number of concurrent threads.
- Added an instance variable named 'ioLock'. This lock is used to coordinate the incoming listener thread
with the timer tasks.
- Added a static variable named 'random'. It is used to generate random delays for responses.
- All outgoing tasks such as probing, announcing, responding and canceling are now handled by instances of
- Added an instance variable named 'task', to keep track of timer tasks associated with the host name.
- Transferred code from JmDNS to DNSRecord to get rid of some ugly switch statements.
10. ServiceInfo
- Added an instance variable named 'state' to track the state of the service.
This is used only, if the service is published by JmDNS.
- Added an instance variable named 'task', to keep track of timer tasks associated with the service info.
11. Sample code
- Added a "samples" package to JmDNS. This package contains sample
programs for JmDNS.
12. JavaDoc
- Added a "package.html" file for each package. This file holds package
documentation used by JavaDoc.
13. Build
- Added a "samples" task to build.xml.
- The "javadoc" task puts now a version number into the header of
each generated page.
CHANGELOG 21 APRIL 2004 RickBlair
1. JmDNS
-Fixed broken additionals in the Query Function.
-Added additionals to the SVC query.
CHANGELOG 28-29 MAR 2004 jeffs
1. JmDNS
- Added probing thread to handle address record probing and conflicts
- Fixed wait times to be in line with the draft mDNS spec.
- Added query cache so can check if another machine is also
probing for our address.
- Added support for slowing down the request rate during
probing as per the draft mDNS spec.
- Added conflict checks.
- General code clean up.
- changed visibility of static debug variable to public
so apps can check it and decide to do their own logging and so on
- changed visbility of all non-static variables to private
- added package protected method getCache()
- broke up handleQuery() into:
private DNSOutgoing typeA()
private DNSOutgoing typePTR()
private DNSOutgoing findService()
- reduced handleQuery() synchronized block
to just cover Socket.send() call
[need to figure out what else needs synchronization]
2. ServiceInfo
- changed all calls to JmDNS cache variable
to use JmDNS getCache() accessor instead
- replaced javadoc comment
so the javadoc tool would quit whining
3. DNSConstants
- Added constants for wait times and probe times.
- changed to be a final class
- changed all references to it's fields in all other classes
to read DNSConstants.whatever
Know Problems.
-- The additional section is broken in handleQuery. This will be fixed in the next go round.
-- Service probing is still not to spec. No conflict resolution.
-- Still can blow address space on very busy networks.
# Contributing to JmDNS
Want to hack on JmDNS? Awesome! Here are instructions to get you
started. They are probably not perfect, please let us know if anything
feels wrong or incomplete.
## Reporting Issues
Please report JmDNS specific issues to the
[GitHub issues page](
If you have questions about how to use JmDNS, check out the
[JmDNS tag on StackOverflow](
and ask a new question if you don't find any answers there.
Do not worry, if you are not clear, which category your issue belongs to - we
will redirect you, if necessary.
## Build Environment
The build is based on Maven, so you will need a JDK >=1.6 and Maven 3 installed.
Then simply execute
mvn clean install
and find the resulting jar in the `target` folder.
## Contribution guidelines
### Pull requests are always welcome
We are always thrilled to receive pull requests, and do our best to
process them as fast as possible. Not sure if that typo is worth a pull
request? Do it! We will appreciate it.
If your pull request is not accepted on the first try, don't be
discouraged! If there's a problem with the implementation, hopefully you
received feedback on what to improve.
### Create issues...
Any significant improvement should be documented as [a GitHub
issue]( before anybody
starts working on it.
### ...but check for existing issues first!
Please take a moment to check that an issue doesn't already exist
documenting your bug report or improvement proposal. If it does, it
never hurts to add a quick "+1" or "I have this problem too". This will
help prioritize the most common problems and requests.
### Conventions
Fork the repo and make changes on your fork in a feature branch:
- If it's a bugfix branch, name it XXX-something where XXX is the number of the
- If it's a feature branch, create an enhancement issue to announce your
intentions, and name it XXX-something where XXX is the number of the issue.
Submit unit tests for your changes. JmDNS makes use of the JUnit test framework;
use it! Take a look at existing tests for inspiration. Run the full test suite
on your branch before submitting a pull request.
Update the documentation when creating or modifying features. Test
your documentation changes for clarity, concision, and correctness, as
well as a clean documentation build.
Write clean code. Universally formatted code promotes ease of writing, reading,
and maintenance.
Pull requests descriptions should be as clear as possible and include a
reference to all the issues that they address.
Pull requests must not contain commits from other users or branches.
Commit messages must start with a capitalized and short summary (max. 50
chars) written in the imperative, followed by an optional, more detailed
explanatory text which is separated from the summary by an empty line.
Code review comments may be added to your pull request. Discuss, then make the