com.senseidb.search.node
Class AbstractConsistentHashBroker<REQUEST extends AbstractSenseiRequest,RESULT extends AbstractSenseiResult>
java.lang.Object
com.senseidb.search.node.AbstractSenseiBroker<REQUEST,RESULT>
com.senseidb.search.node.AbstractConsistentHashBroker<REQUEST,RESULT>
- Type Parameters:
REQUEST
- RESULT
-
- All Implemented Interfaces:
- com.linkedin.norbert.javacompat.cluster.ClusterListener
- Direct Known Subclasses:
- SenseiBroker, SenseiSysBroker
public abstract class AbstractConsistentHashBroker<REQUEST extends AbstractSenseiRequest,RESULT extends AbstractSenseiResult>
- extends AbstractSenseiBroker<REQUEST,RESULT>
- Author:
- "Xiaoyang Gu"
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.linkedin.norbert.javacompat.cluster.ClusterListener |
handleClusterConnected, handleClusterDisconnected, handleClusterNodesChanged, handleClusterShutdown |
_timeout
protected long _timeout
_serializer
protected final com.linkedin.norbert.network.Serializer<REQUEST extends AbstractSenseiRequest,RESULT extends AbstractSenseiResult> _serializer
_loadBalancer
protected volatile SenseiLoadBalancer _loadBalancer
AbstractConsistentHashBroker
public AbstractConsistentHashBroker(com.linkedin.norbert.javacompat.network.PartitionedNetworkClient<Integer> networkClient,
com.linkedin.norbert.network.Serializer<REQUEST,RESULT> serializer)
throws com.linkedin.norbert.NorbertException
- Parameters:
networkClient
- clusterClient
- routerFactory
- serializer
- The serializer used to serialize/deserialize request/response pairsscatterGatherHandler
-
- Throws:
com.linkedin.norbert.NorbertException
customizeRequest
public <T> T customizeRequest(REQUEST request)
restoreRequest
public <T> T restoreRequest(REQUEST request,
T state)
getPartitions
protected it.unimi.dsi.fastutil.ints.IntSet getPartitions(Set<com.linkedin.norbert.javacompat.cluster.Node> nodes)
getEmptyResultInstance
public abstract RESULT getEmptyResultInstance()
- Specified by:
getEmptyResultInstance
in class AbstractSenseiBroker<REQUEST extends AbstractSenseiRequest,RESULT extends AbstractSenseiResult>
- Returns:
- an empty result instance. Used when the request cannot be properly
processed or when the true result is empty.
browse
public RESULT browse(REQUEST req)
throws SenseiException
- The method that provides the search service.
- Overrides:
browse
in class AbstractSenseiBroker<REQUEST extends AbstractSenseiRequest,RESULT extends AbstractSenseiResult>
- Parameters:
req
-
- Returns:
-
- Throws:
SenseiException
mergeResults
public abstract RESULT mergeResults(REQUEST request,
List<RESULT> resultList)
- Merge results on the client/broker side. It likely works differently from
the one in the search node.
- Parameters:
request
- the original request objectresultList
- the list of results from all the requested partitions.
- Returns:
- one single result instance that is merged from the result list.
getRouteParam
public abstract String getRouteParam(REQUEST req)
doBrowse
protected RESULT doBrowse(com.linkedin.norbert.javacompat.network.PartitionedNetworkClient<Integer> networkClient,
REQUEST req,
it.unimi.dsi.fastutil.ints.IntSet partitions)
- Specified by:
doBrowse
in class AbstractSenseiBroker<REQUEST extends AbstractSenseiRequest,RESULT extends AbstractSenseiResult>
shutdown
public void shutdown()
- Overrides:
shutdown
in class AbstractSenseiBroker<REQUEST extends AbstractSenseiRequest,RESULT extends AbstractSenseiResult>
setTimeoutMillis
public abstract void setTimeoutMillis(long timeoutMillis)
- Specified by:
setTimeoutMillis
in class AbstractSenseiBroker<REQUEST extends AbstractSenseiRequest,RESULT extends AbstractSenseiResult>
getTimeoutMillis
public abstract long getTimeoutMillis()
- Specified by:
getTimeoutMillis
in class AbstractSenseiBroker<REQUEST extends AbstractSenseiRequest,RESULT extends AbstractSenseiResult>
Copyright © 2010-2012. All Rights Reserved.