voldemort.client
Class AbstractStoreClientFactory

java.lang.Object
  extended by voldemort.client.AbstractStoreClientFactory
All Implemented Interfaces:
StoreClientFactory
Direct Known Subclasses:
HttpStoreClientFactory, SocketStoreClientFactory

public abstract class AbstractStoreClientFactory
extends java.lang.Object
implements StoreClientFactory

A base class for various StoreClientFactory implementations


Field Summary
protected static ClusterMapper clusterMapper
           
static int DEFAULT_ROUTING_TIMEOUT_MS
           
protected  FailureDetector failureDetector
           
protected  int jmxId
           
protected static org.apache.log4j.Logger logger
           
 
Constructor Summary
AbstractStoreClientFactory(ClientConfig config)
           
 
Method Summary
 java.lang.String bootstrapMetadataWithRetries(java.lang.String key)
           
 java.lang.String bootstrapMetadataWithRetries(java.lang.String key, java.net.URI[] urls)
           
 void close()
          Close the store client
protected  java.lang.String getClientContext()
           
 Cluster getCluster()
           
protected  ClientConfig getConfig()
           
 int getCurrentJmxId()
           
 FailureDetector getFailureDetector()
          Returns the FailureDetector specific to the cluster against which this client factory is based.
 int getNextJmxId()
           
protected abstract  int getPort(Node node)
           
<K,V,T> Store<K,V,T>
getRawStore(java.lang.String storeName, InconsistencyResolver<Versioned<V>> resolver)
          Get the underlying store, not the public StoreClient interface
<K,V,T> Store<K,V,T>
getRawStore(java.lang.String storeName, InconsistencyResolver<Versioned<V>> resolver, java.lang.String customStoresXml, java.lang.String clusterXmlString, FailureDetector fd)
           
protected  java.util.List<Versioned<java.lang.String>> getRemoteMetadata(java.lang.String key, java.net.URI url)
           
 RequestFormatType getRequestFormatType()
           
 SerializerFactory getSerializerFactory()
           
protected abstract  Store<ByteArray,byte[],byte[]> getStore(java.lang.String storeName, java.lang.String host, int port, RequestFormatType type)
           
<K,V> StoreClient<K,V>
getStoreClient(java.lang.String storeName)
          Get a StoreClient for the given store.
<K,V> StoreClient<K,V>
getStoreClient(java.lang.String storeName, InconsistencyResolver<Versioned<V>> resolver)
          Get a StoreClient for the given store.
 java.util.List<StoreDefinition> getStoreDefs()
           
protected abstract  FailureDetector initFailureDetector(ClientConfig config, Cluster cluster)
           
protected abstract  void validateUrl(java.net.URI url)
           
 java.net.URI[] validateUrls(java.lang.String[] urls)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_ROUTING_TIMEOUT_MS

public static final int DEFAULT_ROUTING_TIMEOUT_MS
See Also:
Constant Field Values

clusterMapper

protected static final ClusterMapper clusterMapper

logger

protected static final org.apache.log4j.Logger logger

jmxId

protected final int jmxId

failureDetector

protected volatile FailureDetector failureDetector
Constructor Detail

AbstractStoreClientFactory

public AbstractStoreClientFactory(ClientConfig config)
Method Detail

getNextJmxId

public int getNextJmxId()

getCurrentJmxId

public int getCurrentJmxId()

getStoreClient

public <K,V> StoreClient<K,V> getStoreClient(java.lang.String storeName)
Description copied from interface: StoreClientFactory
Get a StoreClient for the given store.

Specified by:
getStoreClient in interface StoreClientFactory
Type Parameters:
K - The type of the key of the StoreClient
V - The type of the value of the StoreClient
Parameters:
storeName - The name of the store
Returns:
A fully constructed StoreClient

getStoreClient

public <K,V> StoreClient<K,V> getStoreClient(java.lang.String storeName,
                                             InconsistencyResolver<Versioned<V>> resolver)
Description copied from interface: StoreClientFactory
Get a StoreClient for the given store.

Specified by:
getStoreClient in interface StoreClientFactory
Type Parameters:
K - The type of the key of the StoreClient
V - The type of the value of the StoreClient
Parameters:
storeName - The name of the store
resolver - The InconsistencyResolver that should be used to resolve inconsistencies.
Returns:
A fully constructed StoreClient

getRawStore

public <K,V,T> Store<K,V,T> getRawStore(java.lang.String storeName,
                                        InconsistencyResolver<Versioned<V>> resolver)
Description copied from interface: StoreClientFactory
Get the underlying store, not the public StoreClient interface

Specified by:
getRawStore in interface StoreClientFactory
Parameters:
storeName - The name of the store
resolver - The inconsistency resolver
Returns:
The appropriate store

getRawStore

public <K,V,T> Store<K,V,T> getRawStore(java.lang.String storeName,
                                        InconsistencyResolver<Versioned<V>> resolver,
                                        java.lang.String customStoresXml,
                                        java.lang.String clusterXmlString,
                                        FailureDetector fd)

getConfig

protected ClientConfig getConfig()

initFailureDetector

protected abstract FailureDetector initFailureDetector(ClientConfig config,
                                                       Cluster cluster)

getFailureDetector

public FailureDetector getFailureDetector()
Description copied from interface: StoreClientFactory
Returns the FailureDetector specific to the cluster against which this client factory is based.

Specified by:
getFailureDetector in interface StoreClientFactory
Returns:
FailureDetector

bootstrapMetadataWithRetries

public java.lang.String bootstrapMetadataWithRetries(java.lang.String key,
                                                     java.net.URI[] urls)

bootstrapMetadataWithRetries

public java.lang.String bootstrapMetadataWithRetries(java.lang.String key)

getRemoteMetadata

protected java.util.List<Versioned<java.lang.String>> getRemoteMetadata(java.lang.String key,
                                                                        java.net.URI url)

validateUrls

public java.net.URI[] validateUrls(java.lang.String[] urls)

getStore

protected abstract Store<ByteArray,byte[],byte[]> getStore(java.lang.String storeName,
                                                           java.lang.String host,
                                                           int port,
                                                           RequestFormatType type)

getPort

protected abstract int getPort(Node node)

validateUrl

protected abstract void validateUrl(java.net.URI url)

getSerializerFactory

public SerializerFactory getSerializerFactory()

getRequestFormatType

public RequestFormatType getRequestFormatType()

close

public void close()
Description copied from interface: StoreClientFactory
Close the store client

Specified by:
close in interface StoreClientFactory

getClientContext

protected java.lang.String getClientContext()

getCluster

public Cluster getCluster()

getStoreDefs

public java.util.List<StoreDefinition> getStoreDefs()


Jay Kreps, Roshan Sumbaly, Alex Feinberg, Bhupesh Bansal, Lei Gao, Chinmay Soman, Vinoth Chandar, Zhongjie Wu