00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
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
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053 public class RAIDb2ec_WRR extends RAIDb2ec
00054 {
00055
00056
00057
00058
00059
00060 private HashMap backends;
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079 public RAIDb2ec_WRR(VirtualDatabase vdb,
00080 WaitForCompletionPolicy waitForCompletionPolicy,
00081 CreateTablePolicy createTablePolicy,
00082 ErrorCheckingPolicy errorCheckingPolicy, int nbOfConcurrentReads)
00083 throws Exception
00084 {
00085 super(vdb, waitForCompletionPolicy, createTablePolicy, errorCheckingPolicy,
00086 nbOfConcurrentReads);
00087 }
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104 public ControllerResultSet execReadRequest(SelectRequest request,
00105 MetadataCache metadataCache) throws SQLException
00106 {
00107 throw new NotImplementedException(this.getClass().getName()
00108 + ":execReadRequest");
00109 }
00110
00111
00112
00113
00114
00115
00116
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
00128
00129
00130
00131
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
00141
00142
00143
00144
00145
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
00156
00157
00158
00159 public String getRaidb2Xml()
00160 {
00161 return WeightedBalancer.getRaidbXml(backends,
00162 DatabasesXmlTags.ELT_RAIDb_2ec_WeightedRoundRobin);
00163 }
00164 }