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.virtualdatabase.ControllerResultSet;
00039
import org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabase;
00040
00052 public class RAIDb2_WRR extends RAIDb2
00053 {
00054
00055
00056
00057
00058
00059 private HashMap
weights;
00060
00061
00062
00063
00064
00075 public RAIDb2_WRR(
VirtualDatabase vdb,
00076
WaitForCompletionPolicy waitForCompletionPolicy,
00077
CreateTablePolicy createTablePolicy)
throws SQLException
00078 {
00079 super(vdb, waitForCompletionPolicy, createTablePolicy);
00080 }
00081
00082
00083
00084
00085
00097 public ControllerResultSet execReadRequest(
SelectRequest request,
00098
MetadataCache metadataCache)
throws SQLException
00099 {
00100
throw new NotImplementedException(
this.getClass().getName()
00101 +
":execReadRequest");
00102 }
00103
00112 public ControllerResultSet execReadOnlyReadStoredProcedure(
00113
StoredProcedure proc,
MetadataCache metadataCache)
throws SQLException
00114 {
00115
throw new NotImplementedException(
this.getClass().getName()
00116 +
":execReadStoredProcedure");
00117 }
00118
00119
00120
00121
00122
00127 public void setWeight(String name,
int w)
throws SQLException
00128 {
00129
throw new SQLException(
"Weight is not supported with this load balancer");
00130 }
00131
00132
00133
00134
00135
00141 public String
getInformation()
00142 {
00143
if (
weights == null)
00144
return "RAIDb-2 Weighted Round Robin Request load balancer: !!!Warning!!! No backend nodes found\n";
00145
else
00146
return "RAIDb-2 Weighted Round Robin Request load balancer balancing over "
00147 +
weights.size() +
" nodes\n";
00148 }
00149
00153 public String
getRaidb2Xml()
00154 {
00155
return WeightedBalancer.getRaidbXml(
weights,
00156
DatabasesXmlTags.ELT_RAIDb_2_WeightedRoundRobin);
00157 }
00158 }