me.prettyprint.cassandra.service
Class CassandraHost

java.lang.Object
  extended by me.prettyprint.cassandra.service.CassandraHost

public final class CassandraHost
extends Object

Encapsulates the information required for connecting to a Cassandra host. Also exposes pool configuration parameters for that host.

Author:
zznate(nate@riptano.com)

Field Summary
static boolean DEFAULT_LIFO
           
static int DEFAULT_MAX_ACTIVE
           
static long DEFAULT_MAX_CONNECT_TIME
          The default number of milliseconds (since creation time) we'll allow a connection to stay open.
static int DEFAULT_MAX_FRAME_SIZE
          By default, match TFramedTransport's default max frame size (Integer.MAX_VALUE).
static long DEFAULT_MAX_LAST_SUCCESS_TIME
          The default number of milliseconds (since last success) we'll allow a connection to stay open.
static long DEFAULT_MAX_WAITTIME_WHEN_EXHAUSTED
          The default max wait time when exhausted happens, default value is negative, which means it'll block indefinitely.
static int DEFAULT_PORT
          The default port number to which we will connect
static boolean DEFAULT_USE_FRAMED_THRIFT_TRANSPORT
          By default, we will use TSocket transport on thrift (matches default Cassandra configs)
 
Constructor Summary
CassandraHost(String url)
           
CassandraHost(String url2, int port)
           
 
Method Summary
 boolean equals(Object obj)
          Returns true if the ip and port are equal
 int getCassandraThriftSocketTimeout()
           
 String getHost()
           
 String getIp()
           
 boolean getLifo()
           
 int getMaxActive()
           
 long getMaxConnectTimeMillis()
           
 int getMaxFrameSize()
           
 long getMaxLastSuccessTimeMillis()
           
 long getMaxWaitTimeWhenExhausted()
           
 String getName()
           
 int getPort()
           
 String getUrl()
           
 boolean getUseSocketKeepalive()
           
 boolean getUseThriftFramedTransport()
           
 int hashCode()
           
 boolean isPerformNameResolution()
          Checks whether name resolution should occur.
static String parseHostFromUrl(String urlPort)
           
static int parsePortFromUrl(String urlPort)
           
 void setCassandraThriftSocketTimeout(int cassandraThriftSocketTimeout)
           
 void setLifo(boolean lifo)
           
 void setMaxActive(int maxActive)
           
 void setMaxConnectTimeMillis(long maxConnectTimeMillis)
           
 void setMaxFrameSize(int maxFrameSize)
           
 void setMaxLastSuccessTimeMillis(long maxLastSuccessTimeMillis)
           
 void setMaxWaitTimeWhenExhausted(long maxWaitTimeWhenExhausted)
           
 void setUseSocketKeepalive(boolean useSocketKeepalive)
           
 void setUseThriftFramedTransport(boolean useThriftFramedTransport)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_PORT

public static final int DEFAULT_PORT
The default port number to which we will connect

See Also:
Constant Field Values

DEFAULT_MAX_ACTIVE

public static final int DEFAULT_MAX_ACTIVE
See Also:
Constant Field Values

DEFAULT_USE_FRAMED_THRIFT_TRANSPORT

public static final boolean DEFAULT_USE_FRAMED_THRIFT_TRANSPORT
By default, we will use TSocket transport on thrift (matches default Cassandra configs)

See Also:
Constant Field Values

DEFAULT_MAX_FRAME_SIZE

public static final int DEFAULT_MAX_FRAME_SIZE
By default, match TFramedTransport's default max frame size (Integer.MAX_VALUE).

See Also:
Constant Field Values

DEFAULT_MAX_WAITTIME_WHEN_EXHAUSTED

public static final long DEFAULT_MAX_WAITTIME_WHEN_EXHAUSTED
The default max wait time when exhausted happens, default value is negative, which means it'll block indefinitely.

See Also:
Constant Field Values

DEFAULT_LIFO

public static final boolean DEFAULT_LIFO
See Also:
Constant Field Values

DEFAULT_MAX_CONNECT_TIME

public static final long DEFAULT_MAX_CONNECT_TIME
The default number of milliseconds (since creation time) we'll allow a connection to stay open. Default value is negative which means indefinitely.

See Also:
Constant Field Values

DEFAULT_MAX_LAST_SUCCESS_TIME

public static final long DEFAULT_MAX_LAST_SUCCESS_TIME
The default number of milliseconds (since last success) we'll allow a connection to stay open. Default value is negative which means indefinitely.

See Also:
Constant Field Values
Constructor Detail

CassandraHost

public CassandraHost(String url)

CassandraHost

public CassandraHost(String url2,
                     int port)
Method Detail

getUrl

public String getUrl()

isPerformNameResolution

public boolean isPerformNameResolution()
Checks whether name resolution should occur.

Returns:

getName

public String getName()

getHost

public String getHost()

getIp

public String getIp()

getPort

public int getPort()

toString

public String toString()
Overrides:
toString in class Object

equals

public boolean equals(Object obj)
Returns true if the ip and port are equal

Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

getMaxActive

public int getMaxActive()

setMaxActive

public void setMaxActive(int maxActive)

getMaxWaitTimeWhenExhausted

public long getMaxWaitTimeWhenExhausted()

setMaxWaitTimeWhenExhausted

public void setMaxWaitTimeWhenExhausted(long maxWaitTimeWhenExhausted)

getCassandraThriftSocketTimeout

public int getCassandraThriftSocketTimeout()

setCassandraThriftSocketTimeout

public void setCassandraThriftSocketTimeout(int cassandraThriftSocketTimeout)

getUseThriftFramedTransport

public boolean getUseThriftFramedTransport()

setUseThriftFramedTransport

public void setUseThriftFramedTransport(boolean useThriftFramedTransport)

getMaxFrameSize

public int getMaxFrameSize()

setMaxFrameSize

public void setMaxFrameSize(int maxFrameSize)

parseHostFromUrl

public static String parseHostFromUrl(String urlPort)

parsePortFromUrl

public static int parsePortFromUrl(String urlPort)

getLifo

public boolean getLifo()

setLifo

public void setLifo(boolean lifo)

getUseSocketKeepalive

public boolean getUseSocketKeepalive()

setUseSocketKeepalive

public void setUseSocketKeepalive(boolean useSocketKeepalive)

getMaxConnectTimeMillis

public long getMaxConnectTimeMillis()

setMaxConnectTimeMillis

public void setMaxConnectTimeMillis(long maxConnectTimeMillis)

getMaxLastSuccessTimeMillis

public long getMaxLastSuccessTimeMillis()

setMaxLastSuccessTimeMillis

public void setMaxLastSuccessTimeMillis(long maxLastSuccessTimeMillis)


Copyright © 2013. All Rights Reserved.