00001
00025
package org.objectweb.cjdbc.controller.loadbalancer.raidb2;
00026
00027
import java.sql.SQLException;
00028
import java.util.HashMap;
00029
00030
import org.objectweb.cjdbc.common.sql.NotImplementedException;
00031
import org.objectweb.cjdbc.common.sql.SelectRequest;
00032
import org.objectweb.cjdbc.common.sql.StoredProcedure;
00033
import org.objectweb.cjdbc.common.xml.DatabasesXmlTags;
00034
import org.objectweb.cjdbc.controller.cache.metadata.MetadataCache;
00035
import org.objectweb.cjdbc.controller.loadbalancer.WeightedBalancer;
00036
import org.objectweb.cjdbc.controller.loadbalancer.policies.WaitForCompletionPolicy;
00037
import org.objectweb.cjdbc.controller.loadbalancer.policies.createtable.CreateTablePolicy;
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 RAIDb2ec_WRR extends RAIDb2ec
00054 {
00055
00056
00057
00058
00059
00060 private HashMap
backends;
00061
00062
00063
00064
00065
00079 public RAIDb2ec_WRR(
VirtualDatabase vdb,
00080
WaitForCompletionPolicy waitForCompletionPolicy,
00081
CreateTablePolicy createTablePolicy,
00082
ErrorCheckingPolicy errorCheckingPolicy,
int nbOfConcurrentReads)
00083
throws SQLException
00084 {
00085 super(vdb, waitForCompletionPolicy, createTablePolicy, errorCheckingPolicy,
00086 nbOfConcurrentReads);
00087 }
00088
00089
00090
00091
00092
00104 public ControllerResultSet execReadRequest(
SelectRequest request,
00105
MetadataCache metadataCache)
throws SQLException
00106 {
00107
throw new NotImplementedException(
this.getClass().getName()
00108 +
":execReadRequest");
00109 }
00110
00117 public ControllerResultSet execReadOnlyReadStoredProcedure(
00118
StoredProcedure proc,
MetadataCache metadataCache)
throws SQLException
00119 {
00120
throw new NotImplementedException(
this.getClass().getName()
00121 +
":execReadStoredProcedure");
00122 }
00123
00124
00125
00126
00127
00132 public void setWeight(String name,
int w)
throws SQLException
00133 {
00134
throw new SQLException(
"Weight is not supported with this load balancer");
00135 }
00136
00137
00138
00139
00140
00146 public String
getInformation()
00147 {
00148
if (
backends == null)
00149
return "RAIDb-2 Error Checking with Weighted Round Robin Request load balancer: "
00150 +
"!!!Warning!!! No backend nodes found\n";
00151
else
00152
return "RAIDb-2 Error Checking with Weighted Round Robin Request load balancer balancing over "
00153 +
backends.size() +
" nodes\n";
00154 }
00155
00159 public String
getRaidb2Xml()
00160 {
00161
return WeightedBalancer.getRaidbXml(
backends,
00162
DatabasesXmlTags.ELT_RAIDb_2ec_WeightedRoundRobin);
00163 }
00164 }