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

RAIDb2ec_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.raidb2;
00026 
00027 import java.sql.SQLException;
00028 import java.util.Vector;
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.policies.WaitForCompletionPolicy;
00036 import org.objectweb.cjdbc.controller.loadbalancer.policies.createtable.CreateTablePolicy;
00037 import org.objectweb.cjdbc.controller.loadbalancer.policies.errorchecking.ErrorCheckingPolicy;
00038 import org.objectweb.cjdbc.controller.virtualdatabase.ControllerResultSet;
00039 import org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabase;
00040 
00041 /**
00042  * RAIDb-2 Round Robin load balancer with error checking
00043  * <p>
00044  * This load balancer tolerates byzantine failures of databases. The read
00045  * requests coming from the Request Manager are sent to multiple backend nodes
00046  * and the results are compared. Write requests are broadcasted to all backends.
00047  * 
00048  * @author <a href="mailto:Emmanuel.Cecchet@inria.fr">Emmanuel Cecchet </a>
00049  * @author <a href="mailto:Julie.Marguerite@inria.fr">Julie Marguerite </a>
00050  * @version 1.0
00051  */
00052 public class RAIDb2ec_RR extends RAIDb2ec
00053 {
00054   /*
00055    * How the code is organized ? 1. Member variables 2. Constructor(s) 3.
00056    * Request handling 4. Debug/Monitoring
00057    */
00058 
00059   private Vector backends;
00060 
00061   /*
00062    * Constructors
00063    */
00064 
00065   /**
00066    * Creates a new RAIDb-2 Round Robin with error checking request load
00067    * balancer.
00068    * 
00069    * @param vdb The virtual database this load balancer belongs to.
00070    * @param waitForCompletionPolicy How many backends must complete before
00071    *          returning the result?
00072    * @param createTablePolicy The policy defining how 'create table' statements
00073    *          should be handled
00074    * @param errorCheckingPolicy Policy to apply for error checking.
00075    * @param nbOfConcurrentReads Number of concurrent reads allowed
00076    * @exception Exception if an error occurs
00077    */
00078   public RAIDb2ec_RR(VirtualDatabase vdb,
00079       WaitForCompletionPolicy waitForCompletionPolicy,
00080       CreateTablePolicy createTablePolicy,
00081       ErrorCheckingPolicy errorCheckingPolicy, int nbOfConcurrentReads)
00082       throws Exception
00083   {
00084     super(vdb, waitForCompletionPolicy, createTablePolicy, errorCheckingPolicy,
00085         nbOfConcurrentReads);
00086   }
00087 
00088   /*
00089    * Request Handling
00090    */
00091 
00092   /**
00093    * Performs a read request. It is up to the implementation to choose to which
00094    * backend node(s) this request should be sent.
00095    * 
00096    * @param request an <code>SelectRequest</code>
00097    * @param metadataCache cached metadata to use to construct the result set
00098    * @return the corresponding <code>java.sql.ResultSet</code>
00099    * @exception SQLException if an error occurs
00100    * @see org.objectweb.cjdbc.controller.loadbalancer.raidb2.RAIDb2#execReadRequest(SelectRequest,
00101    *      MetadataCache)
00102    */
00103   public ControllerResultSet execReadRequest(SelectRequest request,
00104       MetadataCache metadataCache) throws SQLException
00105   {
00106     throw new NotImplementedException(this.getClass().getName()
00107         + ":execReadRequest");
00108   }
00109 
00110   /**
00111    * Not implemented.
00112    * 
00113    * @see org.objectweb.cjdbc.controller.loadbalancer.AbstractLoadBalancer#execReadOnlyReadStoredProcedure(StoredProcedure,
00114    *      MetadataCache)
00115    */
00116   public ControllerResultSet execReadOnlyReadStoredProcedure(
00117       StoredProcedure proc, MetadataCache metadataCache) throws SQLException
00118   {
00119     throw new NotImplementedException(this.getClass().getName()
00120         + ":execReadStoredProcedure");
00121   }
00122 
00123   /*
00124    * Debug/Monitoring
00125    */
00126 
00127   /**
00128    * Gets information about the request load balancer.
00129    * 
00130    * @return <code>String</code> containing information
00131    */
00132   public String getInformation()
00133   {
00134     if (backends == null)
00135       return "RAIDb-2 Error Checking with Round Robin Request load balancer: !!!Warning!!! No backend nodes found\n";
00136     else
00137       return "RAIDb-2 Error Checking with Round Robin Request load balancer balancing over "
00138           + backends.size() + " nodes\n";
00139   }
00140 
00141   /**
00142    * @see org.objectweb.cjdbc.controller.loadbalancer.raidb2.RAIDb2#getRaidb2Xml
00143    */
00144   public String getRaidb2Xml()
00145   {
00146     return "<" + DatabasesXmlTags.ELT_RAIDb_2ec_RoundRobin + "/>";
00147   }
00148 }

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