Main Page | Packages | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages

RAIDb1ec_RR.java

00001 /**
00002  * C-JDBC: Clustered JDBC.
00003  * Copyright (C) 2002-2004 French National Institute For Research In Computer
00004  * Science And Control (INRIA).
00005  * Contact: c-jdbc@objectweb.org
00006  * 
00007  * This library is free software; you can redistribute it and/or modify it
00008  * under the terms of the GNU Lesser General Public License as published by the
00009  * Free Software Foundation; either version 2.1 of the License, or any later
00010  * version.
00011  * 
00012  * This library is distributed in the hope that it will be useful, but WITHOUT
00013  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00014  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
00015  * for more details.
00016  * 
00017  * You should have received a copy of the GNU Lesser General Public License
00018  * along with this library; if not, write to the Free Software Foundation,
00019  * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
00020  *
00021  * Initial developer(s): Emmanuel Cecchet.
00022  * Contributor(s): Julie Marguerite.
00023  */
00024 
00025 package org.objectweb.cjdbc.controller.loadbalancer.raidb1;
00026 
00027 import java.sql.SQLException;
00028 
00029 import org.objectweb.cjdbc.common.sql.NotImplementedException;
00030 import org.objectweb.cjdbc.common.sql.SelectRequest;
00031 import org.objectweb.cjdbc.common.sql.StoredProcedure;
00032 import org.objectweb.cjdbc.common.xml.DatabasesXmlTags;
00033 import org.objectweb.cjdbc.controller.cache.metadata.MetadataCache;
00034 import org.objectweb.cjdbc.controller.loadbalancer.policies.WaitForCompletionPolicy;
00035 import org.objectweb.cjdbc.controller.loadbalancer.policies.errorchecking.ErrorCheckingPolicy;
00036 import org.objectweb.cjdbc.controller.virtualdatabase.ControllerResultSet;
00037 import org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabase;
00038 
00039 /**
00040  * RAIDb-1 Round Robin load balancer with error checking.
00041  * <p>
00042  * This load balancer tolerates byzantine failures of databases. The read
00043  * requests coming from the Request Manager are sent to multiple backend nodes
00044  * and the results are compared. Write requests are broadcasted to all backends.
00045  * 
00046  * @author <a href="mailto:Emmanuel.Cecchet@inria.fr">Emmanuel Cecchet </a>
00047  * @author <a href="mailto:Julie.Marguerite@inria.fr">Julie Marguerite </a>
00048  * @version 1.0
00049  */
00050 public class RAIDb1ec_RR extends RAIDb1ec
00051 {
00052   /*
00053    * How the code is organized ? 1. Member variables 2. Constructor(s) 3.
00054    * Request handling 4. Debug/Monitoring
00055    */
00056 
00057   //  private int index; // index in the backend vector the Round-Robin
00058   /*
00059    * Constructors
00060    */
00061 
00062   /**
00063    * Creates a new RAIDb-1 Round Robin with error checking request load
00064    * balancer.
00065    * 
00066    * @param vdb the virtual database this load balancer belongs to.
00067    * @param waitForCompletionPolicy how many backends must complete before
00068    *          returning the result?
00069    * @param errorCheckingPolicy policy to apply for error checking.
00070    * @param nbOfConcurrentReads Number of concurrent reads allowed
00071    * @exception Exception if an error occurs
00072    */
00073   public RAIDb1ec_RR(VirtualDatabase vdb,
00074       WaitForCompletionPolicy waitForCompletionPolicy,
00075       ErrorCheckingPolicy errorCheckingPolicy, int nbOfConcurrentReads)
00076       throws Exception
00077   {
00078     super(vdb, waitForCompletionPolicy, errorCheckingPolicy,
00079         nbOfConcurrentReads);
00080     // index = -1;
00081   }
00082 
00083   /*
00084    * Request Handling
00085    */
00086 
00087   /**
00088    * Not implemented.
00089    * 
00090    * @see org.objectweb.cjdbc.controller.loadbalancer.raidb1.RAIDb1#execReadRequest(SelectRequest, MetadataCache)
00091    */
00092   public ControllerResultSet execReadRequest(SelectRequest request, MetadataCache metadataCache)
00093       throws SQLException
00094   {
00095     throw new NotImplementedException(this.getClass().getName()
00096         + ":execReadRequest");
00097   }
00098 
00099   /**
00100    * Not implemented.
00101    * 
00102    * @see org.objectweb.cjdbc.controller.loadbalancer.AbstractLoadBalancer#execReadOnlyReadStoredProcedure(StoredProcedure, MetadataCache)
00103    */
00104   public ControllerResultSet execReadOnlyReadStoredProcedure(StoredProcedure proc, MetadataCache metadataCache)
00105       throws SQLException
00106   {
00107     throw new NotImplementedException(this.getClass().getName()
00108         + ":execReadStoredProcedure");
00109   }
00110 
00111   /*
00112    * Debug/Monitoring
00113    */
00114 
00115   /**
00116    * Gets information about the request load balancer.
00117    * 
00118    * @return <code>String</code> containing information
00119    */
00120   public String getInformation()
00121   {
00122     // We don't lock since we don't need a top accurate value
00123     int size = vdb.getBackends().size();
00124 
00125     if (size == 0)
00126       return "RAIDb-1 Error Checking with Round-Robin Request load balancer: !!!Warning!!! No backend nodes found\n";
00127     else
00128       return "RAIDb-1 Error Checking with Round-Robin Request load balancer ("
00129           + size + " backends)\n";
00130   }
00131 
00132   /**
00133    * @see org.objectweb.cjdbc.controller.loadbalancer.raidb1.RAIDb1#getRaidb1Xml
00134    */
00135   public String getRaidb1Xml()
00136   {
00137     return "<" + DatabasesXmlTags.ELT_RAIDb_1ec_RoundRobin + "/>";
00138   }
00139 
00140 }

Generated on Mon Apr 11 22:01:33 2005 for C-JDBC by  doxygen 1.3.9.1