mirror of https://github.com/apache/activemq.git
Open up the visibility of the JmDNS.addListener method. It's handy for listening for record updates as they occur
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1356830 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
ae816dcb3f
commit
902c6e98aa
|
@ -28,7 +28,7 @@ package org.apache.activemq.jmdns;
|
||||||
* @author Werner Randelshofer, Rick Blair
|
* @author Werner Randelshofer, Rick Blair
|
||||||
* @version 1.0 May 22, 2004 Created.
|
* @version 1.0 May 22, 2004 Created.
|
||||||
*/
|
*/
|
||||||
interface DNSListener
|
public interface DNSListener
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Update a DNS record.
|
* Update a DNS record.
|
||||||
|
|
|
@ -34,7 +34,7 @@ import java.util.logging.Logger;
|
||||||
* @version %I%, %G%
|
* @version %I%, %G%
|
||||||
* @author Arthur van Hoff, Rick Blair, Werner Randelshofer, Pierre Frisch
|
* @author Arthur van Hoff, Rick Blair, Werner Randelshofer, Pierre Frisch
|
||||||
*/
|
*/
|
||||||
abstract class DNSRecord extends DNSEntry
|
public abstract class DNSRecord extends DNSEntry
|
||||||
{
|
{
|
||||||
private static Logger logger = Logger.getLogger(DNSRecord.class.toString());
|
private static Logger logger = Logger.getLogger(DNSRecord.class.toString());
|
||||||
int ttl;
|
int ttl;
|
||||||
|
@ -157,7 +157,7 @@ abstract class DNSRecord extends DNSEntry
|
||||||
/**
|
/**
|
||||||
* Check if the record is expired.
|
* Check if the record is expired.
|
||||||
*/
|
*/
|
||||||
boolean isExpired(long now)
|
public boolean isExpired(long now)
|
||||||
{
|
{
|
||||||
return getExpirationTime(100) <= now;
|
return getExpirationTime(100) <= now;
|
||||||
}
|
}
|
||||||
|
@ -189,7 +189,7 @@ abstract class DNSRecord extends DNSEntry
|
||||||
/**
|
/**
|
||||||
* Address record.
|
* Address record.
|
||||||
*/
|
*/
|
||||||
static class Address extends DNSRecord
|
public static class Address extends DNSRecord
|
||||||
{
|
{
|
||||||
private static Logger logger = Logger.getLogger(Address.class.toString());
|
private static Logger logger = Logger.getLogger(Address.class.toString());
|
||||||
InetAddress addr;
|
InetAddress addr;
|
||||||
|
@ -408,7 +408,7 @@ abstract class DNSRecord extends DNSEntry
|
||||||
/**
|
/**
|
||||||
* Pointer record.
|
* Pointer record.
|
||||||
*/
|
*/
|
||||||
static class Pointer extends DNSRecord
|
public static class Pointer extends DNSRecord
|
||||||
{
|
{
|
||||||
private static Logger logger = Logger.getLogger(Pointer.class.toString());
|
private static Logger logger = Logger.getLogger(Pointer.class.toString());
|
||||||
String alias;
|
String alias;
|
||||||
|
@ -459,10 +459,10 @@ abstract class DNSRecord extends DNSEntry
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static class Text extends DNSRecord
|
public static class Text extends DNSRecord
|
||||||
{
|
{
|
||||||
private static Logger logger = Logger.getLogger(Text.class.toString());
|
private static Logger logger = Logger.getLogger(Text.class.toString());
|
||||||
byte text[];
|
final public byte text[];
|
||||||
|
|
||||||
Text(String name, int type, int clazz, int ttl, byte text[])
|
Text(String name, int type, int clazz, int ttl, byte text[])
|
||||||
{
|
{
|
||||||
|
@ -528,7 +528,7 @@ abstract class DNSRecord extends DNSEntry
|
||||||
/**
|
/**
|
||||||
* Service record.
|
* Service record.
|
||||||
*/
|
*/
|
||||||
static class Service extends DNSRecord
|
public static class Service extends DNSRecord
|
||||||
{
|
{
|
||||||
private static Logger logger = Logger.getLogger(Service.class.toString());
|
private static Logger logger = Logger.getLogger(Service.class.toString());
|
||||||
int priority;
|
int priority;
|
||||||
|
|
|
@ -737,7 +737,7 @@ public class JmDNS {
|
||||||
* of answers to the question as they arrive, or from the cache if they
|
* of answers to the question as they arrive, or from the cache if they
|
||||||
* are already available.
|
* are already available.
|
||||||
*/
|
*/
|
||||||
void addListener(DNSListener listener, DNSQuestion question) {
|
public void addListener(DNSListener listener, DNSQuestion question) {
|
||||||
long now = System.currentTimeMillis();
|
long now = System.currentTimeMillis();
|
||||||
|
|
||||||
// add the new listener
|
// add the new listener
|
||||||
|
@ -760,7 +760,7 @@ public class JmDNS {
|
||||||
* Remove a listener from all outstanding questions. The listener will no longer
|
* Remove a listener from all outstanding questions. The listener will no longer
|
||||||
* receive any updates.
|
* receive any updates.
|
||||||
*/
|
*/
|
||||||
void removeListener(DNSListener listener) {
|
public void removeListener(DNSListener listener) {
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
listeners.remove(listener);
|
listeners.remove(listener);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue