本文整理汇总了Java中javax.jmdns.impl.tasks.resolver.ServiceResolver类的典型用法代码示例。如果您正苦于以下问题:Java ServiceResolver类的具体用法?Java ServiceResolver怎么用?Java ServiceResolver使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ServiceResolver类属于javax.jmdns.impl.tasks.resolver包,在下文中一共展示了ServiceResolver类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: renewServiceCollector
import javax.jmdns.impl.tasks.resolver.ServiceResolver; //导入依赖的package包/类
/**
* Renew a service when the record become stale. If there is no service collector for the type this method does nothing.
*
* @param record
* DNS record
*/
public void renewServiceCollector(DNSRecord record)
{
ServiceInfo info = record.getServiceInfo();
if (_serviceCollectors.containsKey(info.getType().toLowerCase()))
{
// Create/start ServiceResolver
new ServiceResolver(this, info.getType()).start(_timer);
}
}
示例2: startServiceResolver
import javax.jmdns.impl.tasks.resolver.ServiceResolver; //导入依赖的package包/类
@Override
public void startServiceResolver(String type) {
new ServiceResolver(_jmDNSImpl, type).start(_timer);
}
示例3: addServiceListener
import javax.jmdns.impl.tasks.resolver.ServiceResolver; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void addServiceListener(String type, ServiceListener listener)
{
ServiceListenerStatus status = new ServiceListenerStatus(listener);
final String lotype = type.toLowerCase();
List<ServiceListenerStatus> list = _serviceListeners.get(lotype);
if (list == null)
{
if (_serviceListeners.putIfAbsent(lotype, new LinkedList<ServiceListenerStatus>()) == null)
{
if (_serviceCollectors.putIfAbsent(lotype, new ServiceCollector(lotype)) == null)
{
this.addServiceListener(lotype, _serviceCollectors.get(lotype));
}
}
list = _serviceListeners.get(lotype);
}
if (list != null)
{
synchronized (list)
{
if (!list.contains(listener))
{
list.add(status);
}
}
}
// report cached service types
final List<ServiceEvent> serviceEvents = new ArrayList<ServiceEvent>();
Collection<DNSEntry> dnsEntryLits = this.getCache().allValues();
for (DNSEntry entry : dnsEntryLits)
{
final DNSRecord record = (DNSRecord) entry;
if (record.getRecordType() == DNSRecordType.TYPE_SRV)
{
if (record.getName().endsWith(type))
{
// Do not used the record embedded method for generating event this will not work.
// serviceEvents.add(record.getServiceEvent(this));
serviceEvents.add(new ServiceEventImpl(this, type, toUnqualifiedName(type, record.getName()), record.getServiceInfo()));
}
}
}
// Actually call listener with all service events added above
for (ServiceEvent serviceEvent : serviceEvents)
{
status.serviceAdded(serviceEvent);
}
// Create/start ServiceResolver
new ServiceResolver(this, type).start(_timer);
}