java.io.Closeable, java.lang.AutoCloseable, DNSOperations, ZoneSelector, org.apache.hadoop.service.Servicepublic class RegistryDNS extends org.apache.hadoop.service.AbstractService implements DNSOperations, ZoneSelector
| Modifier and Type | Class | Description |
|---|---|---|
static class |
RegistryDNS.CloseableLock |
An implementation allowing for obtaining and releasing a lock.
|
| Modifier and Type | Field | Description |
|---|---|---|
static java.lang.String |
CONTAINER |
|
static java.lang.String |
IN_ADDR_ARPA |
|
static java.lang.String |
ZONE_SUFFIX |
| Constructor | Description |
|---|---|
RegistryDNS(java.lang.String name) |
Construct the service.
|
| Modifier and Type | Method | Description |
|---|---|---|
void |
addNIOTCP(java.net.InetAddress addr,
int port) |
Create the thread (Callable) monitoring the TCP listener.
|
void |
addNIOUDP(java.net.InetAddress addr,
int port) |
Create the thread monitoring the socket for inbound UDP requests.
|
protected void |
addSplitReverseZones(org.apache.hadoop.conf.Configuration conf,
long subnetCount) |
Create the zones based on the zone count.
|
void |
delete(java.lang.String path,
ServiceRecord record) |
Delete the DNS records generated by the provided service record.
|
byte[] |
errorMessage(org.xbill.DNS.Message query,
int rcode) |
Generate an error message based on inbound query.
|
org.xbill.DNS.Zone |
findBestZone(org.xbill.DNS.Name name) |
Find the zone that correlates to the provided name.
|
org.xbill.DNS.RRset |
findExactMatch(org.xbill.DNS.Name name,
int type) |
Find the record set that matches the requested name and type.
|
byte[] |
formErrorMessage(byte[] in) |
Creates a DNS error response.
|
protected org.xbill.DNS.Record[] |
getRecords(org.xbill.DNS.Name name,
int type) |
Requests records for the given resource name.
|
protected org.xbill.DNS.Name |
getReverseZoneName(org.apache.hadoop.conf.Configuration conf) |
Returns the list of reverse lookup zones.
|
protected int |
getZoneCount() |
Return the number of zones in the map.
|
void |
initializeChannels(org.apache.hadoop.conf.Configuration conf) |
|
void |
nioTCPClient(java.nio.channels.SocketChannel ch) |
Process a TCP request.
|
void |
register(java.lang.String path,
ServiceRecord record) |
Register DNS records based on the provided service record.
|
void |
serveNIOTCP(java.nio.channels.ServerSocketChannel serverSocketChannel,
java.net.InetAddress addr,
int port) |
Monitor the TCP socket for inbound requests.
|
protected void |
serviceInit(org.apache.hadoop.conf.Configuration conf) |
Initializes the registry.
|
protected void |
serviceStop() |
Stops the registry.
|
protected void |
setDNSSECEnabled(org.apache.hadoop.conf.Configuration conf) |
Set the value of the DNSSEC enabled property.
|
protected void |
stopExecutor() |
Shuts down the leveraged executor service.
|
close, getBlockers, getConfig, getFailureCause, getFailureState, getLifecycleHistory, getName, getServiceState, getStartTime, init, isInState, noteFailure, putBlocker, registerGlobalListener, registerServiceListener, removeBlocker, serviceStart, setConfig, start, stop, toString, unregisterGlobalListener, unregisterServiceListener, waitForServiceToStoppublic static final java.lang.String CONTAINER
public static final java.lang.String IN_ADDR_ARPA
public static final java.lang.String ZONE_SUFFIX
public RegistryDNS(java.lang.String name)
name - service namepublic void initializeChannels(org.apache.hadoop.conf.Configuration conf)
throws java.lang.Exception
java.lang.Exceptionprotected void serviceInit(org.apache.hadoop.conf.Configuration conf)
throws java.lang.Exception
serviceInit in class org.apache.hadoop.service.AbstractServiceconf - the hadoop configurationjava.lang.Exception - if there are tcp/udp issues@VisibleForTesting protected int getZoneCount()
@VisibleForTesting
protected void addSplitReverseZones(org.apache.hadoop.conf.Configuration conf,
long subnetCount)
throws java.io.IOException
conf - the Hadoop configuration.subnetCount - number of subnets to create reverse zones for.java.io.IOException - if the DNSSEC key can not be read.protected org.xbill.DNS.Name getReverseZoneName(org.apache.hadoop.conf.Configuration conf)
conf - the hadoop configuration.@VisibleForTesting protected void setDNSSECEnabled(org.apache.hadoop.conf.Configuration conf)
conf - the Hadoop configuration.protected void serviceStop()
throws java.lang.Exception
serviceStop in class org.apache.hadoop.service.AbstractServicejava.lang.Exception - if the service stop generates an issue.protected void stopExecutor()
public byte[] formErrorMessage(byte[] in)
in - the byte array detailing the error.public void nioTCPClient(java.nio.channels.SocketChannel ch)
throws java.io.IOException
ch - the socket channel for the request.java.io.IOException - if the tcp processing generates an issue.public void serveNIOTCP(java.nio.channels.ServerSocketChannel serverSocketChannel,
java.net.InetAddress addr,
int port)
throws java.lang.Exception
serverSocketChannel - the server socket channeladdr - the local inet addressport - the listener (local) portjava.lang.Exception - if the tcp processing fails.public void addNIOTCP(java.net.InetAddress addr,
int port)
throws java.lang.Exception
addr - host address.port - host port.java.lang.Exception - if the tcp listener generates an error.public void addNIOUDP(java.net.InetAddress addr,
int port)
throws java.lang.Exception
addr - host address.port - host port.java.lang.Exception - if the UDP listener creation generates an error.public byte[] errorMessage(org.xbill.DNS.Message query,
int rcode)
query - the query.rcode - the response code for the specific error.protected org.xbill.DNS.Record[] getRecords(org.xbill.DNS.Name name,
int type)
name - - query stringtype - - type of DNS record to lookuppublic org.xbill.DNS.RRset findExactMatch(org.xbill.DNS.Name name,
int type)
name - the requested name.type - the record type.public org.xbill.DNS.Zone findBestZone(org.xbill.DNS.Name name)
findBestZone in interface ZoneSelectorname - the name to be matched to a zone.public void register(java.lang.String path,
ServiceRecord record)
throws java.io.IOException
register in interface DNSOperationspath - the ZK path of the service record.record - record providing DNS registration info.java.io.IOException - if registration causes an error.public void delete(java.lang.String path,
ServiceRecord record)
throws java.io.IOException
delete in interface DNSOperationspath - the ZK path for the given record.record - the service recordjava.io.IOException - if deletion causes and error.Copyright © 2008–2025 Apache Software Foundation. All rights reserved.