Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
37 changed files
with
336 additions
and
190 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
...nt/cassandra/service/ExhaustedPolicy.java → ...cassandra/connection/ExhaustedPolicy.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
117 changes: 117 additions & 0 deletions
117
api/src/main/java/me/prettyprint/cassandra/connection/HCassandraHost.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
package me.prettyprint.cassandra.connection; | ||
|
||
import java.net.InetAddress; | ||
import java.net.UnknownHostException; | ||
|
||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
/** | ||
* Encapsulates the information required for connecting to a Cassandra host. | ||
* Also exposes pool configuration parameters for that host. | ||
* | ||
* @author zznate(nate@riptano.com) | ||
* | ||
*/ | ||
public interface HCassandraHost { | ||
|
||
|
||
/** | ||
* The default port number to which we will connect | ||
*/ | ||
public static final int DEFAULT_PORT = 9160; | ||
|
||
public static final int DEFAULT_MAX_ACTIVE = 50; | ||
|
||
/** | ||
* By default, we will use TSocket transport on thrift (matches default Cassandra configs) | ||
*/ | ||
public static final boolean DEFAULT_USE_FRAMED_THRIFT_TRANSPORT = true; | ||
|
||
/** | ||
* The default max wait time when exhausted happens, default value is negative, which means | ||
* it'll block indefinitely. | ||
*/ | ||
public static final long DEFAULT_MAX_WAITTIME_WHEN_EXHAUSTED = -1; | ||
|
||
/** | ||
* The default max idle number determines how many idle connections may reside in the pool. | ||
* If -1 then it's infinity. | ||
*/ | ||
public static final int DEFAULT_MAX_IDLE = -1; | ||
|
||
public static final boolean DEFAULT_LIFO = true; | ||
public static final long DEFAULT_MIN_EVICTABLE_IDLE_TIME_MILLIS = 18000000; | ||
public static final long DEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLIS = -1; | ||
|
||
|
||
public String getUrl(); | ||
|
||
/** | ||
* Checks whether name resolution should occur. | ||
* | ||
* @return | ||
*/ | ||
public boolean isPerformNameResolution(); | ||
|
||
public String getName(); | ||
|
||
public String getHost(); | ||
|
||
public String getIp(); | ||
|
||
public int getPort(); | ||
|
||
@Override | ||
public String toString(); | ||
|
||
/** | ||
* Returns true if the ip and port are equal | ||
*/ | ||
@Override | ||
public boolean equals(Object obj); | ||
|
||
@Override | ||
public int hashCode(); | ||
|
||
public int getMaxActive(); | ||
|
||
public void setMaxActive(int maxActive); | ||
|
||
public int getMaxIdle(); | ||
|
||
public void setMaxIdle(int maxIdle); | ||
|
||
public long getMaxWaitTimeWhenExhausted(); | ||
|
||
public void setMaxWaitTimeWhenExhausted(long maxWaitTimeWhenExhausted); | ||
|
||
public ExhaustedPolicy getExhaustedPolicy(); | ||
|
||
public void setExhaustedPolicy(ExhaustedPolicy exhaustedPolicy); | ||
|
||
public int getCassandraThriftSocketTimeout(); | ||
|
||
public void setCassandraThriftSocketTimeout(int cassandraThriftSocketTimeout); | ||
|
||
public boolean getUseThriftFramedTransport(); | ||
|
||
public void setUseThriftFramedTransport(boolean useThriftFramedTransport); | ||
|
||
public boolean getLifo(); | ||
|
||
public void setLifo(boolean lifo); | ||
|
||
public long getMinEvictableIdleTimeMillis(); | ||
|
||
public void setMinEvictableIdleTimeMillis(long minEvictableIdleTimeMillis); | ||
|
||
public long getTimeBetweenEvictionRunsMillis(); | ||
|
||
public void setTimeBetweenEvictionRunsMillis(long timeBetweenEvictionRunsMillis); | ||
|
||
public boolean getUseSocketKeepalive(); | ||
|
||
public void setUseSocketKeepalive(boolean useSocketKeepalive); | ||
|
||
} |
3 changes: 1 addition & 2 deletions
3
...int/cassandra/connection/HClientPool.java → ...int/cassandra/connection/HClientPool.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
api/src/main/java/me/prettyprint/cassandra/connection/HThriftClient.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package me.prettyprint.cassandra.connection; | ||
|
||
import org.apache.cassandra.thrift.Cassandra; | ||
|
||
|
||
public interface HThriftClient { | ||
|
||
/** | ||
* Returns a new Cassandra.Client on each invocation using the underlying transport | ||
* | ||
*/ | ||
public Cassandra.Client getCassandra(); | ||
|
||
public Cassandra.Client getCassandra(String keyspaceNameArg); | ||
|
||
HThriftClient close(); | ||
|
||
|
||
HThriftClient open(); | ||
|
||
|
||
boolean isOpen(); | ||
|
||
/** | ||
* If CassandraHost was not null we use {@link CassandraHost#getCassandraThriftSocketTimeout()} | ||
* if it was greater than zero. Otherwise look for an environment | ||
* variable name CASSANDRA_THRIFT_SOCKET_TIMEOUT value. | ||
* If doesn't exist, returns 0. | ||
* @param cassandraHost | ||
*/ | ||
public int getTimeout(HCassandraHost cassandraHost); | ||
|
||
public void startToUse(); | ||
|
||
/** | ||
* @return Time in MS since it was used. | ||
*/ | ||
public long getSinceLastUsed(); | ||
|
||
@Override | ||
public String toString(); | ||
|
||
/** | ||
* Compares the toString of these clients | ||
*/ | ||
@Override | ||
public boolean equals(Object obj); | ||
|
||
} |
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...t/cassandra/service/SystemProperties.java → .../prettyprint/hector/SystemProperties.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 0 additions & 5 deletions
5
api/src/main/java/me/prettyprint/hector/api/ClockResolution.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.