com.senseidb.search.node
Class SenseiBroker

java.lang.Object
  extended by com.senseidb.search.node.AbstractSenseiBroker<REQUEST,RESULT>
      extended by com.senseidb.search.node.AbstractConsistentHashBroker<SenseiRequest,SenseiResult>
          extended by com.senseidb.search.node.SenseiBroker
All Implemented Interfaces:
com.linkedin.norbert.javacompat.cluster.ClusterListener

public class SenseiBroker
extends AbstractConsistentHashBroker<SenseiRequest,SenseiResult>

This SenseiBroker routes search(browse) request using the routers created by the supplied router factory. It uses Norbert's scatter-gather handling mechanism to handle distributed search, which does not support request based context sensitive routing.


Field Summary
 
Fields inherited from class com.senseidb.search.node.AbstractConsistentHashBroker
_loadBalancer, _serializer, _timeout
 
Fields inherited from class com.senseidb.search.node.AbstractSenseiBroker
_networkClient, _partitions
 
Constructor Summary
SenseiBroker(com.linkedin.norbert.javacompat.network.PartitionedNetworkClient<Integer> networkClient, com.linkedin.norbert.javacompat.cluster.ClusterClient clusterClient, SenseiLoadBalancerFactory loadBalancerFactory)
           
 
Method Summary
 SenseiRequest customizeRequest(SenseiRequest request)
           
 SenseiResult getEmptyResultInstance()
           
 String getRouteParam(SenseiRequest req)
           
 long getTimeoutMillis()
           
 void handleClusterConnected(Set<com.linkedin.norbert.javacompat.cluster.Node> nodes)
           
 void handleClusterDisconnected()
           
 void handleClusterNodesChanged(Set<com.linkedin.norbert.javacompat.cluster.Node> nodes)
           
 void handleClusterShutdown()
           
 SenseiResult mergeResults(SenseiRequest request, List<SenseiResult> resultList)
          Merge results on the client/broker side.
 void setTimeoutMillis(long timeoutMillis)
           
 
Methods inherited from class com.senseidb.search.node.AbstractConsistentHashBroker
browse, doBrowse, getPartitions, restoreRequest, shutdown
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SenseiBroker

public SenseiBroker(com.linkedin.norbert.javacompat.network.PartitionedNetworkClient<Integer> networkClient,
                    com.linkedin.norbert.javacompat.cluster.ClusterClient clusterClient,
                    SenseiLoadBalancerFactory loadBalancerFactory)
             throws com.linkedin.norbert.NorbertException
Throws:
com.linkedin.norbert.NorbertException
Method Detail

mergeResults

public SenseiResult mergeResults(SenseiRequest request,
                                 List<SenseiResult> resultList)
Description copied from class: AbstractConsistentHashBroker
Merge results on the client/broker side. It likely works differently from the one in the search node.

Specified by:
mergeResults in class AbstractConsistentHashBroker<SenseiRequest,SenseiResult>
Parameters:
request - the original request object
resultList - the list of results from all the requested partitions.
Returns:
one single result instance that is merged from the result list.

getRouteParam

public String getRouteParam(SenseiRequest req)
Specified by:
getRouteParam in class AbstractConsistentHashBroker<SenseiRequest,SenseiResult>

getEmptyResultInstance

public SenseiResult getEmptyResultInstance()
Specified by:
getEmptyResultInstance in class AbstractConsistentHashBroker<SenseiRequest,SenseiResult>
Returns:
an empty result instance. Used when the request cannot be properly processed or when the true result is empty.

customizeRequest

public SenseiRequest customizeRequest(SenseiRequest request)
Overrides:
customizeRequest in class AbstractConsistentHashBroker<SenseiRequest,SenseiResult>

setTimeoutMillis

public void setTimeoutMillis(long timeoutMillis)
Specified by:
setTimeoutMillis in class AbstractConsistentHashBroker<SenseiRequest,SenseiResult>

getTimeoutMillis

public long getTimeoutMillis()
Specified by:
getTimeoutMillis in class AbstractConsistentHashBroker<SenseiRequest,SenseiResult>

handleClusterConnected

public void handleClusterConnected(Set<com.linkedin.norbert.javacompat.cluster.Node> nodes)

handleClusterDisconnected

public void handleClusterDisconnected()

handleClusterNodesChanged

public void handleClusterNodesChanged(Set<com.linkedin.norbert.javacompat.cluster.Node> nodes)

handleClusterShutdown

public void handleClusterShutdown()


Copyright © 2010-2012. All Rights Reserved.