com.alibaba.druid.pool.ha.balance
Class WeightBalancer

java.lang.Object
  extended by com.alibaba.druid.pool.ha.balance.AbstractBalancer
      extended by com.alibaba.druid.pool.ha.balance.WeightBalancer
All Implemented Interfaces:
Balancer

public class WeightBalancer
extends AbstractBalancer


Constructor Summary
WeightBalancer()
           
 
Method Summary
 void afterDataSourceChanged(DataSourceChangedEvent event)
           
 void computeTotalWeight()
           
 MultiConnectionHolder getConnection(MultiDataSourceConnection conn, String sql)
           
 int produceRandomNumber()
           
 
Methods inherited from class com.alibaba.druid.pool.ha.balance.AbstractBalancer
getMultiDataSource, init, isInited
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WeightBalancer

public WeightBalancer()
Method Detail

afterDataSourceChanged

public void afterDataSourceChanged(DataSourceChangedEvent event)

produceRandomNumber

public int produceRandomNumber()

computeTotalWeight

public void computeTotalWeight()

getConnection

public MultiConnectionHolder getConnection(MultiDataSourceConnection conn,
                                           String sql)
                                    throws SQLException
Throws:
SQLException


Copyright © 2012 Alibaba Group. All Rights Reserved.