本文整理汇总了Java中javax.jmdns.NetworkTopologyListener类的典型用法代码示例。如果您正苦于以下问题:Java NetworkTopologyListener类的具体用法?Java NetworkTopologyListener怎么用?Java NetworkTopologyListener使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
NetworkTopologyListener类属于javax.jmdns包,在下文中一共展示了NetworkTopologyListener类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: JmmDNSImpl
import javax.jmdns.NetworkTopologyListener; //导入依赖的package包/类
/**
*
*/
public JmmDNSImpl() {
super();
_networkListeners = Collections.synchronizedSet(new HashSet<NetworkTopologyListener>());
_knownMDNS = new ConcurrentHashMap<InetAddress, JmDNS>();
_services = new ConcurrentHashMap<String, ServiceInfo>(20);
_ListenerExecutor = Executors.newSingleThreadExecutor();
_jmDNSExecutor = Executors.newCachedThreadPool();
_timer = new Timer("Multihommed mDNS.Timer", true);
_serviceListeners = new ConcurrentHashMap<String, List<ServiceListener>>();
_typeListeners = Collections.synchronizedSet(new HashSet<ServiceTypeListener>());
_serviceTypes = Collections.synchronizedSet(new HashSet<String>());
(new NetworkChecker(this, NetworkTopologyDiscovery.Factory.getInstance())).start(_timer);
_isClosing = new AtomicBoolean(false);
_closed = new AtomicBoolean(false);
}
示例2: inetAddressRemoved
import javax.jmdns.NetworkTopologyListener; //导入依赖的package包/类
@Override
public void inetAddressRemoved(NetworkTopologyEvent event) {
InetAddress address = event.getInetAddress();
try {
synchronized (this) {
if (_knownMDNS.containsKey(address)) {
JmDNS mDNS = _knownMDNS.remove(address);
mDNS.close();
final NetworkTopologyEvent jmdnsEvent = new NetworkTopologyEventImpl(mDNS, address);
for (final NetworkTopologyListener listener : this.networkListeners()) {
_ListenerExecutor.submit(new Runnable() {
/**
* {@inheritDoc}
*/
@Override
public void run() {
listener.inetAddressRemoved(jmdnsEvent);
}
});
}
}
}
} catch (Exception e) {
logger.warning("Unexpected unhandled exception: " + e);
}
}
示例3: inetAddressAdded
import javax.jmdns.NetworkTopologyListener; //导入依赖的package包/类
@Override
public void inetAddressAdded(NetworkTopologyEvent event) {
InetAddress address = event.getInetAddress();
try {
synchronized (this) {
if (!_knownMDNS.containsKey(address)) {
_knownMDNS.put(address, JmDNS.create(address));
final NetworkTopologyEvent jmdnsEvent = new NetworkTopologyEventImpl(_knownMDNS.get(address), address);
for (final NetworkTopologyListener listener : this.networkListeners()) {
_ListenerExecutor.submit(new Runnable() {
/**
* {@inheritDoc}
*/
@Override
public void run() {
listener.inetAddressAdded(jmdnsEvent);
}
});
}
}
}
} catch (Exception e) {
logger.warning("Unexpected unhandled exception: " + e);
}
}
示例4: JmmDNSImpl
import javax.jmdns.NetworkTopologyListener; //导入依赖的package包/类
/**
*
*/
public JmmDNSImpl() {
super();
_networkListeners = Collections.synchronizedSet(new HashSet<NetworkTopologyListener>());
_knownMDNS = new ConcurrentHashMap<InetAddress, JmDNS>();
_services = new ConcurrentHashMap<String, ServiceInfo>(20);
_listenerExecutor = Executors.newSingleThreadExecutor(new NamedThreadFactory("JmmDNS Listeners"));
_jmDNSExecutor = Executors.newCachedThreadPool(new NamedThreadFactory("JmmDNS"));
_timer = new Timer("Multihomed mDNS.Timer", true);
_serviceListeners = new ConcurrentHashMap<String, List<ServiceListener>>();
_typeListeners = Collections.synchronizedSet(new HashSet<ServiceTypeListener>());
_serviceTypes = Collections.synchronizedSet(new HashSet<String>());
(new NetworkChecker(this, NetworkTopologyDiscovery.Factory.getInstance())).start(_timer);
_isClosing = new AtomicBoolean(false);
_closed = new AtomicBoolean(false);
}
示例5: JmmDNSImpl
import javax.jmdns.NetworkTopologyListener; //导入依赖的package包/类
/**
*
*/
public JmmDNSImpl() {
super();
_networkListeners = Collections.synchronizedSet(new HashSet<NetworkTopologyListener>());
_knownMDNS = new ConcurrentHashMap<InetAddress, JmDNS>();
_services = new ConcurrentHashMap<String, ServiceInfo>(20);
_ListenerExecutor = Executors.newSingleThreadExecutor();
_jmDNSExecutor = Executors.newCachedThreadPool();
_timer = new Timer("Multihommed mDNS.Timer", true);
(new NetworkChecker(this, NetworkTopologyDiscovery.Factory.getInstance())).start(_timer);
}
示例6: inetAddressRemoved
import javax.jmdns.NetworkTopologyListener; //导入依赖的package包/类
@Override
public void inetAddressRemoved(NetworkTopologyEvent event) {
InetAddress address = event.getInetAddress();
try {
if (_knownMDNS.containsKey(address)) {
synchronized (_knownMDNS) {
if (_knownMDNS.containsKey(address)) {
JmDNS mDNS = _knownMDNS.remove(address);
mDNS.close();
final NetworkTopologyEvent jmdnsEvent = new NetworkTopologyEventImpl(mDNS, address);
for (final NetworkTopologyListener listener : this.networkListeners()) {
_listenerExecutor.submit(new Runnable() {
/**
* {@inheritDoc}
*/
@Override
public void run() {
listener.inetAddressRemoved(jmdnsEvent);
}
});
}
}
}
}
} catch (Exception e) {
logger.warning("Unexpected unhandled exception: " + e);
}
}
示例7: JmmDNSImpl
import javax.jmdns.NetworkTopologyListener; //导入依赖的package包/类
/**
*
*/
public JmmDNSImpl()
{
super();
_networkListeners = Collections.synchronizedSet(new HashSet<NetworkTopologyListener>());
_knownMDNS = new ConcurrentHashMap<InetAddress, JmDNS>();
_services = new ConcurrentHashMap<String, ServiceInfo>(20);
_ListenerExecutor = Executors.newSingleThreadExecutor();
_jmDNSExecutor = Executors.newCachedThreadPool();
_timer = new Timer("Multihommed mDNS.Timer", true);
(new NetworkChecker(this, NetworkTopologyDiscovery.Factory.getInstance())).start(_timer);
}
示例8: inetAddressAdded
import javax.jmdns.NetworkTopologyListener; //导入依赖的package包/类
@Override
public void inetAddressAdded(NetworkTopologyEvent event)
{
InetAddress address = event.getInetAddress();
try
{
synchronized (this)
{
if (!_knownMDNS.containsKey(address))
{
JmDNS mDNS = JmDNS.create(address);
_knownMDNS.put(address, mDNS);
final NetworkTopologyEvent jmdnsEvent = new NetworkTopologyEventImpl(mDNS, address);
for (final NetworkTopologyListener listener : this.networkListeners())
{
_ListenerExecutor.submit(new Runnable() {
/**
* {@inheritDoc}
*/
@Override
public void run()
{
listener.inetAddressAdded(jmdnsEvent);
}
});
}
}
}
}
catch (Exception e)
{
logger.warning("Unexpected unhandled exception: " + e);
}
}
示例9: inetAddressRemoved
import javax.jmdns.NetworkTopologyListener; //导入依赖的package包/类
@Override
public void inetAddressRemoved(NetworkTopologyEvent event)
{
InetAddress address = event.getInetAddress();
try
{
synchronized (this)
{
if (_knownMDNS.containsKey(address))
{
JmDNS mDNS = JmDNS.create(address);
_knownMDNS.remove(address);
mDNS.close();
final NetworkTopologyEvent jmdnsEvent = new NetworkTopologyEventImpl(mDNS, address);
for (final NetworkTopologyListener listener : this.networkListeners())
{
_ListenerExecutor.submit(new Runnable() {
/**
* {@inheritDoc}
*/
@Override
public void run()
{
listener.inetAddressRemoved(jmdnsEvent);
}
});
}
}
}
}
catch (Exception e)
{
logger.warning("Unexpected unhandled exception: " + e);
}
}
示例10: NetworkChecker
import javax.jmdns.NetworkTopologyListener; //导入依赖的package包/类
public NetworkChecker(NetworkTopologyListener mmDNS, NetworkTopologyDiscovery topology)
{
super();
this._mmDNS = mmDNS;
this._topology = topology;
_knownAddresses = Collections.synchronizedSet(new HashSet<InetAddress>());
}
示例11: NetworkTopologyEventImpl
import javax.jmdns.NetworkTopologyListener; //导入依赖的package包/类
NetworkTopologyEventImpl(NetworkTopologyListener jmmDNS, InetAddress inetAddress) {
super(jmmDNS);
this._inetAddress = inetAddress;
}
示例12: addNetworkTopologyListener
import javax.jmdns.NetworkTopologyListener; //导入依赖的package包/类
@Override
public void addNetworkTopologyListener(NetworkTopologyListener listener) {
_networkListeners.add(listener);
}
示例13: removeNetworkTopologyListener
import javax.jmdns.NetworkTopologyListener; //导入依赖的package包/类
@Override
public void removeNetworkTopologyListener(NetworkTopologyListener listener) {
_networkListeners.remove(listener);
}
示例14: networkListeners
import javax.jmdns.NetworkTopologyListener; //导入依赖的package包/类
@Override
public NetworkTopologyListener[] networkListeners() {
return _networkListeners.toArray(new NetworkTopologyListener[_networkListeners.size()]);
}
示例15: NetworkChecker
import javax.jmdns.NetworkTopologyListener; //导入依赖的package包/类
public NetworkChecker(NetworkTopologyListener mmDNS, NetworkTopologyDiscovery topology) {
super();
this._mmDNS = mmDNS;
this._topology = topology;
_knownAddresses = Collections.synchronizedSet(new HashSet<InetAddress>());
}