public class RegistryDNS extends org.apache.hadoop.service.AbstractService implements DNSOperations, ZoneSelector
Modifier and Type | Class and Description |
---|---|
static class |
RegistryDNS.CloseableLock
An implementation allowing for obtaining and releasing a lock.
|
Modifier and Type | Field and Description |
---|---|
static String |
CONTAINER |
static String |
IN_ADDR_ARPA |
static String |
ZONE_SUFFIX |
Constructor and Description |
---|
RegistryDNS(String name)
Construct the service.
|
Modifier and Type | Method and Description |
---|---|
void |
addNIOTCP(InetAddress addr,
int port)
Create the thread (Callable) monitoring the TCP listener.
|
void |
addNIOUDP(InetAddress addr,
int port)
Create the thread monitoring the socket for inbound UDP requests.
|
protected void |
addSplitReverseZones(org.apache.hadoop.conf.Configuration conf,
int subnetCount)
Create the zones based on the zone count.
|
void |
delete(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(SocketChannel ch)
Process a TCP request.
|
void |
register(String path,
ServiceRecord record)
Register DNS records based on the provided service record.
|
void |
serveNIOTCP(ServerSocketChannel serverSocketChannel,
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, waitForServiceToStop
public static final String CONTAINER
public static final String IN_ADDR_ARPA
public static final String ZONE_SUFFIX
public RegistryDNS(String name)
name
- service namepublic void initializeChannels(org.apache.hadoop.conf.Configuration conf) throws Exception
Exception
protected void serviceInit(org.apache.hadoop.conf.Configuration conf) throws Exception
serviceInit
in class org.apache.hadoop.service.AbstractService
conf
- the hadoop configurationException
- if there are tcp/udp issuesprotected int getZoneCount()
protected void addSplitReverseZones(org.apache.hadoop.conf.Configuration conf, int subnetCount) throws IOException
conf
- the Hadoop configuration.subnetCount
- number of subnets to create reverse zones for.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.protected void setDNSSECEnabled(org.apache.hadoop.conf.Configuration conf)
conf
- the Hadoop configuration.protected void serviceStop() throws Exception
serviceStop
in class org.apache.hadoop.service.AbstractService
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(SocketChannel ch) throws IOException
ch
- the socket channel for the request.IOException
- if the tcp processing generates an issue.public void serveNIOTCP(ServerSocketChannel serverSocketChannel, InetAddress addr, int port) throws Exception
serverSocketChannel
- the server socket channeladdr
- the local inet addressport
- the listener (local) portException
- if the tcp processing fails.public void addNIOTCP(InetAddress addr, int port) throws Exception
addr
- host address.port
- host port.Exception
- if the tcp listener generates an error.public void addNIOUDP(InetAddress addr, int port) throws Exception
addr
- host address.port
- host port.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 ZoneSelector
name
- the name to be matched to a zone.public void register(String path, ServiceRecord record) throws IOException
register
in interface DNSOperations
path
- the ZK path of the service record.record
- record providing DNS registration info.IOException
- if registration causes an error.public void delete(String path, ServiceRecord record) throws IOException
delete
in interface DNSOperations
path
- the ZK path for the given record.record
- the service recordIOException
- if deletion causes and error.Copyright © 2008–2019 Apache Software Foundation. All rights reserved.