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


Java DNSRecordType.TYPE_SRV属性代码示例

本文整理汇总了Java中javax.jmdns.impl.constants.DNSRecordType.TYPE_SRV属性的典型用法代码示例。如果您正苦于以下问题:Java DNSRecordType.TYPE_SRV属性的具体用法?Java DNSRecordType.TYPE_SRV怎么用?Java DNSRecordType.TYPE_SRV使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在javax.jmdns.impl.constants.DNSRecordType的用法示例。


在下文中一共展示了DNSRecordType.TYPE_SRV属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addServiceListener

private void addServiceListener(String type, ServiceListener listener, boolean synch) {
    ServiceListenerStatus status = new ServiceListenerStatus(listener, synch);
    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(type)) == null) {
                // We have a problem here. The service collectors must be called synchronously so that their cache get cleaned up immediately or we will report .
                this.addServiceListener(loType, _serviceCollectors.get(loType), ListenerStatus.SYNCHONEOUS);
            }
        }
        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.getKey().endsWith(loType)) {
                // Do not used the record embedded method for generating event this will not work.
                // serviceEvents.add(record.getServiceEvent(this));
                serviceEvents.add(new ServiceEventImpl(this, record.getType(), toUnqualifiedName(record.getType(), record.getName()), record.getServiceInfo()));
            }
        }
    }
    // Actually call listener with all service events added above
    for (ServiceEvent serviceEvent : serviceEvents) {
        status.serviceAdded(serviceEvent);
    }
    // Create/start ServiceResolver
    this.startServiceResolver(type);
}
 
开发者ID:iilxy,项目名称:AndroidmDNS,代码行数:40,代码来源:JmDNSImpl.java

示例2: Service

public Service(String name, DNSRecordClass recordClass, boolean unique, int ttl, int priority, int weight, int port, String server) {
    super(name, DNSRecordType.TYPE_SRV, recordClass, unique, ttl);
    this._priority = priority;
    this._weight = weight;
    this._port = port;
    this._server = server;
}
 
开发者ID:iilxy,项目名称:AndroidmDNS,代码行数:7,代码来源:DNSRecord.java

示例3: Service

public Service(String name, DNSRecordClass recordClass, boolean unique, int ttl, int priority, int weight, int port, String server)
{
    super(name, DNSRecordType.TYPE_SRV, recordClass, unique, ttl);
    this._priority = priority;
    this._weight = weight;
    this._port = port;
    this._server = server;
}
 
开发者ID:blackshadowwalker,项目名称:log4j-collector,代码行数:8,代码来源:DNSRecord.java

示例4: addServiceListener

/**
 * {@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);
}
 
开发者ID:blackshadowwalker,项目名称:log4j-collector,代码行数:54,代码来源:JmDNSImpl.java


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