Package org.mariadb.jdbc

## Class HostAddress

- java.lang.Object
- - org.mariadb.jdbc.HostAddress

    public class HostAddress
    extends Object

Host entry

### Field Summary

Fields
`String` `host` host address
`String` `localSocket`
`String` `pipe`
`int` `port` port
`Boolean` `primary` primary node
`SslMode` `sslMode`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`boolean` `equals​(Object o)`
`void` `forceThreadsConnected​(long threadsConnected, long threadConnectedTimeout)`
`static HostAddress` `from​(String host, int port)` Create a Host without knowledge of primary/replica goal
`static HostAddress` `from​(String host, int port, boolean primary)` Create a Host
`static HostAddress` `from​(String host, int port, boolean primary, String sslMode)` Create a Host
`static HostAddress` `from​(String host, int port, String sslMode)` Create a Host
`Long` `getThreadConnectedTimeout()`
`Long` `getThreadsConnected()`
`int` `hashCode()`
`static HostAddress` `localSocket​(String localSocket)` Constructor for unix socket host
`static List<HostAddress>` `parse​(String spec, HaMode haMode)` parse - parse server addresses from the URL fragment.
`static HostAddress` `pipe​(String pipe)` Constructor for windows pipe host
`void` `setThreadsConnected​(long threadsConnected)`
`String` `toString()`
`HostAddress` `withLocalSocket​(String localSocket)`
`HostAddress` `withPipe​(String pipe)`
`HostAddress` `withPort​(int port)`

### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

### Field Detail

#### host

    public final String host

host address

#### port

    public final int port

port

#### pipe

    public final String pipe

#### sslMode

    public final SslMode sslMode

#### localSocket

    public final String localSocket

#### primary

    public Boolean primary

primary node

### Method Detail

#### from

    public static HostAddress from​(String host,
                                   int port)

Create a Host without knowledge of primary/replica goal

Parameters:
  `host` - host (DNS/IP)
  `port` - port
Returns:
  host

#### pipe

    public static HostAddress pipe​(String pipe)

Constructor for windows pipe host

Parameters:
  `pipe` - windows pipe path
Returns:
  hostAddress

#### localSocket

    public static HostAddress localSocket​(String localSocket)

Constructor for unix socket host

Parameters:
  `localSocket` - unix socket path
Returns:
  hostAddress

#### from

    public static HostAddress from​(String host,
                                   int port,
                                   boolean primary)

Create a Host

Parameters:
  `host` - host (DNS/IP)
  `port` - port
  `primary` - is primary
Returns:
  host

#### from

    public static HostAddress from​(String host,
                                   int port,
                                   String sslMode)

Create a Host

Parameters:
  `host` - host (DNS/IP)
  `port` - port
  `sslMode` - ssl mode
Returns:
  host

#### from

    public static HostAddress from​(String host,
                                   int port,
                                   boolean primary,
                                   String sslMode)

Create a Host

Parameters:
  `host` - host (DNS/IP)
  `port` - port
  `primary` - is primary
  `sslMode` - ssl mode
Returns:
  host

#### parse

    public static List<HostAddress> parse​(String spec,
                                          HaMode haMode)
                                   throws SQLException

parse - parse server addresses from the URL fragment.

Parameters:
  `spec` - list of endpoints in one of the forms 1 - host1,....,hostN:port (missing port default to MariaDB default 3306 2 - host:port,...,host:port
  `haMode` - High availability mode
Returns:
  parsed endpoints
Throws:
  `SQLException` - for wrong spec

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`

#### equals

    public boolean equals​(Object o)

Overrides:
  `equals` in class `Object`

#### hashCode

    public int hashCode()

Overrides:
  `hashCode` in class `Object`

#### getThreadsConnected

    public Long getThreadsConnected()

#### setThreadsConnected

    public void setThreadsConnected​(long threadsConnected)

#### forceThreadsConnected

    public void forceThreadsConnected​(long threadsConnected,
                                      long threadConnectedTimeout)

#### withPipe

    public HostAddress withPipe​(String pipe)

#### withLocalSocket

    public HostAddress withLocalSocket​(String localSocket)

#### withPort

    public HostAddress withPort​(int port)

#### getThreadConnectedTimeout

    public Long getThreadConnectedTimeout()