public class HThriftClient extends Object implements HClient
| Modifier and Type | Field and Description |
|---|---|
protected org.apache.cassandra.thrift.Cassandra.Client |
cassandraClient |
protected String |
keyspaceName |
protected int |
timeout |
protected org.apache.thrift.transport.TTransport |
transport |
| Constructor and Description |
|---|
HThriftClient(CassandraHost cassandraHost)
Constructor
|
HThriftClient(CassandraHost cassandraHost,
org.apache.thrift.transport.TSSLTransportFactory.TSSLTransportParameters params)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
clearAuthentication()
Clears current authentication
|
HThriftClient |
close()
Close this client and its underlying connection.
|
boolean |
equals(Object obj)
Compares the toString of these clients
|
org.apache.cassandra.thrift.Cassandra.Client |
getCassandra()
Returns a new Cassandra.Client on each invocation using the underlying
transport.
|
org.apache.cassandra.thrift.Cassandra.Client |
getCassandra(String keyspaceNameArg)
Returns a new Cassandra.Client on each invocation using the underlying
transport.
|
CassandraHost |
getCassandraHost()
Retrieves the CassandraHost associate to this client.
|
long |
getCreatedTime()
Returns the time that this HClient was created.
|
long |
getLastSuccessTime()
Retrieves the time of the last success in milliseconds.
|
long |
getSinceLastUsed()
Retrieves the time in milliseconds since this client was used last time.
|
boolean |
isAlreadyAuthenticated(Map<String,String> credentials)
Retrieves whether client has been authenticated with the given credentials.
|
boolean |
isOpen()
Retrieves whether the underlying connection for this client is open or not.
|
protected org.apache.thrift.transport.TTransport |
maybeWrapWithTFramedTransport(org.apache.thrift.transport.TTransport transport) |
HThriftClient |
open()
Open a connection for this client.
|
void |
setAuthenticated(Map<String,String> credentials)
Sets authentication credentials to the client.
|
void |
startToUse()
Start tracking the beginning of use for this client.
|
String |
toString() |
void |
updateLastSuccessTime()
Update the time of the last success with the current time.
|
protected final int timeout
protected String keyspaceName
protected org.apache.thrift.transport.TTransport transport
protected org.apache.cassandra.thrift.Cassandra.Client cassandraClient
public HThriftClient(CassandraHost cassandraHost)
cassandraHost - public HThriftClient(CassandraHost cassandraHost, org.apache.thrift.transport.TSSLTransportFactory.TSSLTransportParameters params)
cassandraHost - params - public org.apache.cassandra.thrift.Cassandra.Client getCassandra()
getCassandra in interface HClientpublic org.apache.cassandra.thrift.Cassandra.Client getCassandra(String keyspaceNameArg)
getCassandra in interface HClientkeyspaceNameArg - a keyspacepublic HThriftClient close()
public HThriftClient open()
protected org.apache.thrift.transport.TTransport maybeWrapWithTFramedTransport(org.apache.thrift.transport.TTransport transport)
public boolean isOpen()
public void startToUse()
HClient.getSinceLastUsed()startToUse in interface HClientpublic long getSinceLastUsed()
getSinceLastUsed in interface HClientpublic boolean equals(Object obj)
public CassandraHost getCassandraHost()
getCassandraHost in interface HClientCassandraHost object for this clientpublic boolean isAlreadyAuthenticated(Map<String,String> credentials)
isAlreadyAuthenticated in interface HClientcredentials - authentication credentialsTRUE if the client has previously been authenticated using the
credentials, FALSE otherwise (wrong credentials or not authenticated)public void clearAuthentication()
clearAuthentication in interface HClientpublic void setAuthenticated(Map<String,String> credentials)
setAuthenticated in interface HClientcredentials - credentials to be set.public long getCreatedTime()
getCreatedTime in interface HClientpublic long getLastSuccessTime()
getLastSuccessTime in interface HClientpublic void updateLastSuccessTime()
updateLastSuccessTime in interface HClientCopyright © 2014. All Rights Reserved.