Java Doc for AbstractLoadBalancer.java in  » Database-JDBC-Connection-Pool » sequoia-2.10.9 » org » continuent » sequoia » controller » loadbalancer » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database JDBC Connection Pool » sequoia 2.10.9 » org.continuent.sequoia.controller.loadbalancer 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.continuent.sequoia.controller.loadbalancer.AbstractLoadBalancer

All known Subclasses:   org.continuent.sequoia.controller.loadbalancer.raidb2.RAIDb2,  org.continuent.sequoia.controller.loadbalancer.singledb.SingleDB,  org.continuent.sequoia.controller.loadbalancer.raidb1.RAIDb1,  org.continuent.sequoia.controller.loadbalancer.paralleldb.ParallelDB,  org.continuent.sequoia.controller.loadbalancer.raidb0.RAIDb0,
AbstractLoadBalancer
abstract public class AbstractLoadBalancer implements XmlComponent(Code)
The Request Load Balancer should implement the load balancing of the requests among the backend nodes.

The requests comes from the Request Controller and are sent to the Connection Managers.
author:
   Emmanuel Cecchet
author:
   Vadim Kassin
author:
   Jaco Swart
author:
   Jean-Bernard van Zuylen
author:
  

version:
   1.0



Field Summary
protected  ReadPrioritaryFIFOWriteLockbackendListLock
    
protected  ArrayListenabledBackends
     List of enabled backends (includes backends in either ENABLED or DISABLING state).
protected static  Tracelogger
    
protected  MacrosHandlermacroHandler
    
protected  intparsingGranularity
    
protected  intraidbLevel
    
protected  RecoveryLogrecoveryLog
    
protected  LinkedListtotalOrderQueue
    
protected  VirtualDatabasevdb
    
public  WaitForCompletionPolicywaitForCompletionPolicy
    

Constructor Summary
protected  AbstractLoadBalancer(VirtualDatabase vdb, int raidbLevel, int parsingGranularity)
    

Method Summary
abstract public  voidabort(TransactionMetaData tm)
     Abort a transaction and all its currently pending or executing queries.
protected  intacquireLockAndCheckNbOfThreads(Object request, String requestDescription)
     Acquire the given lock and check the number of threads.
abstract public  voidbegin(TransactionMetaData tm)
     Begin a new transaction.
abstract public  ExecuteResultcallableStatementExecute(StoredProcedure proc, MetadataCache metadataCache)
     Call a stored procedure that returns multiple results.
abstract public  ControllerResultSetcallableStatementExecuteQuery(StoredProcedure proc, MetadataCache metadataCache)
     Call a stored procedure that returns a ResultSet.
abstract public  ExecuteUpdateResultcallableStatementExecuteUpdate(StoredProcedure proc)
     Call a stored procedure that performs an update.
abstract public  voidclosePersistentConnection(String login, long persistentConnectionId)
     Close a persistent connection.
abstract public  voidcommit(TransactionMetaData tm)
     Commit a transaction.
abstract public  voiddisableBackend(DatabaseBackend db, boolean forceDisable)
     Disable a backend without further check.
abstract public  voidenableBackend(DatabaseBackend db, boolean writeEnabled)
     Enable a backend without further check.
final public static  ExecuteResultexecuteCallableStatementExecuteOnBackend(StoredProcedure proc, DatabaseBackend backend, BackendWorkerThread workerThread, PooledConnection pc, MetadataCache metadataCache)
     Execute a stored procedure that returns multiple results on the given backend.
final public static  ControllerResultSetexecuteCallableStatementExecuteQueryOnBackend(StoredProcedure proc, DatabaseBackend backend, BackendWorkerThread workerThread, Connection c, MetadataCache metadataCache)
     Execute a read stored procedure on the given backend.
final public static  ExecuteUpdateResultexecuteCallableStatementExecuteUpdateOnBackend(StoredProcedure proc, DatabaseBackend backend, BackendWorkerThread workerThread, PooledConnection pc)
     Execute a write stored procedure on the given backend.
final public static  ExecuteResultexecuteStatementExecuteOnBackend(AbstractRequest request, DatabaseBackend backend, BackendWorkerThread workerThread, PooledConnection pc, MetadataCache metadataCache)
     Execute a request that returns multiple results on the given backend.
final public static  ControllerResultSetexecuteStatementExecuteQueryOnBackend(SelectRequest request, DatabaseBackend backend, BackendWorkerThread workerThread, Connection c, MetadataCache metadataCache)
     Execute a statement on a backend.
final public static  ExecuteUpdateResultexecuteStatementExecuteUpdateOnBackend(AbstractWriteRequest request, DatabaseBackend backend, BackendWorkerThread workerThread, PooledConnection pc)
     Execute an update prepared statement on a backend.
final public static  GeneratedKeysResultexecuteStatementExecuteUpdateWithKeysOnBackend(AbstractWriteRequest request, DatabaseBackend backend, BackendWorkerThread workerThread, PooledConnection pc, MetadataCache metadataCache)
     Execute an update prepared statement on a backend.
final public static  ConnectiongetConnectionAndBeginTransaction(DatabaseBackend backend, AbstractConnectionManager cm, AbstractRequest request)
    
final public static  intgetDefaultTransactionIsolationLevel()
     Returns the defaultTransactionIsolationLevel value.
abstract public  StringgetInformation()
    
protected  intgetNbToWait(int nbOfThreads)
     Returns the number of nodes to wait for according to the defined waitForCompletion policy.
public  intgetNumberOfEnabledBackends()
     Get the number of currently enabled backends.
public  intgetParsingGranularity()
     Get the needed query parsing granularity.
abstract public  ControllerResultSetgetPreparedStatementGetMetaData(AbstractRequest request)
    
public  intgetRAIDbLevel()
     Returns the RAIDbLevel.
final public  RecoveryLoggetRecoveryLog()
     Returns the recoveryLog value.
public  StringgetXml()
    
abstract public  StringgetXmlImpl()
    
public  voidhandleMacros(AbstractRequest request)
     Interprets the macros in the request (depending on the MacroHandler set for this class) and modify either the skeleton or the query itself.
abstract public  voidopenPersistentConnection(String login, long persistentConnectionId)
     Open a persistent connection.
final public static  ControllerResultSetpreparedStatementGetMetaDataOnBackend(String sqlTemplate, DatabaseBackend backend, Connection c)
     Get PreparedStatement metadata before the statement is executed.
abstract public  ExecuteResultreadOnlyCallableStatementExecute(StoredProcedure proc, MetadataCache metadataCache)
     Call a read-only stored procedure that returns multiple results.
abstract public  ControllerResultSetreadOnlyCallableStatementExecuteQuery(StoredProcedure proc, MetadataCache metadataCache)
     Call a read-only stored procedure that returns a ResultSet.
protected  voidreleaseLockAndUnlockNextQuery(Object currentQuery)
     Release the backend list lock and remove the current query from the head of the total order queue to unlock the next query.
abstract public  voidreleaseSavepoint(TransactionMetaData tm, String name)
    
public  voidremoveObjectFromAndNotifyTotalOrderQueue(Object request)
     Remove an entry of the total order queue (usually the head) and notify the queue so that the next queries can be scheduled.
abstract public  voidrollback(TransactionMetaData tm)
     Rollback a transaction.
abstract public  voidrollbackToSavepoint(TransactionMetaData tm, String savepointName)
    
final public  voidsetDefaultTransactionIsolationLevel(int defaultTransactionIsolationLevel)
     Sets the defaultTransactionIsolationLevel value.
public  voidsetMacroHandler(MacrosHandler handler)
     This sets the macro handler for this load balancer.
final public  voidsetRecoveryLog(RecoveryLog recoveryLog)
     Sets the recoveryLog value.
abstract public  voidsetSavepoint(TransactionMetaData tm, String name)
     Set a savepoint to a transaction.
public  voidsetWeight(String name, int w)
     Associate a weight to a backend identified by its logical name.
abstract public  ExecuteResultstatementExecute(AbstractRequest request, MetadataCache metadataCache)
     Call a request that returns multiple results.
abstract public  ControllerResultSetstatementExecuteQuery(SelectRequest request, MetadataCache metadataCache)
     Perform a read request.
abstract public  ExecuteUpdateResultstatementExecuteUpdate(AbstractWriteRequest request)
     Perform a write request.
abstract public  GeneratedKeysResultstatementExecuteUpdateWithKeys(AbstractWriteRequest request, MetadataCache metadataCache)
     Perform a write request and return a ResultSet containing the auto generated keys.
public  voidwaitForSuspendWritesToComplete(AbstractRequest request)
     This will block the given request if there are any suspending task in progress (before the request in the total order queue).
public static  voidwaitForTaskCompletion(long timeout, String requestDescription, AbstractTask task)
     Wait for the completion of the given task.
public  booleanwaitForTotalOrder(Object request, boolean errorIfNotFound)
     If we are executing in a distributed virtual database, we have to make sure that we post the query in the queue following the total order.

Field Detail
backendListLock
protected ReadPrioritaryFIFOWriteLock backendListLock(Code)



enabledBackends
protected ArrayList enabledBackends(Code)
List of enabled backends (includes backends in either ENABLED or DISABLING state).
See Also:   org.continuent.sequoia.common.jmx.management.BackendState



logger
protected static Trace logger(Code)



macroHandler
protected MacrosHandler macroHandler(Code)



parsingGranularity
protected int parsingGranularity(Code)



raidbLevel
protected int raidbLevel(Code)



recoveryLog
protected RecoveryLog recoveryLog(Code)



totalOrderQueue
protected LinkedList totalOrderQueue(Code)
Reference to distributed virtual database total order queue



vdb
protected VirtualDatabase vdb(Code)



waitForCompletionPolicy
public WaitForCompletionPolicy waitForCompletionPolicy(Code)
Should we wait for all backends to commit before returning ?




Constructor Detail
AbstractLoadBalancer
protected AbstractLoadBalancer(VirtualDatabase vdb, int raidbLevel, int parsingGranularity) throws SQLException(Code)
Generic constructor that sets some member variables and checks that backends are in the disabled state
Parameters:
  vdb - The virtual database this load balancer belongs to
Parameters:
  raidbLevel - The RAIDb level of this load balancer
Parameters:
  parsingGranularity - The parsing granularity needed by this loadbalancer




Method Detail
abort
abstract public void abort(TransactionMetaData tm) throws SQLException(Code)
Abort a transaction and all its currently pending or executing queries.
Parameters:
  tm - The transaction marker metadata
throws:
  SQLException - if an error occurs



acquireLockAndCheckNbOfThreads
protected int acquireLockAndCheckNbOfThreads(Object request, String requestDescription) throws SQLException, NoMoreBackendException(Code)
Acquire the given lock and check the number of threads. Throw a NoMoreBackendException if no thread is available else returns the number of threads.
Parameters:
  request - object to remove from the total order queue in case nobackend is available
Parameters:
  requestDescription - description of the request to put in the errormessage in case of an error the number of threads in the acquired list
throws:
  SQLException - if there was a problem to acquire the lock on theenabled backend list
throws:
  NoMoreBackendException - if no backends are available anymore



begin
abstract public void begin(TransactionMetaData tm) throws SQLException(Code)
Begin a new transaction.
Parameters:
  tm - The transaction marker metadata
throws:
  SQLException - if an error occurs



callableStatementExecute
abstract public ExecuteResult callableStatementExecute(StoredProcedure proc, MetadataCache metadataCache) throws AllBackendsFailedException, SQLException(Code)
Call a stored procedure that returns multiple results.
Parameters:
  proc - the stored procedure call
Parameters:
  metadataCache - MetadataCache (null if none) an ExecuteResult object
throws:
  AllBackendsFailedException - if all backends failed to execute therequest
throws:
  SQLException - if an error occurs



callableStatementExecuteQuery
abstract public ControllerResultSet callableStatementExecuteQuery(StoredProcedure proc, MetadataCache metadataCache) throws AllBackendsFailedException, SQLException(Code)
Call a stored procedure that returns a ResultSet. This stored procedure can possibly perform writes and will therefore be executed by all nodes.
Parameters:
  proc - the stored procedure call
Parameters:
  metadataCache - MetadataCache (null if none) a ControllerResultSet value
throws:
  AllBackendsFailedException - if all backends failed to execute therequest
exception:
  SQLException - if an error occurs



callableStatementExecuteUpdate
abstract public ExecuteUpdateResult callableStatementExecuteUpdate(StoredProcedure proc) throws AllBackendsFailedException, SQLException(Code)
Call a stored procedure that performs an update.
Parameters:
  proc - the stored procedure call number of rows affected
throws:
  AllBackendsFailedException - if all backends failed to execute therequest
throws:
  SQLException - if an error occurs



closePersistentConnection
abstract public void closePersistentConnection(String login, long persistentConnectionId) throws SQLException(Code)
Close a persistent connection.
Parameters:
  login - login requesting the connection closing
Parameters:
  persistentConnectionId - id of the persistent connection to close
throws:
  SQLException - if an error occurs



commit
abstract public void commit(TransactionMetaData tm) throws AllBackendsFailedException, SQLException(Code)
Commit a transaction.
Parameters:
  tm - The transaction marker metadata
throws:
  AllBackendsFailedException - if all backends failed to execute therequest
throws:
  SQLException - if an error occurs



disableBackend
abstract public void disableBackend(DatabaseBackend db, boolean forceDisable) throws SQLException(Code)
Disable a backend without further check. Ask the corresponding connection manager to finalize the connections if needed. This method should not be called directly but instead should access the RequestManager.disableBackend(...) method.
Parameters:
  db - The database backend to disable
Parameters:
  forceDisable - true if disable must be forced
throws:
  SQLException - if an error occurs



enableBackend
abstract public void enableBackend(DatabaseBackend db, boolean writeEnabled) throws SQLException(Code)
Enable a backend without further check. The backend is at least read enabled but could also be enabled for writes. Ask the corresponding connection manager to initialize the connections if needed.
Parameters:
  db - The database backend to enable
Parameters:
  writeEnabled - True if the backend must be enabled for writes
throws:
  SQLException - if an error occurs



executeCallableStatementExecuteOnBackend
final public static ExecuteResult executeCallableStatementExecuteOnBackend(StoredProcedure proc, DatabaseBackend backend, BackendWorkerThread workerThread, PooledConnection pc, MetadataCache metadataCache) throws SQLException, BadConnectionException(Code)
Execute a stored procedure that returns multiple results on the given backend. The callable statement is setXXX if the driver has not processed the statement.
Parameters:
  proc - the stored procedure to execute
Parameters:
  backend - the backend on which to execute the stored procedure
Parameters:
  workerThread - the backend worker thread executing this query (or nullif none)
Parameters:
  c - the connection on which to execute the stored procedure
Parameters:
  metadataCache - the matedatacache to build the ControllerResultSet an ExecuteResult object
throws:
  SQLException - if an error occurs
throws:
  BadConnectionException - if the connection was bad



executeCallableStatementExecuteQueryOnBackend
final public static ControllerResultSet executeCallableStatementExecuteQueryOnBackend(StoredProcedure proc, DatabaseBackend backend, BackendWorkerThread workerThread, Connection c, MetadataCache metadataCache) throws SQLException, BadConnectionException(Code)
Execute a read stored procedure on the given backend. The callable statement is setXXX if the driver has not processed the statement.

Parameters:
  proc - the stored procedure to execute
Parameters:
  backend - the backend on which to execute the stored procedure
Parameters:
  workerThread - the backend worker thread executing this query (or nullif none)
Parameters:
  c - the connection on which to execute the stored procedure
Parameters:
  metadataCache - the matedatacache to build the ControllerResultSet the controllerResultSet
throws:
  SQLException - if an error occurs
throws:
  BadConnectionException - if the connection was bad



executeCallableStatementExecuteUpdateOnBackend
final public static ExecuteUpdateResult executeCallableStatementExecuteUpdateOnBackend(StoredProcedure proc, DatabaseBackend backend, BackendWorkerThread workerThread, PooledConnection pc) throws SQLException, BadConnectionException(Code)
Execute a write stored procedure on the given backend. The callable statement is setXXX if the driver has not processed the statement.
Parameters:
  proc - the stored procedure to execute
Parameters:
  backend - the backend on which to execute the stored procedure
Parameters:
  workerThread - the backend worker thread executing this query (or nullif none)
Parameters:
  c - the connection on which to execute the stored procedure the number of updated rows
throws:
  SQLException - if an error occurs
throws:
  BadConnectionException - if the connection was bad



executeStatementExecuteOnBackend
final public static ExecuteResult executeStatementExecuteOnBackend(AbstractRequest request, DatabaseBackend backend, BackendWorkerThread workerThread, PooledConnection pc, MetadataCache metadataCache) throws SQLException, BadConnectionException(Code)
Execute a request that returns multiple results on the given backend. The statement is setXXX if the driver has not processed the statement.
Parameters:
  request - the request to execute
Parameters:
  backend - the backend on which to execute the stored procedure
Parameters:
  workerThread - the backend worker thread executing this query (or nullif none)
Parameters:
  pc - the connection on which to execute the stored procedure
Parameters:
  metadataCache - the matedatacache to build the ControllerResultSet an ExecuteResult object
throws:
  SQLException - if an error occurs
throws:
  BadConnectionException - if the connection was bad



executeStatementExecuteQueryOnBackend
final public static ControllerResultSet executeStatementExecuteQueryOnBackend(SelectRequest request, DatabaseBackend backend, BackendWorkerThread workerThread, Connection c, MetadataCache metadataCache) throws SQLException, BadConnectionException, UnreachableBackendException(Code)
Execute a statement on a backend. If the execution fails, the connection is checked for validity. If the connection was not valid, the query is automatically retried on a new connection.

Parameters:
  request - the request to execute
Parameters:
  backend - the backend on which the request is executed
Parameters:
  workerThread - the backend worker thread executing this query (or nullif none)
Parameters:
  c - connection used to create the statement
Parameters:
  metadataCache - MetadataCache (null if none) the ControllerResultSet
throws:
  SQLException - if an error occurs
throws:
  BadConnectionException - if the connection was bad
throws:
  UnreachableBackendException - if the backend is unreachable



executeStatementExecuteUpdateOnBackend
final public static ExecuteUpdateResult executeStatementExecuteUpdateOnBackend(AbstractWriteRequest request, DatabaseBackend backend, BackendWorkerThread workerThread, PooledConnection pc) throws SQLException, BadConnectionException(Code)
Execute an update prepared statement on a backend. If the execution fails, the connection is checked for validity. If the connection was not valid, the query is automatically retried on a new connection.
Parameters:
  request - the request to execute
Parameters:
  backend - the backend on which the request is executed
Parameters:
  workerThread - the backend worker thread executing this query (or nullif none)
Parameters:
  pc - pooled connection used to create the statement int Number of rows effected
throws:
  SQLException - if an error occurs
throws:
  BadConnectionException - if the connection was bad



executeStatementExecuteUpdateWithKeysOnBackend
final public static GeneratedKeysResult executeStatementExecuteUpdateWithKeysOnBackend(AbstractWriteRequest request, DatabaseBackend backend, BackendWorkerThread workerThread, PooledConnection pc, MetadataCache metadataCache) throws SQLException, BadConnectionException(Code)
Execute an update prepared statement on a backend. If the execution fails, the connection is checked for validity. If the connection was not valid, the query is automatically retried on a new connection.
Parameters:
  request - the request to execute
Parameters:
  backend - the backend on which the request is executed
Parameters:
  workerThread - the backend worker thread executing this query (or nullif none)
Parameters:
  pc - connection used to create the statement
Parameters:
  metadataCache - MetadataCache (null if none) ControllerResultSet containing the auto-generated keys
throws:
  SQLException - if an error occurs
throws:
  BadConnectionException - if the connection was bad



getConnectionAndBeginTransaction
final public static Connection getConnectionAndBeginTransaction(DatabaseBackend backend, AbstractConnectionManager cm, AbstractRequest request) throws SQLException, UnreachableBackendException(Code)
Factorized code to start a transaction on a backend and to retrieve a connection on this backend
Parameters:
  backend - the backend needed to check valid connection against thisbackend test statement
Parameters:
  cm - the connection manager to use to retrieve connections
Parameters:
  request - request that will execute (must carry transaction id andtransaction isolation level (does nothing if equals toConnection.DEFAULT_TRANSACTION_ISOLATION_LEVEL)) a valid connection with a started transaction
throws:
  SQLException - if the backend is valid but set autocommit cannot beset to false
throws:
  UnreachableBackendException - if the backend is not reachable, ie notvalid connection can be retrieved
See Also:   org.continuent.sequoia.driver.Connection.DEFAULT_TRANSACTION_ISOLATION_LEVEL



getDefaultTransactionIsolationLevel
final public static int getDefaultTransactionIsolationLevel()(Code)
Returns the defaultTransactionIsolationLevel value. Returns the defaultTransactionIsolationLevel.



getInformation
abstract public String getInformation()(Code)
Get information about the Request Load Balancer String containing information



getNbToWait
protected int getNbToWait(int nbOfThreads)(Code)
Returns the number of nodes to wait for according to the defined waitForCompletion policy.
Parameters:
  nbOfThreads - total number of threads int number of threads to wait for



getNumberOfEnabledBackends
public int getNumberOfEnabledBackends()(Code)
Get the number of currently enabled backends. 0 means that no backend is available. number of currently enabled backends



getParsingGranularity
public int getParsingGranularity()(Code)
Get the needed query parsing granularity. needed query parsing granularity



getPreparedStatementGetMetaData
abstract public ControllerResultSet getPreparedStatementGetMetaData(AbstractRequest request) throws SQLException(Code)
Return a ControllerResultSet containing the PreparedStatement metaData of the given sql template
Parameters:
  request - the request containing the sql template an empty ControllerResultSet with the metadata
throws:
  SQLException - if a database error occurs



getRAIDbLevel
public int getRAIDbLevel()(Code)
Returns the RAIDbLevel. int the RAIDb level



getRecoveryLog
final public RecoveryLog getRecoveryLog()(Code)
Returns the recoveryLog value. Returns the recoveryLog.



getXml
public String getXml()(Code)

See Also:   org.continuent.sequoia.common.xml.XmlComponent.getXml



getXmlImpl
abstract public String getXmlImpl()(Code)
Get information about the Request Load Balancer in xml String containing information, xml formatted



handleMacros
public void handleMacros(AbstractRequest request)(Code)
Interprets the macros in the request (depending on the MacroHandler set for this class) and modify either the skeleton or the query itself. Note that the given object is directly modified.
Parameters:
  request - the request to process



openPersistentConnection
abstract public void openPersistentConnection(String login, long persistentConnectionId) throws SQLException(Code)
Open a persistent connection.
Parameters:
  login - login requesting the connection closing
Parameters:
  persistentConnectionId - id of the persistent connection to open
throws:
  SQLException - if an error occurs



preparedStatementGetMetaDataOnBackend
final public static ControllerResultSet preparedStatementGetMetaDataOnBackend(String sqlTemplate, DatabaseBackend backend, Connection c) throws SQLException, BadConnectionException(Code)
Get PreparedStatement metadata before the statement is executed.
Parameters:
  sqlTemplate - the PreparedStatement sql template
Parameters:
  backend - the backend on which we execute the request
Parameters:
  c - the connection to create the statement from an empty ResultSet with the associated metadata
throws:
  SQLException - if an error occurs
throws:
  BadConnectionException - if the databsae connection was bad



readOnlyCallableStatementExecute
abstract public ExecuteResult readOnlyCallableStatementExecute(StoredProcedure proc, MetadataCache metadataCache) throws SQLException(Code)
Call a read-only stored procedure that returns multiple results. The stored procedure will be executed by one node only.
Parameters:
  proc - the stored procedure call
Parameters:
  metadataCache - MetadataCache (null if none) a ExecuteResult object containing all results
exception:
  SQLException - if an error occurs



readOnlyCallableStatementExecuteQuery
abstract public ControllerResultSet readOnlyCallableStatementExecuteQuery(StoredProcedure proc, MetadataCache metadataCache) throws SQLException(Code)
Call a read-only stored procedure that returns a ResultSet. The stored procedure will be executed by one node only.
Parameters:
  proc - the stored procedure call
Parameters:
  metadataCache - MetadataCache (null if none) a ControllerResultSet value
exception:
  SQLException - if an error occurs



releaseLockAndUnlockNextQuery
protected void releaseLockAndUnlockNextQuery(Object currentQuery)(Code)
Release the backend list lock and remove the current query from the head of the total order queue to unlock the next query.
Parameters:
  currentQuery - the current query to remove from the total order queue



releaseSavepoint
abstract public void releaseSavepoint(TransactionMetaData tm, String name) throws AllBackendsFailedException, SQLException(Code)
Release a savepoint from a transaction
Parameters:
  tm - The transaction marker metadata
Parameters:
  name - The name of the savepoint ro release
throws:
  AllBackendsFailedException - if all backends failed to execute therequest
throws:
  SQLException - if an error occurs



removeObjectFromAndNotifyTotalOrderQueue
public void removeObjectFromAndNotifyTotalOrderQueue(Object request)(Code)
Remove an entry of the total order queue (usually the head) and notify the queue so that the next queries can be scheduled.
Parameters:
  request - Object that should be removed from the total order queue



rollback
abstract public void rollback(TransactionMetaData tm) throws AllBackendsFailedException, SQLException(Code)
Rollback a transaction.
Parameters:
  tm - The transaction marker metadata
throws:
  AllBackendsFailedException - if all backends failed to execute therequest
throws:
  SQLException - if an error occurs



rollbackToSavepoint
abstract public void rollbackToSavepoint(TransactionMetaData tm, String savepointName) throws AllBackendsFailedException, SQLException(Code)
Rollback a transaction to a savepoint
Parameters:
  tm - The transaction marker metadata
Parameters:
  savepointName - The name of the savepoint
throws:
  AllBackendsFailedException - if all backends failed to execute therequest
throws:
  SQLException - if an error occurs



setDefaultTransactionIsolationLevel
final public void setDefaultTransactionIsolationLevel(int defaultTransactionIsolationLevel)(Code)
Sets the defaultTransactionIsolationLevel value.
Parameters:
  defaultTransactionIsolationLevel - ThedefaultTransactionIsolationLevel to set.



setMacroHandler
public void setMacroHandler(MacrosHandler handler)(Code)
This sets the macro handler for this load balancer. Handling macros prevents different backends to generate different values when interpreting the macros which could result in data inconsitencies.
Parameters:
  handler - MacrosHandler instance



setRecoveryLog
final public void setRecoveryLog(RecoveryLog recoveryLog)(Code)
Sets the recoveryLog value.
Parameters:
  recoveryLog - The recoveryLog to set.



setSavepoint
abstract public void setSavepoint(TransactionMetaData tm, String name) throws AllBackendsFailedException, SQLException(Code)
Set a savepoint to a transaction.
Parameters:
  tm - The transaction marker metadata
Parameters:
  name - The name of the new savepoint
throws:
  AllBackendsFailedException - if all backends failed to execute therequest
throws:
  SQLException - if an error occurs



setWeight
public void setWeight(String name, int w) throws SQLException(Code)
Associate a weight to a backend identified by its logical name.
Parameters:
  name - the backend name
Parameters:
  w - the weight
throws:
  SQLException - if an error occurs



statementExecute
abstract public ExecuteResult statementExecute(AbstractRequest request, MetadataCache metadataCache) throws AllBackendsFailedException, SQLException(Code)
Call a request that returns multiple results.
Parameters:
  request - the request to execute
Parameters:
  metadataCache - MetadataCache (null if none) an ExecuteResult object
throws:
  AllBackendsFailedException - if all backends failed to execute therequest
throws:
  SQLException - if an error occurs



statementExecuteQuery
abstract public ControllerResultSet statementExecuteQuery(SelectRequest request, MetadataCache metadataCache) throws SQLException, AllBackendsFailedException(Code)
Perform a read request. It is up to the implementation to choose to which backend node(s) this request should be sent.
Parameters:
  request - an SelectRequest
Parameters:
  metadataCache - MetadataCache (null if none) the corresponding ControllerResultSet
exception:
  SQLException - if an error occurs
throws:
  AllBackendsFailedException - if all backends failed to execute therequest



statementExecuteUpdate
abstract public ExecuteUpdateResult statementExecuteUpdate(AbstractWriteRequest request) throws AllBackendsFailedException, NoMoreBackendException, SQLException(Code)
Perform a write request. This request should usually be broadcasted to all nodes.
Parameters:
  request - an AbstractWriteRequest number of rows affected by the request
throws:
  AllBackendsFailedException - if all backends failed to execute therequest
exception:
  NoMoreBackendException - if no backends are left to execute therequest
exception:
  SQLException - if an error occurs



statementExecuteUpdateWithKeys
abstract public GeneratedKeysResult statementExecuteUpdateWithKeys(AbstractWriteRequest request, MetadataCache metadataCache) throws AllBackendsFailedException, NoMoreBackendException, SQLException(Code)
Perform a write request and return a ResultSet containing the auto generated keys.
Parameters:
  request - an AbstractWriteRequest
Parameters:
  metadataCache - MetadataCache (null if none) auto generated keys
throws:
  AllBackendsFailedException - if all backends failed to execute therequest
exception:
  NoMoreBackendException - if no backends are left to execute therequest
exception:
  SQLException - if an error occurs



waitForSuspendWritesToComplete
public void waitForSuspendWritesToComplete(AbstractRequest request)(Code)
This will block the given request if there are any suspending task in progress (before the request in the total order queue).
Parameters:
  request - the request that we are processing



waitForTaskCompletion
public static void waitForTaskCompletion(long timeout, String requestDescription, AbstractTask task) throws SQLException(Code)
Wait for the completion of the given task. Note that this method must be called within a synchronized block on the task.
Parameters:
  timeout - timeout in ms for this task
Parameters:
  requestDescription - description of the request to put in the errormessage in case of a timeout
Parameters:
  task - the task to wait for completion
throws:
  SQLException - if the timeout has expired



waitForTotalOrder
public boolean waitForTotalOrder(Object request, boolean errorIfNotFound)(Code)
If we are executing in a distributed virtual database, we have to make sure that we post the query in the queue following the total order. This method does not remove the request from the total order queue. You have to call removeHeadFromAndNotifyTotalOrderQueue() to do so.
Parameters:
  request - the request to wait for (can be any object but usually aDistributedRequest, Commit or Rollback)
Parameters:
  errorIfNotFound - true if an error message should be logged if therequest is not found in the total order queue true if the element was found and wait has succeeded, falseotherwise
See Also:   AbstractLoadBalancer.removeHeadFromAndNotifyTotalOrderQueue(Object)



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.