1 24 25 package org.objectweb.cjdbc.controller.loadbalancer.raidb2; 26 27 import java.sql.SQLException ; 28 import java.util.HashMap ; 29 30 import org.objectweb.cjdbc.common.exceptions.NotImplementedException; 31 import org.objectweb.cjdbc.common.sql.SelectRequest; 32 import org.objectweb.cjdbc.common.sql.StoredProcedure; 33 import org.objectweb.cjdbc.common.xml.DatabasesXmlTags; 34 import org.objectweb.cjdbc.controller.cache.metadata.MetadataCache; 35 import org.objectweb.cjdbc.controller.loadbalancer.WeightedBalancer; 36 import org.objectweb.cjdbc.controller.loadbalancer.policies.WaitForCompletionPolicy; 37 import org.objectweb.cjdbc.controller.loadbalancer.policies.createtable.CreateTablePolicy; 38 import org.objectweb.cjdbc.controller.loadbalancer.policies.errorchecking.ErrorCheckingPolicy; 39 import org.objectweb.cjdbc.controller.virtualdatabase.ControllerResultSet; 40 import org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabase; 41 42 53 public class RAIDb2ec_WRR extends RAIDb2ec 54 { 55 59 60 private HashMap backends; 61 62 65 66 79 public RAIDb2ec_WRR(VirtualDatabase vdb, 80 WaitForCompletionPolicy waitForCompletionPolicy, 81 CreateTablePolicy createTablePolicy, 82 ErrorCheckingPolicy errorCheckingPolicy, int nbOfConcurrentReads) 83 throws Exception 84 { 85 super(vdb, waitForCompletionPolicy, createTablePolicy, errorCheckingPolicy, 86 nbOfConcurrentReads); 87 } 88 89 92 93 104 public ControllerResultSet execReadRequest(SelectRequest request, 105 MetadataCache metadataCache) throws SQLException 106 { 107 throw new NotImplementedException(this.getClass().getName() 108 + ":execReadRequest"); 109 } 110 111 117 public ControllerResultSet execReadOnlyReadStoredProcedure( 118 StoredProcedure proc, MetadataCache metadataCache) throws SQLException 119 { 120 throw new NotImplementedException(this.getClass().getName() 121 + ":execReadStoredProcedure"); 122 } 123 124 127 128 132 public void setWeight(String name, int w) throws SQLException 133 { 134 throw new SQLException ("Weight is not supported with this load balancer"); 135 } 136 137 140 141 146 public String getInformation() 147 { 148 if (backends == null) 149 return "RAIDb-2 Error Checking with Weighted Round Robin Request load balancer: " 150 + "!!!Warning!!! No backend nodes found\n"; 151 else 152 return "RAIDb-2 Error Checking with Weighted Round Robin Request load balancer balancing over " 153 + backends.size() + " nodes\n"; 154 } 155 156 159 public String getRaidb2Xml() 160 { 161 return WeightedBalancer.getRaidbXml(backends, 162 DatabasesXmlTags.ELT_RAIDb_2ec_WeightedRoundRobin); 163 } 164 } | Popular Tags |