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 int DEFAULT_MAX_IDLE
          The default max idle number determines how many idle connections may reside in the pool.
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 long DEFAULT_MIN_EVICTABLE_IDLE_TIME_MILLIS
           
static int DEFAULT_PORT
          The default port number to which we will connect
static long DEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLIS
           
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()
           
 ExhaustedPolicy getExhaustedPolicy()
           
 String getHost()
           
 String getIp()
           
 boolean getLifo()
           
 int getMaxActive()
           
 int getMaxIdle()
           
 long getMaxWaitTimeWhenExhausted()
           
 long getMinEvictableIdleTimeMillis()
           
 String getName()
           
 int getPort()
           
 long getTimeBetweenEvictionRunsMillis()
           
 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 setExhaustedPolicy(ExhaustedPolicy exhaustedPolicy)
           
 void setLifo(boolean lifo)
           
 void setMaxActive(int maxActive)
           
 void setMaxIdle(int maxIdle)
           
 void setMaxWaitTimeWhenExhausted(long maxWaitTimeWhenExhausted)
           
 void setMinEvictableIdleTimeMillis(long minEvictableIdleTimeMillis)
           
 void setTimeBetweenEvictionRunsMillis(long timeBetweenEvictionRunsMillis)
           
 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_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_MAX_IDLE

public static final int DEFAULT_MAX_IDLE
The default max idle number determines how many idle connections may reside in the pool. If -1 then it's infinity.

See Also:
Constant Field Values

DEFAULT_LIFO

public static final boolean DEFAULT_LIFO
See Also:
Constant Field Values

DEFAULT_MIN_EVICTABLE_IDLE_TIME_MILLIS

public static final long DEFAULT_MIN_EVICTABLE_IDLE_TIME_MILLIS
See Also:
Constant Field Values

DEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLIS

public static final long DEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLIS
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)

getMaxIdle

public int getMaxIdle()

setMaxIdle

public void setMaxIdle(int maxIdle)

getMaxWaitTimeWhenExhausted

public long getMaxWaitTimeWhenExhausted()

setMaxWaitTimeWhenExhausted

public void setMaxWaitTimeWhenExhausted(long maxWaitTimeWhenExhausted)

getExhaustedPolicy

public ExhaustedPolicy getExhaustedPolicy()

setExhaustedPolicy

public void setExhaustedPolicy(ExhaustedPolicy exhaustedPolicy)

getCassandraThriftSocketTimeout

public int getCassandraThriftSocketTimeout()

setCassandraThriftSocketTimeout

public void setCassandraThriftSocketTimeout(int cassandraThriftSocketTimeout)

getUseThriftFramedTransport

public boolean getUseThriftFramedTransport()

setUseThriftFramedTransport

public void setUseThriftFramedTransport(boolean useThriftFramedTransport)

parseHostFromUrl

public static String parseHostFromUrl(String urlPort)

parsePortFromUrl

public static int parsePortFromUrl(String urlPort)

getLifo

public boolean getLifo()

setLifo

public void setLifo(boolean lifo)

getMinEvictableIdleTimeMillis

public long getMinEvictableIdleTimeMillis()

setMinEvictableIdleTimeMillis

public void setMinEvictableIdleTimeMillis(long minEvictableIdleTimeMillis)

getTimeBetweenEvictionRunsMillis

public long getTimeBetweenEvictionRunsMillis()

setTimeBetweenEvictionRunsMillis

public void setTimeBetweenEvictionRunsMillis(long timeBetweenEvictionRunsMillis)

getUseSocketKeepalive

public boolean getUseSocketKeepalive()

setUseSocketKeepalive

public void setUseSocketKeepalive(boolean useSocketKeepalive)


Copyright © 2011. All Rights Reserved.