本文整理汇总了Java中javax.jmdns.NetworkTopologyEvent.getInetAddress方法的典型用法代码示例。如果您正苦于以下问题:Java NetworkTopologyEvent.getInetAddress方法的具体用法?Java NetworkTopologyEvent.getInetAddress怎么用?Java NetworkTopologyEvent.getInetAddress使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.jmdns.NetworkTopologyEvent
的用法示例。
在下文中一共展示了NetworkTopologyEvent.getInetAddress方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: inetAddressRemoved
import javax.jmdns.NetworkTopologyEvent; //导入方法依赖的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);
}
}
示例2: inetAddressAdded
import javax.jmdns.NetworkTopologyEvent; //导入方法依赖的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);
}
}
示例3: inetAddressRemoved
import javax.jmdns.NetworkTopologyEvent; //导入方法依赖的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);
}
}
示例4: inetAddressAdded
import javax.jmdns.NetworkTopologyEvent; //导入方法依赖的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);
}
}
示例5: inetAddressRemoved
import javax.jmdns.NetworkTopologyEvent; //导入方法依赖的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);
}
}