当前位置: 首页>>代码示例>>Java>>正文


Java NetworkTopologyListener类代码示例

本文整理汇总了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);
}
 
开发者ID:iilxy,项目名称:AndroidmDNS,代码行数:19,代码来源:JmmDNSImpl.java

示例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);
    }
}
 
开发者ID:iilxy,项目名称:AndroidmDNS,代码行数:27,代码来源:JmmDNSImpl.java

示例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);
    }
}
 
开发者ID:DeviceConnect,项目名称:DeviceConnect-Android,代码行数:26,代码来源:JmmDNSImpl.java

示例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);
}
 
开发者ID:JMRI,项目名称:EngineDriver,代码行数:19,代码来源:JmmDNSImpl.java

示例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);
}
 
开发者ID:DeviceConnect,项目名称:DeviceConnect-Android,代码行数:14,代码来源:JmmDNSImpl.java

示例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);
    }
}
 
开发者ID:JMRI,项目名称:EngineDriver,代码行数:29,代码来源:JmmDNSImpl.java

示例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);
}
 
开发者ID:blackshadowwalker,项目名称:log4j-collector,代码行数:15,代码来源:JmmDNSImpl.java

示例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);
    }
}
 
开发者ID:blackshadowwalker,项目名称:log4j-collector,代码行数:35,代码来源:JmmDNSImpl.java

示例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);
    }
}
 
开发者ID:blackshadowwalker,项目名称:log4j-collector,代码行数:36,代码来源:JmmDNSImpl.java

示例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>());
}
 
开发者ID:blackshadowwalker,项目名称:log4j-collector,代码行数:8,代码来源:JmmDNSImpl.java

示例11: NetworkTopologyEventImpl

import javax.jmdns.NetworkTopologyListener; //导入依赖的package包/类
NetworkTopologyEventImpl(NetworkTopologyListener jmmDNS, InetAddress inetAddress) {
    super(jmmDNS);
    this._inetAddress = inetAddress;
}
 
开发者ID:iilxy,项目名称:AndroidmDNS,代码行数:5,代码来源:NetworkTopologyEventImpl.java

示例12: addNetworkTopologyListener

import javax.jmdns.NetworkTopologyListener; //导入依赖的package包/类
@Override
public void addNetworkTopologyListener(NetworkTopologyListener listener) {
    _networkListeners.add(listener);
}
 
开发者ID:iilxy,项目名称:AndroidmDNS,代码行数:5,代码来源:JmmDNSImpl.java

示例13: removeNetworkTopologyListener

import javax.jmdns.NetworkTopologyListener; //导入依赖的package包/类
@Override
public void removeNetworkTopologyListener(NetworkTopologyListener listener) {
    _networkListeners.remove(listener);
}
 
开发者ID:iilxy,项目名称:AndroidmDNS,代码行数:5,代码来源:JmmDNSImpl.java

示例14: networkListeners

import javax.jmdns.NetworkTopologyListener; //导入依赖的package包/类
@Override
public NetworkTopologyListener[] networkListeners() {
    return _networkListeners.toArray(new NetworkTopologyListener[_networkListeners.size()]);
}
 
开发者ID:iilxy,项目名称:AndroidmDNS,代码行数:5,代码来源:JmmDNSImpl.java

示例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>());
}
 
开发者ID:iilxy,项目名称:AndroidmDNS,代码行数:7,代码来源:JmmDNSImpl.java


注:本文中的javax.jmdns.NetworkTopologyListener类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。