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.virtualdatabase.ControllerResultSet; 39 import org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabase; 40 41 52 public class RAIDb2_WRR extends RAIDb2 53 { 54 58 59 private HashMap weights; 60 61 64 65 75 public RAIDb2_WRR(VirtualDatabase vdb, 76 WaitForCompletionPolicy waitForCompletionPolicy, 77 CreateTablePolicy createTablePolicy) throws Exception 78 { 79 super(vdb, waitForCompletionPolicy, createTablePolicy); 80 } 81 82 85 86 97 public ControllerResultSet execReadRequest(SelectRequest request, 98 MetadataCache metadataCache) throws SQLException 99 { 100 throw new NotImplementedException(this.getClass().getName() 101 + ":execReadRequest"); 102 } 103 104 112 public ControllerResultSet execReadOnlyReadStoredProcedure( 113 StoredProcedure proc, MetadataCache metadataCache) throws SQLException 114 { 115 throw new NotImplementedException(this.getClass().getName() 116 + ":execReadStoredProcedure"); 117 } 118 119 122 123 127 public void setWeight(String name, int w) throws SQLException 128 { 129 throw new SQLException ("Weight is not supported with this load balancer"); 130 } 131 132 135 136 141 public String getInformation() 142 { 143 if (weights == null) 144 return "RAIDb-2 Weighted Round Robin Request load balancer: !!!Warning!!! No backend nodes found\n"; 145 else 146 return "RAIDb-2 Weighted Round Robin Request load balancer balancing over " 147 + weights.size() + " nodes\n"; 148 } 149 150 153 public String getRaidb2Xml() 154 { 155 return WeightedBalancer.getRaidbXml(weights, 156 DatabasesXmlTags.ELT_RAIDb_2_WeightedRoundRobin); 157 } 158 } | Popular Tags |