Package com.microsoft.sqlserver.jdbc.dns
Class DNSRecordSRV
java.lang.Object
com.microsoft.sqlserver.jdbc.dns.DNSRecordSRV
- All Implemented Interfaces:
Comparable<DNSRecordSRV>
Represents a DNS SRV Record.
-
Constructor Summary
ConstructorsConstructorDescriptionDNSRecordSRV(int priority, int weight, int port, String serverName)Constructs a DNSRecordSRV. -
Method Summary
Modifier and TypeMethodDescriptionintbooleanintgetPort()Returns the IP port of record.intReturns the priority of DNS SRV record.Returns the DNS server name.intReturns the weight of DNS record from 0 to 65535.inthashCode()static DNSRecordSRVparseFromDNSRecord(String record)Parses a DNS SRC Record from a DNS String record.toString()
-
Constructor Details
-
DNSRecordSRV
public DNSRecordSRV(int priority, int weight, int port, String serverName) throws IllegalArgumentExceptionConstructs a DNSRecordSRV.- Parameters:
priority- is lowestweight- 1 at minimumport- the port of serviceserverName- the host- Throws:
IllegalArgumentException- if priority < 0 or weight <= 1
-
-
Method Details
-
parseFromDNSRecord
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
-
toString
-
hashCode
public int hashCode() -
equals
-
compareTo
- Specified by:
compareToin 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
Returns the DNS server name.- Returns:
- a not null server name.
-