/** * Performs the query, and executes the callback. */ public void run() { try { Message response = res.send(query); listener.receiveMessage(id, response); } catch (Exception e) { listener.handleException(id, e); } }
/** * Performs the query, and executes the callback. */ public void run() { try { Message response = res.send(query); listener.receiveMessage(id, response); } catch (Exception e) { listener.handleException(id, e); } }
/** * Performs the query, and executes the callback. */ public void run() { try { Message response = res.send(query); listener.receiveMessage(id, response); } catch (Exception e) { listener.handleException(id, e); } }
/** * Performs the query, and executes the callback. */ public void run() { try { Message response = res.send(query); listener.receiveMessage(id, response); } catch (Exception e) { listener.handleException(id, e); } }
outstanding++; inprogress[0] = new Object(); return resolvers[0].send(query);
outstanding++; inprogress[0] = new Object(); return resolvers[0].send(query);
private void doDelete(AdapterOperation op) { try { DnsRecord record = m_nodeDnsRecordMap.get(Integer.valueOf(op.getNodeId())); if (record != null) { Update update = new Update(Name.fromString(record.getZone())); update.delete(Name.fromString(record.getHostname()), Type.A); m_resolver.send(update); m_nodeDnsRecordMap.remove(Integer.valueOf(op.getNodeId())); } } catch (Throwable e) { LOG.error("deleteNode: Error handling node deleted event.", e); sendAndThrow(op.getNodeId(), e); } }
Message response = resolver.send(newQuery(record));
Message response = resolver.send(newQuery(record));
private void doUpdate(AdapterOperation op) { OnmsNode node = null; LOG.debug("doUpdate: operation: {}", op.getType().name()); try { node = m_nodeDao.get(op.getNodeId()); if (node == null) { doDelete(op); return; } DnsRecord record = new DnsRecord(node,m_level); LOG.debug("doUpdate: DnsRecord: hostname: {} zone: {} ip address {}", record.getIp().getHostAddress(), record.getHostname(), record.getZone()); DnsRecord oldRecord = m_nodeDnsRecordMap.get(Integer.valueOf(node.getId())); Update update = new Update(Name.fromString(record.getZone())); if (oldRecord != null && oldRecord.getHostname() != record.getHostname()) { update.delete(Name.fromString(oldRecord.getHostname()), Type.A); } update.replace(Name.fromString(record.getHostname()), Type.A, 3600, record.getIp().getHostAddress()); m_resolver.send(update); m_nodeDnsRecordMap.put(Integer.valueOf(op.getNodeId()), record); } catch (Throwable e) { LOG.error("addNode: Error handling node added event.", e); sendAndThrow(op.getNodeId(), e); } }
private void doUpdate(AdapterOperation op) { LOG.debug("doUpdate: operation: {}", op.getType().name()); for (ReverseDnsRecord record : m_reverseDnsProvisioningAdapterService.get(op.getNodeId()) ) { LOG.debug("doUpdate: ReverseDnsRecord: hostname: {} zone: {} ip address: {}", record.getIp().getHostAddress(), record.getHostname(), record.getZone()); try { Update update = new Update(Name.fromString(record.getZone())); Name ptrRecord=ReverseMap.fromAddress(record.getIp()); update.replace(ptrRecord, Type.PTR, 3600, record.getHostname()); m_resolver.send(update); m_reverseDnsProvisioningAdapterService.update(op.getNodeId(),record); } catch (Exception e) { LOG.error("updateNode: Error handling updated event.", e); sendAndThrow(op.getNodeId(), e); } } }
Record rec = Record.newRecord(name, Type.A, DClass.IN); Message query = Message.newQuery(rec); Message response = res.send(query);
if (res == null) res = new SimpleResolver(server); response = res.send(newQuery); print(response);
Message response = null; try { response = resolver.send(query);
Message response = null; try { response = resolver.send(query);
Message response = null; try { response = resolver.send(query);
Message response = null; try { response = resolver.send(query);
public static String reverseDns(String hostIp) throws IOException { Resolver res = new ExtendedResolver(); // set the timeout, defaults to 200 milliseconds int timeout = ConfigurationManager.getIntProperty("solr-statistics", "resolver.timeout", 200); res.setTimeout(0, timeout); Name name = ReverseMap.fromAddress(hostIp); int type = Type.PTR; int dclass = DClass.IN; Record rec = Record.newRecord(name, type, dclass); Message query = Message.newQuery(rec); Message response = res.send(query); Record[] answers = response.getSectionArray(Section.ANSWER); if (answers.length == 0) { return hostIp; } else { return answers[0].rdataToString(); } } }
/** * Resolve an IP address to a host name. * * @param hostIp dotted decimal IPv4 address. * @return name if resolved, or the address. * @throws IOException from infrastructure. */ public static String reverseDns(String hostIp) throws IOException { Resolver res = new ExtendedResolver(); // set the timeout, defaults to 200 milliseconds int timeout = ConfigurationManager.getIntProperty("usage-statistics", "resolver.timeout", 200); res.setTimeout(0, timeout); Name name = ReverseMap.fromAddress(hostIp); int type = Type.PTR; int dclass = DClass.IN; Record rec = Record.newRecord(name, type, dclass); Message query = Message.newQuery(rec); Message response = res.send(query); Record[] answers = response.getSectionArray(Section.ANSWER); if (answers.length == 0) { return hostIp; } else { return answers[0].rdataToString(); } }
response = res.send(query); print(response);