src/org/objectweb/cjdbc/controller/loadbalancer/raidb1/RAIDb1ec_WRR.java

説明を見る。
00001 00025 package org.objectweb.cjdbc.controller.loadbalancer.raidb1; 00026 00027 import java.sql.SQLException; 00028 import java.util.HashMap; 00029 00030 import org.objectweb.cjdbc.common.i18n.Translate; 00031 import org.objectweb.cjdbc.common.sql.NotImplementedException; 00032 import org.objectweb.cjdbc.common.sql.SelectRequest; 00033 import org.objectweb.cjdbc.common.sql.StoredProcedure; 00034 import org.objectweb.cjdbc.common.xml.DatabasesXmlTags; 00035 import org.objectweb.cjdbc.controller.cache.metadata.MetadataCache; 00036 import org.objectweb.cjdbc.controller.loadbalancer.WeightedBalancer; 00037 import org.objectweb.cjdbc.controller.loadbalancer.policies.WaitForCompletionPolicy; 00038 import org.objectweb.cjdbc.controller.loadbalancer.policies.errorchecking.ErrorCheckingPolicy; 00039 import org.objectweb.cjdbc.controller.virtualdatabase.ControllerResultSet; 00040 import org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabase; 00041 00053 public class RAIDb1ec_WRR extends RAIDb1ec 00054 { 00055 /* 00056 * How the code is organized ? 1. Member variables 2. Constructor(s) 3. 00057 * Request handling 4. Debug/Monitoring 00058 */ 00059 00060 // private int index; // index in the backend vector the Round-Robin 00061 private HashMap weights; 00062 00063 /* 00064 * Constructors 00065 */ 00066 00078 public RAIDb1ec_WRR(VirtualDatabase vdb, 00079 WaitForCompletionPolicy waitForCompletionPolicy, 00080 ErrorCheckingPolicy errorCheckingPolicy, int nbOfConcurrentReads) 00081 throws SQLException 00082 { 00083 super(vdb, waitForCompletionPolicy, errorCheckingPolicy, 00084 nbOfConcurrentReads); 00085 // index = -1; 00086 } 00087 00088 /* 00089 * Request Handling 00090 */ 00091 00097 public ControllerResultSet execReadRequest(SelectRequest request, MetadataCache metadataCache) 00098 throws SQLException 00099 { 00100 throw new NotImplementedException(this.getClass().getName() 00101 + ":execReadRequest"); 00102 } 00103 00109 public ControllerResultSet execReadOnlyReadStoredProcedure(StoredProcedure proc, MetadataCache metadataCache) 00110 throws SQLException 00111 { 00112 throw new NotImplementedException(this.getClass().getName() 00113 + ":execReadStoredProcedure"); 00114 } 00115 00116 /* 00117 * Backends management 00118 */ 00119 00124 public void setWeight(String name, int w) throws SQLException 00125 { 00126 if (logger.isDebugEnabled()) 00127 logger.debug(Translate.get("loadbalancer.weight.set", new String[]{ 00128 String.valueOf(w), name})); 00129 00130 weights.put(name, new Integer(w)); 00131 } 00132 00133 /* 00134 * Debug/Monitoring 00135 */ 00136 00142 public String getInformation() 00143 { 00144 // We don't lock since we don't need a top accurate value 00145 int size = vdb.getBackends().size(); 00146 00147 if (size == 0) 00148 return "RAIDb-1 Error Checking with Weighted Round-Robin Request load balancer: " 00149 + "!!!Warning!!! No backend nodes found\n"; 00150 else 00151 return "RAIDb-1 Error Checking with Weighted Round-Robin Request load balancer (" 00152 + size + " backends)\n"; 00153 } 00154 00158 public String getRaidb1Xml() 00159 { 00160 return WeightedBalancer.getRaidbXml(weights, 00161 DatabasesXmlTags.ELT_RAIDb_1ec_WeightedRoundRobin); 00162 } 00163 }

CJDBCversion1.0.4に対してTue Oct 12 15:16:02 2004に生成されました。 doxygen 1.3.8