Package com.microsoft.sqlserver.jdbc.dns
Class DNSRecordSRV
- java.lang.Object
-
- com.microsoft.sqlserver.jdbc.dns.DNSRecordSRV
-
- All Implemented Interfaces:
Comparable<DNSRecordSRV>
public class DNSRecordSRV extends Object implements Comparable<DNSRecordSRV>
Represents a DNS SRV Record.
-
-
Constructor Summary
Constructors Constructor Description DNSRecordSRV(int priority, int weight, int port, String serverName)
Constructs a DNSRecordSRV.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(DNSRecordSRV o)
boolean
equals(Object other)
int
getPort()
Returns the IP port of record.int
getPriority()
Returns the priority of DNS SRV record.String
getServerName()
Returns the DNS server name.int
getWeight()
Returns the weight of DNS record from 0 to 65535.int
hashCode()
static DNSRecordSRV
parseFromDNSRecord(String record)
Parses a DNS SRC Record from a DNS String record.String
toString()
-
-
-
Constructor Detail
-
DNSRecordSRV
public DNSRecordSRV(int priority, int weight, int port, String serverName)
Constructs a DNSRecordSRV.- Parameters:
priority
- is lowestweight
- 1 at minimumport
- the port of serviceserverName
- the host- Throws:
IllegalArgumentException
- if priority < 0 or weight <= 1
-
-
Method Detail
-
parseFromDNSRecord
public static DNSRecordSRV parseFromDNSRecord(String record)
Parses a DNS SRC Record from a DNS String record.- Parameters:
record
- the record to parse- Returns:
- a not null DNS Record
- Throws:
IllegalArgumentException
- if record is not correct and cannot be parsed
-
compareTo
public int compareTo(DNSRecordSRV o)
- Specified by:
compareTo
in interfaceComparable<DNSRecordSRV>
-
getPriority
public int getPriority()
Returns the priority of DNS SRV record.- Returns:
- a positive priority, where lowest values have to be considered first.
-
getWeight
public int getWeight()
Returns the weight of DNS record from 0 to 65535.- Returns:
- The weight, higher value means higher probability of selecting the given record for a given priority.
-
getPort
public int getPort()
Returns the IP port of record.- Returns:
- a value from 1 to 65535.
-
getServerName
public String getServerName()
Returns the DNS server name.- Returns:
- a not null server name.
-
-