Java Doc for DatabaseBackend.java in  » Database-JDBC-Connection-Pool » sequoia-2.10.9 » org » continuent » sequoia » controller » backend » 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.backend 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.continuent.sequoia.controller.backend.DatabaseBackend

DatabaseBackend
final public class DatabaseBackend implements XmlComponent(Code)
A DatabaseBackend represents a real database backend that will have to be bound to a virtual Sequoia database. All connections opened will use the same url but possibly different login/password.
author:
   Emmanuel Cecchet
author:
   Mathieu Peltier
author:
   Sara Bouchenak
author:
   Nicolas Modrzyk
author:
   Jean-Bernard van Zuylen
author:
  

author:
   Guillaume Smet
version:
   1.0


Field Summary
static  TraceendUserLogger
    
protected transient  Tracelogger
     Logger instance.

Constructor Summary
public  DatabaseBackend(String name, String driverPath, String driverClassName, String url, String vdbName, boolean writeCanBeEnabled, String connectionTestStatement, int nbOfWorkerThreads)
     Creates a new DatabaseBackend instance.
public  DatabaseBackend(BackendInfo info)
    
public  DatabaseBackend(String name, String driverPath, String driverClassName, String url, String vdbName, String connectionTestStatement, int nbOfWorkerThreads, String dynamicSchemaLevel)
     Additionnal constructor for setting a different dynamic schema level.

Method Summary
public  voidaddConnectionManager(String vLogin, AbstractConnectionManager connectionManager)
     Adds a ConnectionManager to this backend.
public  voidaddDefaultConnectionManager(VirtualDatabaseUser vdbUser)
     Adds a default connection manager on this backend for the specified user.
public  voidaddPendingReadRequest(AbstractRequest request)
     Adds a pending request to this backend.
Method is synchronized on pendingRequests field.
public  voidaddPendingTask(AbstractTask task)
     Adds a pending request to this backend.
Method is synchronized on pendingTasks field.
public  voidaddPendingWriteRequest(AbstractRequest request)
     Adds a pending write request to this backend.
Method is synchronized on pendingRequests field.
public  voidaddPersistentConnection(long persistentConnectionId, PooledConnection c)
    
public  voidaddRewritingRule(AbstractRewritingRule rule)
     Add a AbstractRewritingRule at the end of the rule list.
public  voidaddSavepoint(Long tid, Savepoint savepoint)
    
public  voidaddStoredProcedureSemantic(String procedureName, int parameterCount, DatabaseProcedureSemantic semantic)
    
public  booleancanAcceptTasks(AbstractRequest request)
     Returns true if the backend is in a state that allows it to accept tasks or the execution of the specified request.
Parameters:
  request - the request that is going to execute in that task (null ifnot applicable).
public  booleancanAcceptTasks(long persistentConnectionId)
     Returns true if the backend is in a state that allows it to accept tasks or the execution for the specified persistent connection.
Parameters:
  persistentConnectionId - the persistent connection id of the requestthat is going to execute .
public synchronized  booleancheckDatabaseSchema(Connection c)
     Checks that the current database schema is compatible with all schema gathered from each connection manager.
public  voidcheckDriverCompliance()
     Check if the driver used by this backend is compliant with Sequoia needs.
public  voidclearPersistentConnectionWarnings(long connId)
    
public  DatabaseBackendcopy(String newName, Map parameters)
     Returns a deeply copied clone of this backend.
public synchronized  booleandisable()
     Sets the database backend state to disable.
public synchronized  voiddisableRead()
     Disables the database backend for reads.
public synchronized  voiddisableWrite()
     Disables the database backend for writes.
public synchronized  voidenableRead()
     Enables the database backend for reads.
public synchronized  voidenableWrite()
     Enables the database backend for writes.
public  booleanequals(Object other)
     Two database backends are considered equal if they have the same name, URL and driver class name.
public synchronized  voidfinalizeConnections()
     Releases all the connections to the database held by the connection managers.
public  voidflagAllConnectionsForRenewal()
     Force all connections to be renewed when they are used next.
public  ArrayListgetActiveTransactions()
    
public  String[]getBackendData()
     Get data about this backend.
public  BackendStatisticsgetBackendStats()
     Get the statistics of the backend.
public  BackendWorkerThreadgetBackendWorkerThreadForNotification()
     Return the first available BackendWorkerThread.
public  ConnectiongetConnectionForTransactionAndLazyBeginIfNeeded(AbstractRequest request, AbstractConnectionManager cm)
     Retrieve a connection for a given transaction or create a new connection and start a new transaction.
public  AbstractConnectionManagergetConnectionManager(String vLogin)
     Returns the ConnectionManager associated to this backend for a given virtual login.
public  StringgetConnectionTestStatement()
     Returns the SQL statement to use to check the connection validity.
public  StringgetDatabaseProductName()
     Returns the databaseProductName value.
public synchronized  DatabaseSchemagetDatabaseSchema()
     Returns the schema of this database. the schema of this database.
public  MetadataContainergetDatabaseStaticMetadata()
     Get the Database static metadata from this backend using a connection from the first available connection manager.
public  DatabaseProcedureSemanticgetDefaultStoredProcedureSemantic()
     Returns the default Stored Procedure Semantic value.
public  StringgetDriverClassName()
     Returns the database native JDBC driver class name.
public  DriverCompliancegetDriverCompliance()
    
public  StringgetDriverPath()
     Returns the driver path.
public  intgetDynamicPrecision()
    
public  StringgetLastKnownCheckpoint()
     Returns the lastKnownCheckpoint value.
public  TracegetLogger()
    
public  StringgetName()
     Returns the backend logical name.
public  intgetNbOfWorkerThreads()
     Returns the nbOfWorkerThreads value.
public  VectorgetPendingRequests()
     Returns the list of pending requests for this backend.
public  ArrayListgetPendingRequestsDescription(int count, boolean fromFirst, boolean clone)
     Returns the list of pending requests for this backend.
public  SQLWarninggetPersistentConnectionWarnings(long connId)
    
public  SavepointgetSavepoint(Long tid, String savepointName)
     Returns a Savepoint identified its name for a given transaction or null if no such Savepoint exists.
public  StringgetSchemaName()
     Returns the schemaName value.
public  StringgetSchemaXml(boolean expandSchema)
     The getXml() method does not return the schema if it is not static anymore, to avoid confusion between static and dynamic schema.
public  intgetSqlShortFormLength()
     Return the sql short form length to use when reporting an error.
public  StringgetState()
     Retrieve the state of the backend.
public  intgetStateValue()
     Return the integer value corresponding to the state of the backend.
public  CollectiongetTables()
     Get all the names of tables of this database NOTE: The returned collection will contain two entries per actual table: one with the table name alone, the other prefixed by the schema name + ".".
public  BackendTaskQueuesgetTaskQueues()
     Returns the taskQueues value.
public  longgetTotalActiveConnections()
    
public  intgetTotalReadRequest()
     Returns the total number of read requests executed by this backend.
public  intgetTotalRequest()
     Returns the total number of requests executed by this backend.
public  intgetTotalTransactions()
     Returns the total number of transactions executed by this backend.
public  intgetTotalWriteRequest()
     Returns the total number of write requests executed by this backend.
public  StringgetURL()
     Returns the JDBC URL used to access the database.
public  StringgetVirtualDatabaseName()
     Returns the virtual database name this backend belongs to.
public synchronized  StringgetXml()
     Get xml information about this backend.
public  booleanhasPersistentConnections()
     Returns true if this DatabaseBackend has persistent connections, false else.
public  booleanhasStoredProcedure(String procedureName, int nbOfParameters)
     Returns true if this backend has the given stored procedure in its schema.
public  booleanhasTable(String table)
     Returns true if this backend has the given table in its schema.
public  booleanhasTables(Collection tables)
     Returns true if this backend has the given list of tables in its schema.
public  inthashCode()
    
public synchronized  voidinitializeConnections()
     Initializes the connection managers' connections.
public  booleanisBackuping()
     Returns the isBackuping value.
public  booleanisDisabled()
     Is the backend completely disabled ? This usually means it has a known state with a checkpoint associated to it.
public  booleanisDisabling()
     Returns the isDisabling value.
public  booleanisGatherSystemTables()
     Returns the gatherSystemTables value.
public synchronized  booleanisInitialized()
    
public synchronized  booleanisJDBCConnected()
    
public  booleanisKilled()
    
public synchronized  booleanisReadEnabled()
     Tests if this backend is read enabled (active and synchronized).
public  booleanisReplaying()
    
public  booleanisRestoring()
    
public  booleanisSchemaDirty()
     Returns the schemaIsDirty value.
public  booleanisSchemaStatic()
    
public  booleanisStartedTransaction(Long tid)
     Returns true if the specified transaction has been started on this backend (a connection has been allocated for this transaction).
public  booleanisValidBackendUser(VirtualDatabaseUser vdbUser)
     Check if the given vdb user is a valid user for this backend.
Parameters:
  vdbUser - to be checked.
public  booleanisValidConnection(Connection connection)
     Check if the given connection is valid or not.
public  booleanisWriteCanBeEnabled()
     Returns the writeCanBeEnabled value.
public synchronized  booleanisWriteEnabled()
     Tests if this backend is write enabled (active and synchronized).
public  voidnotifyJmx(String type)
    
public  voidnotifyJmxError(String type, Exception e)
     Sends JMX error notification
Parameters:
  e - Exception object.
public  voidremoveConnectionManager(VirtualDatabaseUser vdbUser)
     Removes a ConnectionManager to this backend.
public  booleanremovePendingRequest(AbstractRequest request)
     Removes a pending request from this backend.
public  booleanremovePendingTask(AbstractTask task)
     Removes a pending task from this backend.
public  voidremovePersistentConnection(long persistentConnectionId)
    
public  voidremoveSavepoint(Long tid, Savepoint savepoint)
    
public  StringrewriteQuery(String sqlQuery)
     Rewrite the current query according to the rewriting rules.
public synchronized  voidsetDatabaseSchema(DatabaseSchema databaseSchema, boolean isStatic)
     Sets the database schema.
public  voidsetDefaultConnectionManager(AbstractConnectionManager defaultConnectionManager)
     Sets the default connection manager used for the transparent login feature.
public  voidsetDefaultStoredProcedureSemantic(DatabaseProcedureSemantic defaultSemantic)
     Set the default Stored Procedure semantic definition.
public  voidsetDisabling()
     This is used when the backend must be disabled but currently open transactions must terminate.
public  voidsetDynamicPrecision(int dynamicPrecision, boolean gatherSystemTables, String schemaName)
     Set the amount of information that must be gathered when fetching database schema information.
public  voidsetLastKnownCheckpoint(String checkpoint)
    
public  voidsetNbOfWorkerThreads(int nbOfWorkerThreads)
     Sets the nbOfWorkerThreads value.
public  voidsetNotificationBroadcaster(NotificationBroadcasterSupport notificationBroadcaster)
     Sets the NotificationBroadcasterSupport that this backend can use to send JMX notification.
public  voidsetSchemaIsDirty(boolean schemaIsDirty, AbstractRequest request)
     Sets the schemaIsDirty value if the backend schema needs to be refreshed.
public  voidsetSchemaIsNeededByVdb(boolean schemaIsNeededByVdb)
     Sets the schemaIsNeededByVdb value.
public  voidsetSqlShortFormLength(int sqlShortFormLength)
     Sets the sqlShortFormLength value.
public synchronized  voidsetState(int state)
    
public  voidsetStateListener(BackendStateListener stateListener)
     Sets the stateListener value.
public  voidsetTaskQueues(BackendTaskQueues taskQueues)
     Sets the taskQueues value.
public synchronized  voidshutdownConnectionManagers()
     Tell all the connection managers to stop handing out new Connections.
public  voidstartDeadlockDetectionThread(VirtualDatabase vdb)
     Start a new Deadlock Detection Thread (throws a RuntimeException if called twice without stopping the thread before the second call).
public  voidstartTransaction(Long tid)
     Signals that a transaction has been started on this backend.
public  voidstartWorkerThreads(AbstractLoadBalancer loadBalancer)
     Start the BackendWorkerThreads for this backend.
public  voidstopTransaction(Long tid)
     Signals that a transaction has been stopped on this backend.
public  voidterminateDeadlockDetectionThread()
     Terminate the Deadlock Detection Thread.
public  voidterminateWorkerThreads()
     Terminate all worker threads.
public  voidterminateWorkerThreads(boolean wait)
     Terminate all worker threads.
public static  ListtoBackendInfos(List backends)
     Convert a <DatabaseBackend>List to a <BackendInfo>List.

The DatabaseBackend objects cannot be serialized because they are used as MBean and notification emitters, so we want to extract the BackendInfo (which are Serializable) out of them.

This method does not keep the XML configuration of the BackendInfo objects.

public  StringtoString()
    
public  voidupdateDatabaseBackendSchema(AbstractWriteRequest request)
     Update the DatabaseBackend schema definition according to the successful execution of the provided request.
public  voidwaitForAllTransactionsAndPersistentConnectionsToComplete()
     This method waits until all currently open transactions and persistent connections on this backend complete.

Field Detail
endUserLogger
static Trace endUserLogger(Code)



logger
protected transient Trace logger(Code)
Logger instance.




Constructor Detail
DatabaseBackend
public DatabaseBackend(String name, String driverPath, String driverClassName, String url, String vdbName, boolean writeCanBeEnabled, String connectionTestStatement, int nbOfWorkerThreads)(Code)
Creates a new DatabaseBackend instance.
Parameters:
  name - logical name assigned to this backend
Parameters:
  driverPath - path for driver
Parameters:
  driverClassName - class name of the database native JDBC driver toload
Parameters:
  url - URL to access the database
Parameters:
  vdbName - Name of the virtual database this backend is attached to
Parameters:
  writeCanBeEnabled - if writes can be enabled on this backend
Parameters:
  connectionTestStatement - SQL statement used to check if a connectionis still valid
Parameters:
  nbOfWorkerThreads - defines the number of BackendWorkerThread thatshould process writes in parallel (minimum is 2)



DatabaseBackend
public DatabaseBackend(BackendInfo info)(Code)
Creates a new DatabaseBackend object
Parameters:
  info - a backend info object to create a database backend object from



DatabaseBackend
public DatabaseBackend(String name, String driverPath, String driverClassName, String url, String vdbName, String connectionTestStatement, int nbOfWorkerThreads, String dynamicSchemaLevel)(Code)
Additionnal constructor for setting a different dynamic schema level. Default was to gather all information Creates a new DatabaseBackend instance.
Parameters:
  name - logical name assigned to this backend
Parameters:
  driverPath - path for driver
Parameters:
  driverClassName - class name of the database native JDBC driver toload
Parameters:
  url - URL to access the database
Parameters:
  vdbName - Name of the virtual database this backend is attached to
Parameters:
  connectionTestStatement - SQL statement used to check if a connectionis still valid
Parameters:
  nbOfWorkerThreads - defines the number of BackendWorkerThread thatshould process writes in parallel (minimum is 2)
Parameters:
  dynamicSchemaLevel - for dynamically gathering schema from backend




Method Detail
addConnectionManager
public void addConnectionManager(String vLogin, AbstractConnectionManager connectionManager)(Code)
Adds a ConnectionManager to this backend. Note that the ConnectionManager is not initialized in this method.
Parameters:
  vLogin - the virtual login corresponding to this connection manager
Parameters:
  connectionManager - the ConnectionManager to add



addDefaultConnectionManager
public void addDefaultConnectionManager(VirtualDatabaseUser vdbUser) throws SQLException(Code)
Adds a default connection manager on this backend for the specified user. The default connection manager should be specified in the vdb config file.
Parameters:
  vdbUser - user for whom the connnection manager will be added.
throws:
  SQLException - if connection manager could not be initialized.



addPendingReadRequest
public void addPendingReadRequest(AbstractRequest request)(Code)
Adds a pending request to this backend.
Method is synchronized on pendingRequests field.
Parameters:
  request - the request to add
See Also:   DatabaseBackend.pendingRequests



addPendingTask
public void addPendingTask(AbstractTask task)(Code)
Adds a pending request to this backend.
Method is synchronized on pendingTasks field.
Parameters:
  task - the task to add
See Also:   DatabaseBackend.pendingTasks



addPendingWriteRequest
public void addPendingWriteRequest(AbstractRequest request)(Code)
Adds a pending write request to this backend.
Method is synchronized on pendingRequests field.
Parameters:
  request - the request to add
See Also:   DatabaseBackend.pendingRequests



addPersistentConnection
public void addPersistentConnection(long persistentConnectionId, PooledConnection c)(Code)
Add a persistent connection to this backend
Parameters:
  persistentConnectionId - id of the persistent connection to add
Parameters:
  c - the persistent connection to add



addRewritingRule
public void addRewritingRule(AbstractRewritingRule rule)(Code)
Add a AbstractRewritingRule at the end of the rule list.
Parameters:
  rule - a AbstractRewritingRule



addSavepoint
public void addSavepoint(Long tid, Savepoint savepoint)(Code)
Adds a savepoint to a given transaction
Parameters:
  tid - transaction identifier
Parameters:
  savepoint - savepoint to add



addStoredProcedureSemantic
public void addStoredProcedureSemantic(String procedureName, int parameterCount, DatabaseProcedureSemantic semantic)(Code)
Add a specific semantic to a particular stored procedure
Parameters:
  procedureName - the stored procedure name
Parameters:
  parameterCount - the number of parameters of the stored procedure
Parameters:
  semantic - the semantic information



canAcceptTasks
public boolean canAcceptTasks(AbstractRequest request)(Code)
Returns true if the backend is in a state that allows it to accept tasks or the execution of the specified request.
Parameters:
  request - the request that is going to execute in that task (null ifnot applicable). Returns true if backend isReadEnabled() or isWriteEnabled() orisReplaying()



canAcceptTasks
public boolean canAcceptTasks(long persistentConnectionId)(Code)
Returns true if the backend is in a state that allows it to accept tasks or the execution for the specified persistent connection.
Parameters:
  persistentConnectionId - the persistent connection id of the requestthat is going to execute . Returns true if backend isReadEnabled() or isWriteEnabled() orisReplaying()



checkDatabaseSchema
public synchronized boolean checkDatabaseSchema(Connection c)(Code)
Checks that the current database schema is compatible with all schema gathered from each connection manager.

If no schema has been defined, the first gathered schema is used as the current database schema.

For each schema that is not compatible with the current schema, a warning is issued on the logger for that backend
Parameters:
  c - optional connection from which the schema should be fetched (nullif not applicable) true if compatible, false otherwise




checkDriverCompliance
public void checkDriverCompliance() throws SQLException(Code)
Check if the driver used by this backend is compliant with Sequoia needs.
throws:
  SQLException - if the driver is not compliant



clearPersistentConnectionWarnings
public void clearPersistentConnectionWarnings(long connId) throws SQLException(Code)
Clears the SQLWarning chained to the given persistent connection
Parameters:
  connId - persistent connection id to retrieve warnings from
exception:
  SQLException - if a database access error occurs



copy
public DatabaseBackend copy(String newName, Map parameters) throws Exception(Code)
Returns a deeply copied clone of this backend. Will use the same rewriting rules and will get new instance of connection managers with the same configuration
Parameters:
  newName - the new name for this new backend
Parameters:
  parameters - a set of parameters to use to replace values from thecopied backend.
The different parameters are:
  • driverPath: the path to the driver
  • driver: the driver class name
  • url: the url to connect to the database
  • connectionTestStatement: the query to test theconnection

DatabaseBackend instance
throws:
  Exception - if cannot proceed the copy



disable
public synchronized boolean disable()(Code)
Sets the database backend state to disable. This state is just an indication and it has no semantic effect. It is up to the request manager (especially the load balancer) to ensure that no more requests are sent to this backend. false if the backend was already in the disabled state, trueotherwise



disableRead
public synchronized void disableRead()(Code)
Disables the database backend for reads. This does not affect write ability



disableWrite
public synchronized void disableWrite()(Code)
Disables the database backend for writes. This does not affect read ability although the backend will not be coherent anymore as soon as a write as occured. This should be used in conjunction with a checkpoint to recover missing writes.



enableRead
public synchronized void enableRead()(Code)
Enables the database backend for reads. This method should only be called when the backend is synchronized with the others.



enableWrite
public synchronized void enableWrite()(Code)
Enables the database backend for writes. This method should only be called when the backend is synchronized with the others.



equals
public boolean equals(Object other)(Code)
Two database backends are considered equal if they have the same name, URL and driver class name.
Parameters:
  other - an object a boolean value



finalizeConnections
public synchronized void finalizeConnections() throws SQLException(Code)
Releases all the connections to the database held by the connection managers.
throws:
  SQLException - if an error occurs



flagAllConnectionsForRenewal
public void flagAllConnectionsForRenewal()(Code)
Force all connections to be renewed when they are used next. This just sets a flag and connections will be lazily replaced as needed.



getActiveTransactions
public ArrayList getActiveTransactions()(Code)
Returns the activeTransactions.



getBackendData
public String[] getBackendData()(Code)
Get data about this backend. Format is:
 data[0] = this.name;
 data[1] = this.driverClassName;
 data[2] = this.url;
 data[3] = String.valueOf(this.activeTransactions.size());
 data[4] = String.valueOf(this.pendingRequests.size());
 data[5] = String.valueOf(this.isReadEnabled());
 data[6] = String.valueOf(this.isWriteEnabled());
 data[7] = String.valueOf(this.isInitialized());
 data[8] = String.valueOf(this.schemaIsStatic);
 data[9] = String.valueOf(this.connectionManagers.size());
 data[10] = String.valueOf(getTotalActiveConnections());
 data[11] = String.valueOf(totalRequest);
 data[12] = String.valueOf(totalTransactions);
 data[13] = lastKnownCheckpoint;
 
an array of strings



getBackendStats
public BackendStatistics getBackendStats()(Code)
Get the statistics of the backend. a BackendStatistics



getBackendWorkerThreadForNotification
public BackendWorkerThread getBackendWorkerThreadForNotification()(Code)
Return the first available BackendWorkerThread. This should only be used for notification of request abort. a BackendWorkerThread or null if none exists



getConnectionForTransactionAndLazyBeginIfNeeded
public Connection getConnectionForTransactionAndLazyBeginIfNeeded(AbstractRequest request, AbstractConnectionManager cm) throws UnreachableBackendException, NoTransactionStartWhenDisablingException, SQLException(Code)
Retrieve a connection for a given transaction or create a new connection and start a new transaction.
This method is internally synchronized on a mutex so that concurrent writes within the same transaction that are allowed to execute out of order will not open separate connection if they race on transaction begin.
Parameters:
  request - request that will execute (must carry transaction id andtransaction isolation level (does nothing if equals toConnection.DEFAULT_TRANSACTION_ISOLATION_LEVEL))
Parameters:
  cm - connection manager to get the connection from the connection for the given transaction id
throws:
  UnreachableBackendException - if the backend is no more reachable
throws:
  NoTransactionStartWhenDisablingException - if a new transactionneeded to be started but the backend is in the disabling state
throws:
  SQLException - if another error occurs
See Also:   DatabaseBackend.connectionMutex



getConnectionManager
public AbstractConnectionManager getConnectionManager(String vLogin)(Code)
Returns the ConnectionManager associated to this backend for a given virtual login.
Parameters:
  vLogin - the virtual login an AbstractConnectionManager instance



getConnectionTestStatement
public String getConnectionTestStatement()(Code)
Returns the SQL statement to use to check the connection validity. a String containing a SQL statement



getDatabaseProductName
public String getDatabaseProductName()(Code)
Returns the databaseProductName value. Returns the databaseProductName.



getDatabaseSchema
public synchronized DatabaseSchema getDatabaseSchema()(Code)
Returns the schema of this database. the schema of this database. Returns null if theschema has not been set.
See Also:   DatabaseBackend.setDatabaseSchema(DatabaseSchema,boolean)



getDatabaseStaticMetadata
public MetadataContainer getDatabaseStaticMetadata()(Code)
Get the Database static metadata from this backend using a connection from the first available connection manager. Static metadata information



getDefaultStoredProcedureSemantic
public DatabaseProcedureSemantic getDefaultStoredProcedureSemantic()(Code)
Returns the default Stored Procedure Semantic value. Returns the defaultStoredProcedureSemantic.



getDriverClassName
public String getDriverClassName()(Code)
Returns the database native JDBC driver class name. the driver class name



getDriverCompliance
public DriverCompliance getDriverCompliance()(Code)
the driver compliance to Sequoia requirements.



getDriverPath
public String getDriverPath()(Code)
Returns the driver path. the driver path



getDynamicPrecision
public int getDynamicPrecision()(Code)
Returns the dynamicPrecision.



getLastKnownCheckpoint
public String getLastKnownCheckpoint()(Code)
Returns the lastKnownCheckpoint value. Returns the lastKnownCheckpoint.



getLogger
public Trace getLogger()(Code)
Get the log4j logger for this backend the logger for this backend



getName
public String getName()(Code)
Returns the backend logical name. the backend logical name



getNbOfWorkerThreads
public int getNbOfWorkerThreads()(Code)
Returns the nbOfWorkerThreads value. Returns the nbOfWorkerThreads.



getPendingRequests
public Vector getPendingRequests()(Code)
Returns the list of pending requests for this backend. Vector of AbstractRequests orAbstractTask objects



getPendingRequestsDescription
public ArrayList getPendingRequestsDescription(int count, boolean fromFirst, boolean clone)(Code)
Returns the list of pending requests for this backend.
Parameters:
  count - number of requests to retrieve, if 0, return all.
Parameters:
  fromFirst - count the request from first if true, or from last iffalse
Parameters:
  clone - should clone the pending request if true, block it if false ArrayList of String description ofeach request.



getPersistentConnectionWarnings
public SQLWarning getPersistentConnectionWarnings(long connId) throws SQLException(Code)
Retrieves the SQLWarning chained to the given persistent connection
Parameters:
  connId - persistent connection id to retrieve warnings from
exception:
  SQLException - if a database access error occurs or this method iscalled on a closed connection the warnings on the given connection or null



getSavepoint
public Savepoint getSavepoint(Long tid, String savepointName)(Code)
Returns a Savepoint identified its name for a given transaction or null if no such Savepoint exists.
Parameters:
  tid - transaction identifier
Parameters:
  savepointName - name of the savepoint a savepoint or null if there is no savepoint of thegiven savePointName for the transaction identifiedby the tid



getSchemaName
public String getSchemaName()(Code)
Returns the schemaName value. Returns the schemaName.



getSchemaXml
public String getSchemaXml(boolean expandSchema)(Code)
The getXml() method does not return the schema if it is not static anymore, to avoid confusion between static and dynamic schema. This method returns a static view of the schema, whatever the dynamic precision is.
Parameters:
  expandSchema - if we should force the schema to be expanded. This isneeded as the default getXml should call this method. an xml formatted string



getSqlShortFormLength
public int getSqlShortFormLength()(Code)
Return the sql short form length to use when reporting an error. sql short form length
See Also:   org.continuent.sequoia.controller.requests.AbstractRequest.getSqlShortForm(int)



getState
public String getState()(Code)
Retrieve the state of the backend.
See Also:   SequoiaNotificationList.VIRTUALDATABASE_BACKEND_DISABLED
See Also:   SequoiaNotificationList.VIRTUALDATABASE_BACKEND_RECOVERING
See Also:   SequoiaNotificationList.VIRTUALDATABASE_BACKEND_BACKINGUP
See Also:   SequoiaNotificationList.VIRTUALDATABASE_BACKEND_DISABLING
See Also:   SequoiaNotificationList.VIRTUALDATABASE_BACKEND_ENABLED
See Also:   SequoiaNotificationList.VIRTUALDATABASE_BACKEND_DISABLED one of the above



getStateValue
public int getStateValue()(Code)
Return the integer value corresponding to the state of the backend. The values are defined in BackendState int value
See Also:   BackendState



getTables
public Collection getTables()(Code)
Get all the names of tables of this database NOTE: The returned collection will contain two entries per actual table: one with the table name alone, the other prefixed by the schema name + ".".
See Also:   org.continuent.sequoia.common.sql.schema.DatabaseSchema.addTable(DatabaseTable) Collection of DatabaseTable



getTaskQueues
public BackendTaskQueues getTaskQueues()(Code)
Returns the taskQueues value. Returns the taskQueues.



getTotalActiveConnections
public long getTotalActiveConnections()(Code)
Get the total number of active connections for this backend number of active connections for allAbstractConnectionManager connected to this backend



getTotalReadRequest
public int getTotalReadRequest()(Code)
Returns the total number of read requests executed by this backend. Returns the totalReadRequest.



getTotalRequest
public int getTotalRequest()(Code)
Returns the total number of requests executed by this backend. Returns the totalRequest.



getTotalTransactions
public int getTotalTransactions()(Code)
Returns the total number of transactions executed by this backend. Total number of transactions.



getTotalWriteRequest
public int getTotalWriteRequest()(Code)
Returns the total number of write requests executed by this backend. Returns the totalWriteRequest.



getURL
public String getURL()(Code)
Returns the JDBC URL used to access the database. a JDBC URL



getVirtualDatabaseName
public String getVirtualDatabaseName()(Code)
Returns the virtual database name this backend belongs to. Returns the virtual database name.



getXml
public synchronized String getXml()(Code)
Get xml information about this backend. xml formatted information on this database backend.



hasPersistentConnections
public boolean hasPersistentConnections()(Code)
Returns true if this DatabaseBackend has persistent connections, false else. true if this DatabaseBackend has persistentconnections, false else



hasStoredProcedure
public boolean hasStoredProcedure(String procedureName, int nbOfParameters)(Code)
Returns true if this backend has the given stored procedure in its schema. The caller must ensure that the database schema has been defined, using the DatabaseBackend.setDatabaseSchema(DatabaseSchema,boolean) or DatabaseBackend.checkDatabaseSchema()
Parameters:
  procedureName - The stored procedure name to look for
Parameters:
  nbOfParameters - number of parameters of the stored procecdure true if the procedure has been found



hasTable
public boolean hasTable(String table)(Code)
Returns true if this backend has the given table in its schema. The caller must ensure that the database schema has been defined, using the DatabaseBackend.setDatabaseSchema(DatabaseSchema,boolean) or DatabaseBackend.checkDatabaseSchema()
Parameters:
  table - The table name to look for true if tables is found in the schema



hasTables
public boolean hasTables(Collection tables)(Code)
Returns true if this backend has the given list of tables in its schema. The caller must ensure that the database schema has been defined, using the DatabaseBackend.setDatabaseSchema(DatabaseSchema,boolean) or DatabaseBackend.checkDatabaseSchema() methods.
Parameters:
  tables - the list of table names (Collection ofString) to look for true if all the tables are found



hashCode
public int hashCode()(Code)

See Also:   java.lang.Object.hashCode



initializeConnections
public synchronized void initializeConnections() throws SQLException(Code)
Initializes the connection managers' connections. The caller must ensure that the driver has already been loaded else an exception will be thrown.
exception:
  SQLException - if an error occurs



isBackuping
public boolean isBackuping()(Code)
Returns the isBackuping value. Returns the isBackuping.



isDisabled
public boolean isDisabled()(Code)
Is the backend completely disabled ? This usually means it has a known state with a checkpoint associated to it. true if the backend is disabled



isDisabling
public boolean isDisabling()(Code)
Returns the isDisabling value. Returns the isDisabling.



isGatherSystemTables
public boolean isGatherSystemTables()(Code)
Returns the gatherSystemTables value. Returns the gatherSystemTables.



isInitialized
public synchronized boolean isInitialized() throws SQLException(Code)
Tests if this backend is initialized true if this backend is initialized
throws:
  SQLException - if an error occurs



isJDBCConnected
public synchronized boolean isJDBCConnected()(Code)
Is the backend accessible ? true if a jdbc connection is still possible from thecontroller



isKilled
public boolean isKilled()(Code)
Returns true if the backend cannot be used anymore Returns true if the backend was removed from activity by the loadbalancer



isReadEnabled
public synchronized boolean isReadEnabled()(Code)
Tests if this backend is read enabled (active and synchronized). true if this backend is enabled.



isReplaying
public boolean isReplaying()(Code)
Returns true if the backend is in the BackendState.REPLAYING state Returns true if the backend is replaying the recovery



isRestoring
public boolean isRestoring()(Code)
Returns true if the backend is in the BackendState.RECOVERING state Returns true if the backend is restoring a dump



isSchemaDirty
public boolean isSchemaDirty()(Code)
Returns the schemaIsDirty value. Returns true if the backend database schema is dirty and needs arefresh.



isSchemaStatic
public boolean isSchemaStatic()(Code)
Returns the schemaIsStatic.



isStartedTransaction
public boolean isStartedTransaction(Long tid)(Code)
Returns true if the specified transaction has been started on this backend (a connection has been allocated for this transaction).
Parameters:
  tid - transaction identifier true if the transaction has been started



isValidBackendUser
public boolean isValidBackendUser(VirtualDatabaseUser vdbUser)(Code)
Check if the given vdb user is a valid user for this backend.
Parameters:
  vdbUser - to be checked. true if the vdb user is valid, false otherwise.



isValidConnection
public boolean isValidConnection(Connection connection)(Code)
Check if the given connection is valid or not. This function issues the connectionTestStatement query on the connection and if it succeeds then the connection is declared valid. If an exception occurs, the connection is declared invalid.
Parameters:
  connection - the connection to test true if the connection is valid



isWriteCanBeEnabled
public boolean isWriteCanBeEnabled()(Code)
Returns the writeCanBeEnabled value. Returns the writeCanBeEnabled.



isWriteEnabled
public synchronized boolean isWriteEnabled()(Code)
Tests if this backend is write enabled (active and synchronized). true if this backend is enabled.



notifyJmx
public void notifyJmx(String type)(Code)
Sends JMX notification
Parameters:
  type - notification type
See Also:   SequoiaNotificationList



notifyJmxError
public void notifyJmxError(String type, Exception e)(Code)
Sends JMX error notification
Parameters:
  e - Exception object. Only the message will be used
Parameters:
  type - notification type
See Also:   SequoiaNotificationList



removeConnectionManager
public void removeConnectionManager(VirtualDatabaseUser vdbUser) throws SQLException(Code)
Removes a ConnectionManager to this backend. Note that the ConnectionManager is finalized in this method.
Parameters:
  vdbUser - the virtual user corresponding to this connection manager
throws:
  SQLException - if connection manager could not be finalized.



removePendingRequest
public boolean removePendingRequest(AbstractRequest request)(Code)
Removes a pending request from this backend. Note that the underlying vector is synchronized.
Parameters:
  request - the request to remove true if the request has been found and removed



removePendingTask
public boolean removePendingTask(AbstractTask task)(Code)
Removes a pending task from this backend. Note that the underlying vector is synchronized.
Parameters:
  task - the task to remove true if the task has been found and removed



removePersistentConnection
public void removePersistentConnection(long persistentConnectionId)(Code)
Remove a persistent connection from this backend
Parameters:
  persistentConnectionId - id of the persistent connection to remove



removeSavepoint
public void removeSavepoint(Long tid, Savepoint savepoint)(Code)
Removes a savepoint for a given transaction
Parameters:
  tid - transaction identifier
Parameters:
  savepoint - savepoint to remove



rewriteQuery
public String rewriteQuery(String sqlQuery)(Code)
Rewrite the current query according to the rewriting rules.
Parameters:
  sqlQuery - request to rewrite the rewritten SQL query according to rewriting rules.



setDatabaseSchema
public synchronized void setDatabaseSchema(DatabaseSchema databaseSchema, boolean isStatic)(Code)
Sets the database schema.
Parameters:
  databaseSchema - the schema to set
Parameters:
  isStatic - true if the schema should be static
See Also:   DatabaseBackend.getDatabaseSchema()



setDefaultConnectionManager
public void setDefaultConnectionManager(AbstractConnectionManager defaultConnectionManager)(Code)
Sets the default connection manager used for the transparent login feature.
Parameters:
  defaultConnectionManager - connection manager



setDefaultStoredProcedureSemantic
public void setDefaultStoredProcedureSemantic(DatabaseProcedureSemantic defaultSemantic)(Code)
Set the default Stored Procedure semantic definition.
Parameters:
  defaultSemantic - the default semantic



setDisabling
public void setDisabling()(Code)
This is used when the backend must be disabled but currently open transactions must terminate. This is a transitional state. When disabling is complete the caller must set the backend state to disabled.

Reads are no more allowed on the backend and the state is updated so that isReadEnabled() returns false.
See Also:   DatabaseBackend.disable()
See Also:   DatabaseBackend.isReadEnabled()




setDynamicPrecision
public void setDynamicPrecision(int dynamicPrecision, boolean gatherSystemTables, String schemaName)(Code)
Set the amount of information that must be gathered when fetching database schema information.
Parameters:
  dynamicPrecision - The dynamicPrecision to set.
Parameters:
  gatherSystemTables - True if we must gather system tables
Parameters:
  schemaName - Schema name to use to gather tables



setLastKnownCheckpoint
public void setLastKnownCheckpoint(String checkpoint)(Code)
setLastKnownCheckpoint for this backend
Parameters:
  checkpoint - the checkpoint



setNbOfWorkerThreads
public void setNbOfWorkerThreads(int nbOfWorkerThreads)(Code)
Sets the nbOfWorkerThreads value.
Parameters:
  nbOfWorkerThreads - The nbOfWorkerThreads to set.



setNotificationBroadcaster
public void setNotificationBroadcaster(NotificationBroadcasterSupport notificationBroadcaster)(Code)
Sets the NotificationBroadcasterSupport that this backend can use to send JMX notification.
Parameters:
  notificationBroadcaster - a NotificationBroadcasterSupport



setSchemaIsDirty
public void setSchemaIsDirty(boolean schemaIsDirty, AbstractRequest request)(Code)
Sets the schemaIsDirty value if the backend schema needs to be refreshed.
Parameters:
  schemaIsDirty - The schemaIsDirty to set.
Parameters:
  request - optional request information used to retrieve the connectionfrom which the schema should be fetched (null if not applicable)



setSchemaIsNeededByVdb
public void setSchemaIsNeededByVdb(boolean schemaIsNeededByVdb)(Code)
Sets the schemaIsNeededByVdb value.
Parameters:
  schemaIsNeededByVdb - The schemaIsNeededByVdb to set.



setSqlShortFormLength
public void setSqlShortFormLength(int sqlShortFormLength)(Code)
Sets the sqlShortFormLength value.
Parameters:
  sqlShortFormLength - The sqlShortFormLength to set.



setState
public synchronized void setState(int state)(Code)
Set the state of a backend
Parameters:
  state - see BackendState for a possible list of the different state
See Also:   org.continuent.sequoia.common.jmx.management.BackendState



setStateListener
public void setStateListener(BackendStateListener stateListener)(Code)
Sets the stateListener value.
Parameters:
  stateListener - The stateListener to set.



setTaskQueues
public void setTaskQueues(BackendTaskQueues taskQueues)(Code)
Sets the taskQueues value.
Parameters:
  taskQueues - The taskQueues to set.



shutdownConnectionManagers
public synchronized void shutdownConnectionManagers()(Code)
Tell all the connection managers to stop handing out new Connections.



startDeadlockDetectionThread
public void startDeadlockDetectionThread(VirtualDatabase vdb)(Code)
Start a new Deadlock Detection Thread (throws a RuntimeException if called twice without stopping the thread before the second call).
Parameters:
  vdb - the virtual database the backend is attached to



startTransaction
public void startTransaction(Long tid)(Code)
Signals that a transaction has been started on this backend. It means that a connection has been allocated for this transaction.
Parameters:
  tid - transaction identifier



startWorkerThreads
public void startWorkerThreads(AbstractLoadBalancer loadBalancer)(Code)
Start the BackendWorkerThreads for this backend.
Parameters:
  loadBalancer - load balancer requesting the activation



stopTransaction
public void stopTransaction(Long tid)(Code)
Signals that a transaction has been stopped on this backend. It means that the connection has been released for this transaction.
Parameters:
  tid - transaction identifier



terminateDeadlockDetectionThread
public void terminateDeadlockDetectionThread()(Code)
Terminate the Deadlock Detection Thread. Throws a RuntimeException is the thread was already stopped (or not started).



terminateWorkerThreads
public void terminateWorkerThreads()(Code)
Terminate all worker threads.



terminateWorkerThreads
public void terminateWorkerThreads(boolean wait)(Code)
Terminate all worker threads.
Parameters:
  wait - if true waits for worker threads to terminate before returning



toBackendInfos
public static List toBackendInfos(List backends)(Code)
Convert a <DatabaseBackend>List to a <BackendInfo>List.

The DatabaseBackend objects cannot be serialized because they are used as MBean and notification emitters, so we want to extract the BackendInfo (which are Serializable) out of them.

This method does not keep the XML configuration of the BackendInfo objects. Subsequent calls to getXml() on BackendInfos returned by this method will always return null


Parameters:
  backends - a List of DatabaseBackends a List of BackendInfo (possibly emptyif the list of backends was null
See Also:   BackendInfo.toDatabaseBackends(List)



toString
public String toString()(Code)
String description a string description of the backend.



updateDatabaseBackendSchema
public void updateDatabaseBackendSchema(AbstractWriteRequest request)(Code)
Update the DatabaseBackend schema definition according to the successful execution of the provided request. Note that the schema is only updated it the provided request is a DDL statement.

TODO: a full refresh is forced on CREATE request to be sure to properly handle foreign keys (see SEQUOIA-581). An improvement would be not to refresh the whole schema on each create request - just add the new table and fetch its dependencies (foreign keys) by reloading exported keys of existing tables (see SEQUOIA-xxx). Similar optimization may be done on ALTER requests but it would require to be able to parse the request - currently we just force a full schema refresh. Note that concerning DROP request, we remove the table from dependending tables of other tables in addition to the removal of the table from the schema (given t1 and t2 tables, if t2 has a fk referencing t1, the table t1 will have the table t2 in its dependending tables). In case of rollback, these modification will be cancelled because the schema will be refreshed.
Parameters:
  request - the request that possibly updates the schema




waitForAllTransactionsAndPersistentConnectionsToComplete
public void waitForAllTransactionsAndPersistentConnectionsToComplete()(Code)
This method waits until all currently open transactions and persistent connections on this backend complete. If no transaction are currently running on this backend or no persistent connection is open, this method immediately returns.



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.