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

SingleDBPassThroughScheduler.java

00001 /**
00002  * C-JDBC: Clustered JDBC.
00003  * Copyright (C) 2002-2005 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): _________________________.
00023  */
00024 
00025 package org.objectweb.cjdbc.controller.scheduler.singledb;
00026 
00027 import org.objectweb.cjdbc.common.sql.AbstractWriteRequest;
00028 import org.objectweb.cjdbc.common.sql.ParsingGranularities;
00029 import org.objectweb.cjdbc.common.sql.SelectRequest;
00030 import org.objectweb.cjdbc.common.xml.DatabasesXmlTags;
00031 import org.objectweb.cjdbc.controller.requestmanager.RAIDbLevels;
00032 import org.objectweb.cjdbc.controller.scheduler.AbstractScheduler;
00033 
00034 /**
00035  * This scheduler provides scheduling for a single backend instance. It is
00036  * really trivial and does not yet support distribution.
00037  * 
00038  * @author <a href="mailto:Emmanuel.Cecchet@inria.fr">Emmanuel Cecchet </a>
00039  * @version 1.0
00040  */
00041 public class SingleDBPassThroughScheduler extends AbstractScheduler
00042 {
00043 
00044   //
00045   // How the code is organized ?
00046   //
00047   // 1. Member variables
00048   // 2. Constructor
00049   // 3. Request handling
00050   // 4. Transaction management
00051   // 5. Debug/Monitoring
00052   //
00053 
00054   private long requestId;
00055 
00056   //
00057   // Constructor
00058   //
00059 
00060   /**
00061    * Creates a new Single Database Scheduler
00062    */
00063   public SingleDBPassThroughScheduler()
00064   {
00065     super(RAIDbLevels.SingleDB, ParsingGranularities.NO_PARSING);
00066 
00067     requestId = 0;
00068   }
00069 
00070   //
00071   // Request Handling
00072   //
00073 
00074   /**
00075    * @see org.objectweb.cjdbc.controller.scheduler.AbstractScheduler#scheduleReadRequest(SelectRequest)
00076    */
00077   public final synchronized void scheduleReadRequest(SelectRequest request)
00078   {
00079     request.setId(requestId++);
00080   }
00081 
00082   /**
00083    * @see org.objectweb.cjdbc.controller.scheduler.AbstractScheduler#readCompletedNotify(SelectRequest)
00084    */
00085   public final void readCompletedNotify(SelectRequest request)
00086   {
00087   }
00088 
00089   /**
00090    * @see org.objectweb.cjdbc.controller.scheduler.AbstractScheduler#scheduleWriteRequest(AbstractWriteRequest)
00091    */
00092   public final synchronized void scheduleNonSuspendedWriteRequest(
00093       AbstractWriteRequest request)
00094   {
00095     request.setId(requestId++);
00096   }
00097 
00098   /**
00099    * @see org.objectweb.cjdbc.controller.scheduler.AbstractScheduler#notifyWriteCompleted(AbstractWriteRequest)
00100    */
00101   public final void notifyWriteCompleted(AbstractWriteRequest request)
00102   {
00103   }
00104 
00105   //
00106   // Transaction Management
00107   //
00108 
00109   /**
00110    * @see org.objectweb.cjdbc.controller.scheduler.AbstractScheduler#commitTransaction(long)
00111    */
00112   protected final void commitTransaction(long transactionId)
00113   {
00114   }
00115 
00116   /**
00117    * @see org.objectweb.cjdbc.controller.scheduler.AbstractScheduler#rollbackTransaction(long)
00118    */
00119   protected final void rollbackTransaction(long transactionId)
00120   {
00121   }
00122 
00123   //
00124   // Debug/Monitoring
00125   //
00126   /**
00127    * @see org.objectweb.cjdbc.controller.scheduler.AbstractScheduler#getXmlImpl()
00128    */
00129   public String getXmlImpl()
00130   {
00131     return "<" + DatabasesXmlTags.ELT_SingleDBScheduler + " "
00132         + DatabasesXmlTags.ATT_level + "=\"" + DatabasesXmlTags.VAL_passThrough
00133         + "\"/>";
00134   }
00135 
00136 }

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