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.raidb1; 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 pass through scheduling for RAIDb-1 controllers. 00036 * Requests are only assigned a unique id and passed to the load balancer. 00037 * 00038 * @author <a href="mailto:Emmanuel.Cecchet@inria.fr">Emmanuel Cecchet </a> 00039 * @version 1.0 00040 */ 00041 public class RAIDb1PassThroughScheduler 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 Query Level Scheduler 00062 */ 00063 public RAIDb1PassThroughScheduler() 00064 { 00065 super(RAIDbLevels.RAIDb1, ParsingGranularities.NO_PARSING); 00066 requestId = 0; 00067 } 00068 00069 // 00070 // Request Handling 00071 // 00072 00073 /** 00074 * @see org.objectweb.cjdbc.controller.scheduler.AbstractScheduler#scheduleReadRequest(SelectRequest) 00075 */ 00076 public final synchronized void scheduleReadRequest(SelectRequest request) 00077 { 00078 request.setId(requestId++); 00079 } 00080 00081 /** 00082 * @see org.objectweb.cjdbc.controller.scheduler.AbstractScheduler#readCompletedNotify(SelectRequest) 00083 */ 00084 public final void readCompletedNotify(SelectRequest request) 00085 { 00086 } 00087 00088 /** 00089 * @see org.objectweb.cjdbc.controller.scheduler.AbstractScheduler#scheduleWriteRequest(AbstractWriteRequest) 00090 */ 00091 public final synchronized void scheduleNonSuspendedWriteRequest( 00092 AbstractWriteRequest request) 00093 { 00094 request.setId(requestId++); 00095 } 00096 00097 /** 00098 * @see org.objectweb.cjdbc.controller.scheduler.AbstractScheduler#notifyWriteCompleted(AbstractWriteRequest) 00099 */ 00100 public final void notifyWriteCompleted(AbstractWriteRequest request) 00101 { 00102 } 00103 00104 // 00105 // Transaction Management 00106 // 00107 00108 /** 00109 * @see org.objectweb.cjdbc.controller.scheduler.AbstractScheduler#commitTransaction(long) 00110 */ 00111 protected final void commitTransaction(long transactionId) 00112 { 00113 } 00114 00115 /** 00116 * @see org.objectweb.cjdbc.controller.scheduler.AbstractScheduler#rollbackTransaction(long) 00117 */ 00118 protected final void rollbackTransaction(long transactionId) 00119 { 00120 } 00121 00122 // 00123 // Debug/Monitoring 00124 // 00125 /** 00126 * @see org.objectweb.cjdbc.controller.scheduler.AbstractScheduler#getXmlImpl() 00127 */ 00128 public String getXmlImpl() 00129 { 00130 return "<" + DatabasesXmlTags.ELT_RAIDb1Scheduler + " " 00131 + DatabasesXmlTags.ATT_level + "=\"" + DatabasesXmlTags.VAL_passThrough 00132 + "\"/>"; 00133 } 00134 00135 }