Public Member Functions | |
VirtualDatabase (Controller controller, String name, int maxConnections, boolean pool, int minThreads, int maxThreads, long maxThreadIdleTime, int sqlShortFormLength, AbstractBlobFilter blobFilter) throws NotCompliantMBeanException, JmxException | |
final void | acquireReadLockBackendLists () throws InterruptedException |
final void | releaseReadLockBackendLists () |
boolean | isDistributed () |
boolean | checkUserAuthentication (String virtualLogin, String virtualPassword) |
boolean | checkAdminAuthentication (String adminLogin, String adminPassword) |
ControllerResultSet | execReadRequest (SelectRequest request) throws SQLException |
int | execWriteRequest (AbstractWriteRequest request) throws SQLException |
ControllerResultSet | execWriteRequestWithKeys (AbstractWriteRequest request) throws SQLException |
ControllerResultSet | execReadStoredProcedure (StoredProcedure proc) throws SQLException |
long | begin (String login) throws SQLException |
void | abort (long transactionId) throws SQLException |
void | commit (long transactionId) throws SQLException |
void | rollback (long transactionId) throws SQLException |
void | addBackend (DatabaseBackend db) throws VirtualDatabaseException |
void | addBackend (DatabaseBackend db, boolean checkForCompliance) throws VirtualDatabaseException |
void | disableBackend (String backendName) throws VirtualDatabaseException |
void | disableAllBackends () throws VirtualDatabaseException |
void | disableBackendWithCheckpoint (String backendName, String checkpointName) throws VirtualDatabaseException |
void | disableAllBackendsWithCheckpoint (String checkpoint) throws VirtualDatabaseException |
void | enableBackend (String backendName) throws VirtualDatabaseException |
void | enableBackendFromCheckpoint (String backendName, String checkpointName) throws VirtualDatabaseException |
void | enableBackendFromCheckpoint (String backendName) throws VirtualDatabaseException |
void | enableAllBackends () throws VirtualDatabaseException |
void | enableAllBackendsFromCheckpoint () throws VirtualDatabaseException |
void | forceEnableAllBackendsFromCheckpoint (String checkpoint) throws VirtualDatabaseException |
ArrayList | getAllBackendNames () throws VirtualDatabaseException |
DatabaseBackend | getAndCheckBackend (String backendName, int testEnable) throws VirtualDatabaseException |
void | replicateBackend (String backendName, String newBackendName, Map parameters) throws VirtualDatabaseException |
void | removeBackend (String backend) throws VirtualDatabaseException |
void | removeBackend (DatabaseBackend db) throws VirtualDatabaseException |
void | transferBackend (String backend, String controllerDestination) throws VirtualDatabaseException |
void | backupBackendWithCheckpoint (String backendName, String checkpointName, ArrayList tables) throws VirtualDatabaseException |
File[] | getAvailableDumpFiles () |
boolean | removeDumpFile (File dumpFile) |
void | removeCheckpoint (String checkpointName) throws VirtualDatabaseException |
void | restoreDumpOnBackend (String databaseBackendName, String checkpointName) throws VirtualDatabaseException, BackupException, OctopusException |
void | setBackendLastKnownCheckpoint (String backendName, String checkpoint) throws VirtualDatabaseException |
ArrayList | viewCheckpointNames () |
void | addCurrentNbOfThread () |
void | addIdleThread () |
int | getCurrentNbOfThreads () |
int | getIdleThreads () |
int | getMaxNbOfThreads () |
long | getMaxThreadIdleTime () |
int | getMinNbOfThreads () |
boolean | isPoolConnectionThreads () |
void | removeCurrentNbOfThread () |
void | removeIdleThread () |
void | setMaxThreadIdleTime (long maxThreadIdleTime) |
void | setMinNbOfThreads (int minNbOfThreads) |
void | setPoolConnectionThreads (boolean poolConnectionThreads) |
ArrayList | getActiveThreads () |
AuthenticationManager | getAuthenticationManager () |
String | getBackendInformation (String backendName) throws VirtualDatabaseException |
ArrayList | getBackends () |
String | getBackendSchema (String backendName) throws VirtualDatabaseException |
String | getBackendState (String backendName) throws VirtualDatabaseException |
AbstractBlobFilter | getBlobFilter () |
String | getDatabaseName () |
String | getDatabaseProductName () |
VirtualDatabaseDynamicMetaData | getDynamicMetaData () |
DatabaseSchema | getDatabaseSchemaFromActiveBackendsAndRefreshDatabaseProductNames () throws SQLException |
int | getMaxNbOfConnections () |
ArrayList | getPendingConnections () |
RequestManager | getRequestManager () |
VirtualDatabaseStaticMetaData | getStaticMetaData () |
String | getVirtualDatabaseName () |
SQLMonitoring | getSQLMonitor () |
int | getSQLShortFormLength () |
boolean | hasRecoveryLog () |
boolean | hasResultCache () |
void | setAuthenticationManager (AuthenticationManager authenticationManager) |
void | setBlobFilter (AbstractBlobFilter filter) |
void | setDatabaseSchema (DatabaseSchema schema, boolean isStatic) |
void | setMaxNbOfConnections (int maxNbOfConnections) |
void | setMaxNbOfThreads (int maxNbOfThreads) |
void | setRequestManager (RequestManager requestManager) |
void | setSQLMonitor (SQLMonitoring sqlMonitor) |
void | setMonitoringToActive (boolean active) throws VirtualDatabaseException |
boolean | equals (Object other) |
void | cleanMonitoringData () throws VirtualDatabaseException |
String[][] | retrieveBackendsData () throws VirtualDatabaseException |
boolean | isShuttingDown () |
void | shutdown (int level) |
void | storeBackendsInfo () |
ArrayList | viewAllClientNames () |
String[] | viewBackendInformation (String backendName) throws VirtualDatabaseException |
String[] | viewControllerList () |
Hashtable | viewGroupBackends () throws VirtualDatabaseException |
String | viewOwningController () |
String | getAssociatedString () |
String | getXml () |
Public Attributes | |
Trace | logger = null |
Static Public Attributes | |
final int | CHECK_BACKEND_ENABLE = 1 |
final int | CHECK_BACKEND_DISABLE = 0 |
final int | NO_CHECK_BACKEND = -1 |
Protected Member Functions | |
int | execWriteStoredProcedure (StoredProcedure proc) throws SQLException |
String | getDistributionXml () |
Protected Attributes | |
String | name |
AuthenticationManager | authenticationManager |
ArrayList | backends |
ReadPrioritaryFIFOWriteLock | rwLock |
RequestManager | requestManager |
Trace | requestLogger = null |
int | maxNbOfConnections |
boolean | poolConnectionThreads |
long | maxThreadIdleTime |
int | minNbOfThreads |
int | maxNbOfThreads |
int | currentNbOfThreads |
VirtualDatabaseDynamicMetaData | metadata |
Package Attributes | |
Controller | controller |
VirtualDatabase
represents a database from client point of view and hide the complexity of the cluster distribution to the client. The client always uses the virtual database name and the C-JDBC Controller will use the real connections when an SQL request comes in.
Definition at line 92 of file VirtualDatabase.java.
|
Creates a new
Definition at line 209 of file VirtualDatabase.java. References org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabase.backends, org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabase.logger, org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabase.name, and org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabase.rwLock. 00214 { 00215 super(VirtualDatabaseMBean.class); 00216 this.controller = controller; 00217 this.name = name; 00218 this.maxNbOfConnections = maxConnections; 00219 this.poolConnectionThreads = pool; 00220 this.minNbOfThreads = minThreads; 00221 this.maxNbOfThreads = maxThreads; 00222 this.maxThreadIdleTime = maxThreadIdleTime; 00223 this.sqlShortFormLength = sqlShortFormLength; 00224 this.blobFilter = blobFilter; 00225 backends = new ArrayList(); 00226 00227 ObjectName objectName = JmxConstants.getVirtualDbObjectName(name); 00228 MBeanServerManager.registerMBean(this, objectName); 00229 00230 rwLock = new ReadPrioritaryFIFOWriteLock(); 00231 logger = Trace.getLogger("org.objectweb.cjdbc.controller.virtualdatabase." 00232 + name); 00233 requestLogger = Trace 00234 .getLogger("org.objectweb.cjdbc.controller.virtualdatabase.request." 00235 + name); 00236 }
|
|
Abort a transaction that has been started but in which no query was executed. As we use lazy transaction begin, there is no need to rollback such transaction but just to cleanup the metadata associated with this not effectively started transaction.
Definition at line 581 of file VirtualDatabase.java. 00582 { 00583 requestManager.abort(transactionId); 00584 // Emulate this as a rollback for the RequestPlayer 00585 if (requestLogger.isInfoEnabled()) 00586 requestLogger.info("R " + transactionId); 00587 }
|
|
|
Add a backend to this virtual database.
Definition at line 657 of file VirtualDatabase.java. References org.objectweb.cjdbc.common.users.AbstractDatabaseUser.getLogin(), and org.objectweb.cjdbc.common.users.AbstractDatabaseUser.getName(). 00659 { 00660 if (db == null) 00661 { 00662 String msg = "Illegal null database backend in addBackend(DatabaseBackend) method"; 00663 logger.error(msg); 00664 throw new VirtualDatabaseException(msg); 00665 } 00666 00667 if (db.isReadEnabled()) 00668 { 00669 String msg = "It is not allowed to add an enabled database."; 00670 logger.error(msg); 00671 throw new VirtualDatabaseException(msg); 00672 } 00673 00674 try 00675 { 00676 rwLock.acquireWrite(); 00677 } 00678 catch (InterruptedException e) 00679 { 00680 String msg = Translate.get( 00681 "loadbalancer.backendlist.acquire.writelock.failed", e); 00682 logger.error(msg); 00683 throw new VirtualDatabaseException(msg); 00684 } 00685 00686 if (backends.indexOf(db) == -1) 00687 { 00688 // Check the authentication manager has all virtual logins defined 00689 ArrayList logins = authenticationManager.getVirtualLogins(); 00690 VirtualDatabaseUser vdu; 00691 String login; 00692 for (int i = 0; i < logins.size(); i++) 00693 { 00694 vdu = (VirtualDatabaseUser) logins.get(i); 00695 login = vdu.getLogin(); 00696 if (db.getConnectionManager(login) == null) 00697 throw new VirtualDatabaseException(Translate.get( 00698 "backend.missing.connection.manager", login)); 00699 } 00700 00701 // Initialize the driver and check the compliance 00702 try 00703 { 00704 if (logger.isDebugEnabled()) 00705 logger.debug("Checking driver compliance"); 00706 if (checkForCompliance) 00707 db.checkDriverCompliance(); // Also loads 00708 // the 00709 // driver 00710 } 00711 catch (Exception e) 00712 { 00713 rwLock.releaseWrite(); 00714 String msg = "Error while adding database backend " + db.getName() 00715 + " (" + e + ")"; 00716 logger.warn(msg); 00717 throw new VirtualDatabaseException(msg); 00718 } 00719 db.setSqlShortFormLength(getSQLShortFormLength()); 00720 backends.add(db); 00721 00722 // Add the backend to the list 00723 if (logger.isDebugEnabled()) 00724 logger.debug("Backend " + db.getName() + " added successfully"); 00725 00726 rwLock.releaseWrite(); // Relase the lock 00727 00728 // Jmx 00729 if (MBeanServerManager.isJmxEnabled()) 00730 { 00731 // Send notification 00732 Hashtable data = new Hashtable(); 00733 data.put(CjdbcNotificationList.DATA_DATABASE, this.name); 00734 data.put(CjdbcNotificationList.DATA_DRIVER, db.getDriverClassName()); 00735 String checkpoint = db.getLastKnownCheckpoint(); 00736 checkpoint = (checkpoint == null) ? "" : checkpoint; 00737 data.put(CjdbcNotificationList.DATA_CHECKPOINT, checkpoint); 00738 data.put(CjdbcNotificationList.DATA_NAME, db.getName()); 00739 data.put(CjdbcNotificationList.DATA_URL, db.getURL()); 00740 RmiConnector.broadcastNotification(this, 00741 CjdbcNotificationList.VIRTUALDATABASE_BACKEND_ADDED, 00742 CjdbcNotificationList.NOTIFICATION_LEVEL_INFO, Translate.get( 00743 "notification.backend.added", db.getName()), data); 00744 00745 // Add backend mbean to jmx server 00746 ObjectName objectName = JmxConstants.getDatabaseBackendObjectName(name, 00747 db.getName()); 00748 try 00749 { 00750 MBeanServerManager.registerMBean(db, objectName); 00751 } 00752 catch (JmxException e1) 00753 { 00754 logger.error(Translate.get( 00755 "virtualdatabase.fail.register.backend.mbean", db.getName()), e1); 00756 } 00757 } 00758 00759 } 00760 else 00761 { 00762 rwLock.releaseWrite(); 00763 String msg = "Duplicate backend " + db.getURL(); 00764 logger.warn(msg); 00765 throw new VirtualDatabaseException(msg); 00766 } 00767 00768 }
|
|
Add a backend to this virtual database.
Reimplemented in org.objectweb.cjdbc.controller.virtualdatabase.DistributedVirtualDatabase. Definition at line 645 of file VirtualDatabase.java. 00646 { 00647 this.addBackend(db, true); 00648 }
|
|
Adds one to currentNbOfThreads. Warning! This method is not synchronized. Definition at line 1561 of file VirtualDatabase.java. Referenced by org.objectweb.cjdbc.controller.core.ControllerWorkerThread.run(). 01562 { 01563 currentNbOfThreads++; 01564 }
|
|
Method add an idle thread. Warning! This method must be called in a synchronized block on activeThreads. Definition at line 1570 of file VirtualDatabase.java. Referenced by org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabaseWorkerThread.run(). 01571 { 01572 idleThreads++; 01573 }
|
|
Definition at line 1398 of file VirtualDatabase.java. 01400 { 01401 try 01402 { 01403 DatabaseBackend db = getAndCheckBackend(backendName, NO_CHECK_BACKEND); 01404 requestManager.backupBackendWithCheckpoint(db, checkpointName, tables, db 01405 .isReadEnabled(), true, null); 01406 } 01407 catch (SQLException sql) 01408 { 01409 throw new VirtualDatabaseException(sql.getMessage()); 01410 } 01411 }
|
|
Begins a new transaction and returns the corresponding transaction identifier. This method is called from the driver when org.objectweb.cjdbc.driver.Connection#setAutoCommit(boolean)is called with
Definition at line 555 of file VirtualDatabase.java. 00556 { 00557 try 00558 { 00559 long tid = requestManager.begin(login); 00560 if (requestLogger.isInfoEnabled()) 00561 requestLogger.info("B " + tid); 00562 return tid; 00563 } 00564 catch (SQLException e) 00565 { 00566 String msg = "Begin failed (" + e.getMessage() + ")"; 00567 logger.warn(msg); 00568 throw e; 00569 } 00570 }
|
|
Checks if a given admin login/password is ok.
Definition at line 304 of file VirtualDatabase.java. References org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabase.authenticationManager, and org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabase.logger. 00306 { 00307 if (authenticationManager == null) 00308 { 00309 logger.error("No authentification manager defined to check admin login '" 00310 + adminLogin + "'"); 00311 return false; 00312 } 00313 else 00314 return authenticationManager.isValidAdminUser(new AdminUser(adminLogin, 00315 adminPassword)); 00316 }
|
|
Checks if a given virtual login/password is ok.
Definition at line 281 of file VirtualDatabase.java. References org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabase.authenticationManager, and org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabase.logger. 00283 { 00284 if (authenticationManager == null) 00285 { 00286 logger.error("No authentification manager defined to check login '" 00287 + virtualLogin + "'"); 00288 return false; 00289 } 00290 else 00291 return authenticationManager.isValidVirtualUser(new VirtualDatabaseUser( 00292 virtualLogin, virtualPassword)); 00293 }
|
|
Definition at line 2119 of file VirtualDatabase.java. 02120 { 02121 if (sqlMonitor == null) 02122 throw new VirtualDatabaseException(Translate 02123 .get("virtualdatabase.monitoring.not.defined")); 02124 else 02125 sqlMonitor.cleanStats(); 02126 }
|
|
Commits a transaction given its id.
Definition at line 595 of file VirtualDatabase.java. 00596 { 00597 try 00598 { 00599 if (requestLogger.isInfoEnabled()) 00600 requestLogger.info("C " + transactionId); 00601 requestManager.commit(transactionId); 00602 } 00603 catch (SQLException e) 00604 { 00605 String msg = "Commit of transaction '" + transactionId + "' failed (" 00606 + e.getMessage() + ")"; 00607 logger.warn(msg); 00608 throw e; 00609 } 00610 }
|
|
Prepare this virtual database for shutdown. This turns off all the backends by cutting communication from this database. This does not prevents other virtual database to use shared backends. This doesn't create checkpoints either.
Definition at line 817 of file VirtualDatabase.java. References org.objectweb.cjdbc.controller.backend.DatabaseBackend.getName(), and org.objectweb.cjdbc.controller.backend.DatabaseBackend.isReadEnabled(). Referenced by org.objectweb.cjdbc.controller.core.Controller.removeVirtualDatabase(). 00818 { 00819 try 00820 { 00821 int size = this.backends.size(); 00822 DatabaseBackend dbe; 00823 for (int i = 0; i < size; i++) 00824 { 00825 dbe = (DatabaseBackend) backends.get(i); 00826 if (dbe.isReadEnabled()) 00827 requestManager.disableBackend(getAndCheckBackend(dbe.getName(), 00828 CHECK_BACKEND_DISABLE)); 00829 } 00830 } 00831 catch (Exception e) 00832 { 00833 throw new VirtualDatabaseException(e.getMessage()); 00834 } 00835 }
|
|
Definition at line 863 of file VirtualDatabase.java. 00865 { 00866 if (checkpoint == null) 00867 { 00868 disableAllBackends(); 00869 return; 00870 } 00871 00872 try 00873 { 00874 this.acquireReadLockBackendLists(); 00875 requestManager.disableBackendsForCheckpoint(backends, checkpoint); 00876 this.releaseReadLockBackendLists(); 00877 } 00878 catch (Exception e) 00879 { 00880 throw new VirtualDatabaseException(e.getMessage()); 00881 } 00882 }
|
|
Definition at line 773 of file VirtualDatabase.java. References org.objectweb.cjdbc.controller.backend.DatabaseBackend.getDriverClassName(), org.objectweb.cjdbc.controller.backend.DatabaseBackend.getLastKnownCheckpoint(), org.objectweb.cjdbc.controller.backend.DatabaseBackend.getName(), and org.objectweb.cjdbc.controller.backend.DatabaseBackend.getURL(). 00775 { 00776 try 00777 { 00778 DatabaseBackend db = getAndCheckBackend(backendName, 00779 CHECK_BACKEND_DISABLE); 00780 requestManager.disableBackend(db); 00781 requestManager.setDatabaseSchema( 00782 getDatabaseSchemaFromActiveBackendsAndRefreshDatabaseProductNames(), 00783 false); 00784 00785 // Send notification 00786 if (MBeanServerManager.isJmxEnabled()) 00787 { 00788 Hashtable data = new Hashtable(); 00789 data.put("driver", db.getDriverClassName()); 00790 String checkpoint = db.getLastKnownCheckpoint(); 00791 checkpoint = (checkpoint == null) ? "" : checkpoint; 00792 data.put("checkpoint", checkpoint); 00793 data.put("name", db.getName()); 00794 data.put("url", db.getURL()); 00795 RmiConnector.broadcastNotification(this, 00796 CjdbcNotificationList.VIRTUALDATABASE_BACKEND_DISABLED, 00797 CjdbcNotificationList.NOTIFICATION_LEVEL_INFO, Translate.get( 00798 "notification.backend.disabled", db.getName()), data); 00799 } 00800 } 00801 catch (Exception e) 00802 { 00803 logger.error("An error occured while disabling backend " + backendName 00804 + " (" + e + ")"); 00805 throw new VirtualDatabaseException(e.getMessage()); 00806 } 00807 }
|
|
Definition at line 841 of file VirtualDatabase.java. References org.objectweb.cjdbc.controller.backend.DatabaseBackend.setDatabaseSchema(). 00843 { 00844 try 00845 { 00846 requestManager.disableBackendForCheckpoint(getAndCheckBackend( 00847 backendName, CHECK_BACKEND_DISABLE), checkpointName); 00848 requestManager.setDatabaseSchema( 00849 getDatabaseSchemaFromActiveBackendsAndRefreshDatabaseProductNames(), 00850 false); 00851 } 00852 catch (Exception e) 00853 { 00854 logger.error("An error occured while disabling backend " + backendName 00855 + " (" + e + ")"); 00856 throw new VirtualDatabaseException(e.getMessage()); 00857 } 00858 }
|
|
Enable all the backends without any check.
Definition at line 989 of file VirtualDatabase.java. References org.objectweb.cjdbc.controller.backend.DatabaseBackend.isReadEnabled(). 00990 { 00991 try 00992 { 00993 int size = this.backends.size(); 00994 DatabaseBackend dbe; 00995 for (int i = 0; i < size; i++) 00996 { 00997 dbe = (DatabaseBackend) backends.get(i); 00998 if (!dbe.isReadEnabled()) 00999 enableBackend(((DatabaseBackend) backends.get(i)).getName()); 01000 } 01001 } 01002 catch (Exception e) 01003 { 01004 logger.error(e); 01005 throw new VirtualDatabaseException(e.getMessage()); 01006 } 01007 }
|
|
Definition at line 1012 of file VirtualDatabase.java. References org.objectweb.cjdbc.controller.recoverylog.AbstractRecoveryLog.getBackendRecoveryInfo(), org.objectweb.cjdbc.controller.recoverylog.BackendRecoveryInfo.getBackendState(), org.objectweb.cjdbc.controller.recoverylog.BackendRecoveryInfo.getCheckpoint(), org.objectweb.cjdbc.controller.backend.DatabaseBackend.getName(), and org.objectweb.cjdbc.controller.backend.DatabaseBackend.isReadEnabled(). 01013 { 01014 AbstractRecoveryLog log = requestManager.getRecoveryLog(); 01015 if (log == null) 01016 {// If no recovery log is defined ignore fallback to a forced enable 01017 logger 01018 .warn("No recovery log has been configured, enabling backend without checkpoint."); 01019 enableAllBackends(); 01020 } 01021 else 01022 { 01023 try 01024 { 01025 int size = this.backends.size(); 01026 DatabaseBackend dbe; 01027 String backendName; 01028 BackendRecoveryInfo info; 01029 for (int i = 0; i < size; i++) 01030 { 01031 dbe = (DatabaseBackend) backends.get(i); 01032 backendName = dbe.getName(); 01033 info = log.getBackendRecoveryInfo(name, backendName); 01034 switch (info.getBackendState()) 01035 { 01036 case BackendState.DISABLED : 01037 String checkpoint = info.getCheckpoint(); 01038 if (checkpoint == null || checkpoint.equals("")) 01039 { 01040 logger.warn("Enabling backend " + backendName 01041 + " with no checkpoint."); 01042 enableBackend(dbe.getName()); 01043 } 01044 else 01045 { 01046 logger.info("Enabling backend " + backendName 01047 + " from checkpoint " + checkpoint); 01048 enableBackendFromCheckpoint(dbe.getName(), checkpoint); 01049 } 01050 continue; 01051 case BackendState.UNKNOWN : 01052 logger.info("Unknown last state for backend " + backendName 01053 + ". Leaving node in " 01054 + (dbe.isReadEnabled() ? "enabled" : "disabled") + " state."); 01055 continue; 01056 case BackendState.BACKUPING : 01057 case BackendState.DISABLING : 01058 case BackendState.RECOVERING : 01059 case BackendState.REPLAYING : 01060 logger.info("Unexpected transition state (" 01061 + info.getBackendState() + ") for backend " + backendName 01062 + ". Leaving node in " 01063 + (dbe.isReadEnabled() ? "enabled" : "disabled") + " state."); 01064 continue; 01065 default : 01066 logger.info("Trying to enable a backend " + backendName 01067 + " that is already in an enabled state."); 01068 break; 01069 } 01070 } 01071 } 01072 catch (Exception e) 01073 { 01074 throw new VirtualDatabaseException(e.getMessage()); 01075 } 01076 } 01077 01078 }
|
|
Definition at line 887 of file VirtualDatabase.java. References org.objectweb.cjdbc.controller.backend.DatabaseBackend.getDatabaseProductName(), org.objectweb.cjdbc.controller.backend.DatabaseBackend.getDriverClassName(), org.objectweb.cjdbc.controller.backend.DatabaseBackend.getLastKnownCheckpoint(), org.objectweb.cjdbc.controller.backend.DatabaseBackend.getName(), org.objectweb.cjdbc.controller.backend.DatabaseBackend.getURL(), and org.objectweb.cjdbc.controller.backend.DatabaseBackend.setDatabaseSchema(). Referenced by org.objectweb.cjdbc.controller.virtualdatabase.DistributedVirtualDatabase.handleMessageSingleThreaded(). 00888 { 00889 // Call the Request Manager 00890 try 00891 { 00892 DatabaseBackend backend = getAndCheckBackend(backendName, 00893 CHECK_BACKEND_ENABLE); 00894 00895 requestManager.enableBackend(backend); 00896 requestManager.setDatabaseSchema( 00897 getDatabaseSchemaFromActiveBackendsAndRefreshDatabaseProductNames(), 00898 false); 00899 00900 // Update the list of database product names 00901 if (databaseProductNames.indexOf(backend.getDatabaseProductName()) == -1) 00902 databaseProductNames += "," + backend.getDatabaseProductName(); 00903 00904 // Update the static metadata 00905 getStaticMetaData().gatherStaticMetadata(backend); 00906 00907 // Send notification 00908 if (MBeanServerManager.isJmxEnabled()) 00909 { 00910 Hashtable data = new Hashtable(); 00911 data.put("driver", backend.getDriverClassName()); 00912 String checkpoint = backend.getLastKnownCheckpoint(); 00913 checkpoint = (checkpoint == null) ? "" : checkpoint; 00914 data.put("checkpoint", checkpoint); 00915 data.put("name", backend.getName()); 00916 data.put("url", backend.getURL()); 00917 RmiConnector.broadcastNotification(this, 00918 CjdbcNotificationList.VIRTUALDATABASE_BACKEND_ENABLED, 00919 CjdbcNotificationList.NOTIFICATION_LEVEL_INFO, Translate.get( 00920 "notification.backend.enabled", backend.getName()), data); 00921 } 00922 } 00923 catch (Exception e) 00924 { 00925 e.printStackTrace(); 00926 throw new VirtualDatabaseException(e.getMessage()); 00927 } 00928 }
|
|
Definition at line 967 of file VirtualDatabase.java. References org.objectweb.cjdbc.controller.backend.DatabaseBackend.getLastKnownCheckpoint(). 00969 { 00970 DatabaseBackend backend = getAndCheckBackend(backendName, NO_CHECK_BACKEND); 00971 String checkpoint = backend.getLastKnownCheckpoint(); 00972 if (checkpoint == null) 00973 throw new VirtualDatabaseException("No last checkpoint for backend:" 00974 + backendName); 00975 else 00976 { 00977 if (logger.isDebugEnabled()) 00978 logger.debug("Enabling backend:" + backendName 00979 + " from its last checkpoint " + backend.getLastKnownCheckpoint()); 00980 } 00981 enableBackendFromCheckpoint(backendName, backend.getLastKnownCheckpoint()); 00982 }
|
|
Enable the given backend from the given checkpoint.
Definition at line 937 of file VirtualDatabase.java. References org.objectweb.cjdbc.controller.backend.DatabaseBackend.getDatabaseProductName(), and org.objectweb.cjdbc.controller.backend.DatabaseBackend.setDatabaseSchema(). 00939 { 00940 // Call the Request Manager 00941 try 00942 { 00943 DatabaseBackend backend = getAndCheckBackend(backendName, 00944 CHECK_BACKEND_ENABLE); 00945 requestManager.enableBackendFromCheckpoint(backend, checkpointName); 00946 requestManager.setDatabaseSchema( 00947 getDatabaseSchemaFromActiveBackendsAndRefreshDatabaseProductNames(), 00948 false); 00949 00950 // Update the static metadata 00951 getStaticMetaData().gatherStaticMetadata(backend); 00952 00953 // Update the list of database product names 00954 if (databaseProductNames.indexOf(backend.getDatabaseProductName()) == -1) 00955 databaseProductNames += "," + backend.getDatabaseProductName(); 00956 } 00957 catch (Exception e) 00958 { 00959 throw new VirtualDatabaseException( 00960 "Failed to enable backend from checkpoint: " + e); 00961 } 00962 }
|
|
Two virtual databases are equal if they have the same name and group.
Reimplemented in org.objectweb.cjdbc.controller.virtualdatabase.DistributedVirtualDatabase. Definition at line 2101 of file VirtualDatabase.java. References org.objectweb.cjdbc.common.sql.schema.DatabaseSchema.equals(), and org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabase.getDatabaseName(). 02102 { 02103 if ((other == null) || (!(other instanceof VirtualDatabase))) 02104 return false; 02105 else 02106 { 02107 VirtualDatabase db = (VirtualDatabase) other; 02108 return name.equals(db.getDatabaseName()); 02109 } 02110 }
|
|
Performs a read request and returns the reply.
Definition at line 325 of file VirtualDatabase.java. References org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabase.logger, and org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabase.requestManager. 00327 { 00328 if (request == null) 00329 { 00330 String msg = "Request failed (null read request received)"; 00331 logger.warn(msg); 00332 throw new SQLException(msg); 00333 } 00334 00335 try 00336 { 00337 if (requestLogger.isInfoEnabled()) 00338 requestLogger.info("S " + request.getTransactionId() + " " 00339 + request.getSQL()); 00340 00341 long start = 0; 00342 if (sqlMonitor != null && sqlMonitor.isActive()) 00343 start = System.currentTimeMillis(); 00344 00345 ControllerResultSet rs = requestManager.execReadRequest(request); 00346 00347 if (sqlMonitor != null && sqlMonitor.isActive()) 00348 sqlMonitor.logRequestTime(request, System.currentTimeMillis() - start); 00349 00350 return rs; 00351 } 00352 catch (SQLException e) 00353 { 00354 String msg = "Request '" + request.getId() + "' failed (" 00355 + e.getMessage() + ")"; 00356 logger.warn(msg); 00357 if (sqlMonitor != null && sqlMonitor.isActive()) 00358 sqlMonitor.logError(request); 00359 throw e; 00360 } 00361 }
|
|
Call a stored procedure that returns a ResultSet.
Definition at line 460 of file VirtualDatabase.java. References org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabase.logger, and org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabase.requestManager. 00462 { 00463 if (proc == null) 00464 { 00465 String msg = "Request failed (null stored procedure received)"; 00466 logger.warn(msg); 00467 throw new SQLException(msg); 00468 } 00469 00470 try 00471 { 00472 if (requestLogger.isInfoEnabled()) 00473 requestLogger 00474 .info("S " + proc.getTransactionId() + " " + proc.getSQL()); 00475 00476 long start = 0; 00477 if (sqlMonitor != null && sqlMonitor.isActive()) 00478 start = System.currentTimeMillis(); 00479 00480 ControllerResultSet rs = requestManager.execReadStoredProcedure(proc); 00481 00482 if (sqlMonitor != null && sqlMonitor.isActive()) 00483 sqlMonitor.logRequestTime(proc, System.currentTimeMillis() - start); 00484 00485 return rs; 00486 } 00487 catch (SQLException e) 00488 { 00489 String msg = Translate.get("loadbalancer.storedprocedure.failed", 00490 new String[]{String.valueOf(proc.getId()), e.getMessage()}); 00491 logger.warn(msg); 00492 if (sqlMonitor != null && sqlMonitor.isActive()) 00493 sqlMonitor.logError(proc); 00494 throw e; 00495 } 00496 }
|
|
Performs a write request and returns the number of rows affected.
Definition at line 370 of file VirtualDatabase.java. References org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabase.logger, and org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabase.requestManager. 00371 { 00372 if (request == null) 00373 { 00374 String msg = "Request failed (null write request received)"; 00375 logger.warn(msg); 00376 throw new SQLException(msg); 00377 } 00378 00379 try 00380 { 00381 if (requestLogger.isInfoEnabled()) 00382 requestLogger.info("W " + request.getTransactionId() + " " 00383 + request.getSQL()); 00384 00385 long start = 0; 00386 if (sqlMonitor != null && sqlMonitor.isActive()) 00387 start = System.currentTimeMillis(); 00388 00389 int result = requestManager.execWriteRequest(request); 00390 00391 if (sqlMonitor != null && sqlMonitor.isActive()) 00392 sqlMonitor.logRequestTime(request, System.currentTimeMillis() - start); 00393 00394 return result; 00395 } 00396 catch (SQLException e) 00397 { 00398 String msg = "Request '" + request.getId() + "' failed (" 00399 + e.getMessage() + ")"; 00400 logger.warn(msg); 00401 if (sqlMonitor != null && sqlMonitor.isActive()) 00402 sqlMonitor.logError(request); 00403 throw e; 00404 } 00405 }
|
|
Performs a write request and returns the auto generated keys.
Definition at line 414 of file VirtualDatabase.java. References org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabase.logger, and org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabase.requestManager. 00416 { 00417 if (request == null) 00418 { 00419 String msg = "Request failed (null write request received)"; 00420 logger.warn(msg); 00421 throw new SQLException(msg); 00422 } 00423 00424 try 00425 { 00426 if (requestLogger.isInfoEnabled()) 00427 requestLogger.info("W " + request.getTransactionId() + " " 00428 + request.getSQL()); 00429 00430 long start = 0; 00431 if (sqlMonitor != null && sqlMonitor.isActive()) 00432 start = System.currentTimeMillis(); 00433 00434 ControllerResultSet result = requestManager 00435 .execWriteRequestWithKeys(request); 00436 00437 if (sqlMonitor != null && sqlMonitor.isActive()) 00438 sqlMonitor.logRequestTime(request, System.currentTimeMillis() - start); 00439 00440 return result; 00441 } 00442 catch (SQLException e) 00443 { 00444 String msg = "Request '" + request.getId() + "' failed (" 00445 + e.getMessage() + ")"; 00446 logger.warn(msg); 00447 if (sqlMonitor != null && sqlMonitor.isActive()) 00448 sqlMonitor.logError(request); 00449 throw e; 00450 } 00451 }
|
|
Call a stored procedure that performs an update.
Definition at line 505 of file VirtualDatabase.java. 00507 { 00508 if (proc == null) 00509 { 00510 String msg = "Request failed (null stored procedure received)"; 00511 logger.warn(msg); 00512 throw new SQLException(msg); 00513 } 00514 00515 try 00516 { 00517 if (requestLogger.isInfoEnabled()) 00518 requestLogger 00519 .info("W " + proc.getTransactionId() + " " + proc.getSQL()); 00520 00521 long start = 0; 00522 if (sqlMonitor != null && sqlMonitor.isActive()) 00523 start = System.currentTimeMillis(); 00524 00525 int result = requestManager.execWriteStoredProcedure(proc); 00526 00527 if (sqlMonitor != null && sqlMonitor.isActive()) 00528 sqlMonitor.logRequestTime(proc, System.currentTimeMillis() - start); 00529 00530 return result; 00531 } 00532 catch (SQLException e) 00533 { 00534 String msg = Translate.get("loadbalancer.storedprocedure.failed", 00535 new String[]{String.valueOf(proc.getId()), e.getMessage()}); 00536 logger.warn(msg); 00537 if (sqlMonitor != null && sqlMonitor.isActive()) 00538 sqlMonitor.logError(proc); 00539 throw e; 00540 } 00541 }
|
|
Prepare this virtual database for startup. This turns on all the backends from the given checkpoint. If the checkpoint is null or an empty String, the backends are enabled without further check else the backend states are overriden to use the provided checkpoint.
Definition at line 1089 of file VirtualDatabase.java. References org.objectweb.cjdbc.controller.backend.DatabaseBackend.getName(), org.objectweb.cjdbc.controller.backend.DatabaseBackend.isReadEnabled(), and org.objectweb.cjdbc.controller.backend.DatabaseBackend.setLastKnownCheckpoint(). 01091 { 01092 if (checkpoint == null || checkpoint.equals("")) 01093 enableAllBackends(); 01094 else 01095 { 01096 try 01097 { 01098 int size = this.backends.size(); 01099 DatabaseBackend backend; 01100 for (int i = 0; i < size; i++) 01101 { 01102 backend = (DatabaseBackend) backends.get(i); 01103 if (!backend.isReadEnabled()) 01104 { 01105 backend.setLastKnownCheckpoint(checkpoint); 01106 enableBackendFromCheckpoint(backend.getName(), checkpoint); 01107 } 01108 } 01109 } 01110 catch (Exception e) 01111 { 01112 throw new VirtualDatabaseException(e.getMessage()); 01113 } 01114 } 01115 }
|
|
Returns the activeThreads.
Definition at line 1691 of file VirtualDatabase.java. Referenced by org.objectweb.cjdbc.controller.monitoring.datacollector.DataCollector.retrieveClientsData(), org.objectweb.cjdbc.controller.monitoring.datacollector.DataCollector.retrieveVirtualDatabasesData(), org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabaseWorkerThread.run(), and org.objectweb.cjdbc.controller.core.ControllerWorkerThread.run(). 01692 {
01693 return activeThreads;
01694 }
|
|
Definition at line 1120 of file VirtualDatabase.java. Referenced by org.objectweb.cjdbc.controller.core.Controller.removeVirtualDatabase(). 01121 { 01122 try 01123 { 01124 acquireReadLockBackendLists(); 01125 } 01126 catch (InterruptedException e) 01127 { 01128 String msg = "Unable to acquire read lock on backend list in getAllBackendNames (" 01129 + e + ")"; 01130 logger.error(msg); 01131 throw new VirtualDatabaseException(msg); 01132 } 01133 01134 int size = backends.size(); 01135 ArrayList result = new ArrayList(); 01136 for (int i = 0; i < size; i++) 01137 { 01138 result.add(((DatabaseBackend) backends.get(i)).getName()); 01139 } 01140 01141 releaseReadLockBackendLists(); 01142 return result; 01143 }
|
|
Find the DatabaseBackend corresponding to the given backend name and check if it is possible to disable this backend. In the case enable, this method also updates the virtual database schema by merging it with the one provided by this backend.
Definition at line 1158 of file VirtualDatabase.java. References org.objectweb.cjdbc.controller.backend.DatabaseBackend.checkDatabaseSchema(), org.objectweb.cjdbc.controller.backend.DatabaseBackend.checkDriverCompliance(), org.objectweb.cjdbc.controller.backend.DatabaseBackend.equals(), org.objectweb.cjdbc.controller.backend.DatabaseBackend.getDatabaseSchema(), org.objectweb.cjdbc.controller.backend.DatabaseBackend.getName(), org.objectweb.cjdbc.controller.backend.DatabaseBackend.initializeConnections(), and org.objectweb.cjdbc.controller.backend.DatabaseBackend.isReadEnabled(). Referenced by org.objectweb.cjdbc.common.monitor.backend.AbstractBackendDataCollector.collectValue(). 01160 { 01161 try 01162 { 01163 acquireReadLockBackendLists(); 01164 } 01165 catch (InterruptedException e) 01166 { 01167 String msg = "Unable to acquire read lock on backend list in getAndCheckBackend (" 01168 + e + ")"; 01169 logger.error(msg); 01170 throw new VirtualDatabaseException(msg); 01171 } 01172 01173 // Find the backend 01174 int size = backends.size(); 01175 DatabaseBackend b = null; 01176 for (int i = 0; i < size; i++) 01177 { 01178 b = (DatabaseBackend) backends.get(i); 01179 if (b.getName().equals(backendName)) 01180 break; 01181 else 01182 b = null; 01183 } 01184 01185 // Check not null 01186 if (b == null) 01187 { 01188 releaseReadLockBackendLists(); 01189 String msg = "Trying to access a non-existing backend " + backendName; 01190 logger.warn(msg); 01191 throw new VirtualDatabaseException(msg); 01192 } 01193 01194 // Check enable/disable 01195 switch (testEnable) 01196 { 01197 case NO_CHECK_BACKEND : 01198 break; 01199 case CHECK_BACKEND_DISABLE : 01200 if (!b.isReadEnabled()) 01201 { 01202 releaseReadLockBackendLists(); 01203 String msg = "Backend " + backendName + " is already disabled"; 01204 logger.warn(msg); 01205 throw new VirtualDatabaseException(msg); 01206 } 01207 break; 01208 case CHECK_BACKEND_ENABLE : 01209 if (b.isReadEnabled()) 01210 { 01211 releaseReadLockBackendLists(); 01212 String msg = "Backend " + backendName + " is already enabled"; 01213 logger.warn(msg); 01214 throw new VirtualDatabaseException(msg); 01215 } 01216 break; 01217 default : 01218 releaseReadLockBackendLists(); 01219 String msg = "Unexpected parameter in getAndCheckBackend(...)"; 01220 logger.error(msg); 01221 throw new VirtualDatabaseException(msg); 01222 } 01223 01224 releaseReadLockBackendLists(); 01225 01226 if (testEnable == CHECK_BACKEND_ENABLE) 01227 { 01228 // Initialize backend for enable 01229 try 01230 { 01231 if (logger.isDebugEnabled()) 01232 logger.debug("Initializing connections for backend " + b.getName()); 01233 b.initializeConnections(); 01234 01235 b.checkDriverCompliance(); 01236 01237 if (logger.isDebugEnabled()) 01238 logger.debug("Checking schema for backend " + b.getName()); 01239 b.checkDatabaseSchema(); 01240 01241 DatabaseSchema backendSchema = b.getDatabaseSchema(); 01242 01243 if (backendSchema != null) 01244 requestManager.mergeDatabaseSchema(backendSchema); 01245 else 01246 logger.warn("Backend " + b.getName() + " has no defined schema."); 01247 } 01248 catch (SQLException e) 01249 { 01250 String msg = "Error while initalizing database backend " + b.getName() 01251 + " (" + e + ")"; 01252 logger.warn(msg, e); 01253 throw new VirtualDatabaseException(msg); 01254 } 01255 } 01256 01257 return b; 01258 }
|
|
Definition at line 2267 of file VirtualDatabase.java. 02268 { 02269 return "virtualdatabase"; 02270 }
|
|
Returns the authentication manager of this virtual database.
Definition at line 1701 of file VirtualDatabase.java. Referenced by org.objectweb.cjdbc.controller.virtualdatabase.protocol.VirtualDatabaseConfiguration.isCompatible(), org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabaseWorkerThread.run(), and org.objectweb.cjdbc.controller.virtualdatabase.protocol.VirtualDatabaseConfiguration.VirtualDatabaseConfiguration(). 01702 {
01703 return authenticationManager;
01704 }
|
|
Definition at line 1416 of file VirtualDatabase.java. 01417 { 01418 File f = new File(getRequestManager().getBackupManager().getBackupDir()); 01419 if (f.exists()) 01420 { 01421 return f.listFiles(new FilenameFilter() 01422 { 01423 /** 01424 * @see java.io.FilenameFilter#accept(java.io.File, java.lang.String) 01425 */ 01426 public boolean accept(File dir, String name) 01427 { 01428 if (name.endsWith(Constants.ZIP_EXT)) 01429 return true; 01430 else 01431 return false; 01432 } 01433 }); 01434 } 01435 else 01436 return new File[0]; 01437 }
|
|
Definition at line 1709 of file VirtualDatabase.java. References org.objectweb.cjdbc.controller.backend.DatabaseBackend.equals(), org.objectweb.cjdbc.controller.backend.DatabaseBackend.getName(), and org.objectweb.cjdbc.controller.backend.DatabaseBackend.getXml(). 01711 { 01712 try 01713 { 01714 acquireReadLockBackendLists(); 01715 } 01716 catch (InterruptedException e) 01717 { 01718 String msg = "Unable to acquire read lock on backend list in getBackendInformation (" 01719 + e + ")"; 01720 logger.error(msg); 01721 throw new VirtualDatabaseException(msg); 01722 } 01723 01724 // Find the backend 01725 int size = backends.size(); 01726 DatabaseBackend b = null; 01727 for (int i = 0; i < size; i++) 01728 { 01729 b = (DatabaseBackend) backends.get(i); 01730 if (b.getName().equals(backendName)) 01731 break; 01732 else 01733 b = null; 01734 } 01735 01736 if (b == null) 01737 { 01738 releaseReadLockBackendLists(); 01739 String msg = "Backend " + backendName + " does not exists."; 01740 logger.warn(msg); 01741 throw new VirtualDatabaseException(msg); 01742 } 01743 01744 releaseReadLockBackendLists(); 01745 return b.getXml(); 01746 }
|
|
Return the list of all backends
Definition at line 1753 of file VirtualDatabase.java. Referenced by org.objectweb.cjdbc.controller.loadbalancer.paralleldb.ParallelDB_RR.chooseBackendForReadRequest(), org.objectweb.cjdbc.controller.loadbalancer.paralleldb.ParallelDB_LPRF.chooseBackendForReadRequest(), org.objectweb.cjdbc.controller.loadbalancer.paralleldb.ParallelDB_RR.chooseBackendForWriteRequest(), org.objectweb.cjdbc.controller.loadbalancer.paralleldb.ParallelDB_LPRF.chooseBackendForWriteRequest(), org.objectweb.cjdbc.controller.loadbalancer.raidb2.RAIDb2_RR.execReadRequest(), org.objectweb.cjdbc.controller.loadbalancer.raidb2.RAIDb2_LPRF.execReadRequest(), org.objectweb.cjdbc.controller.loadbalancer.raidb0.RAIDb0.execReadRequest(), org.objectweb.cjdbc.controller.loadbalancer.raidb1.RAIDb1ec_RR.getInformation(), org.objectweb.cjdbc.controller.monitoring.datacollector.DataCollector.retrieveBackendsData(), and org.objectweb.cjdbc.controller.virtualdatabase.protocol.VirtualDatabaseConfiguration.VirtualDatabaseConfiguration(). 01754 {
01755 return backends;
01756 }
|
|
Definition at line 1761 of file VirtualDatabase.java. References org.objectweb.cjdbc.controller.backend.DatabaseBackend.getSchemaXml(). 01763 { 01764 DatabaseBackend backend = getAndCheckBackend(backendName, NO_CHECK_BACKEND); 01765 // we know the backend is not null, otherwise we have a 01766 // VirtualDatabaseException ... 01767 try 01768 { 01769 return XmlTools.prettyXml(backend.getSchemaXml(true)); 01770 } 01771 catch (Exception e) 01772 { 01773 throw new VirtualDatabaseException(e.getMessage()); 01774 } 01775 }
|
|
Definition at line 1780 of file VirtualDatabase.java. References org.objectweb.cjdbc.controller.backend.DatabaseBackend.getState(). 01782 { 01783 DatabaseBackend backend = getAndCheckBackend(backendName, NO_CHECK_BACKEND); 01784 return backend.getState(); 01785 }
|
|
Return the BLOB filter used for this database
Definition at line 1792 of file VirtualDatabase.java. Referenced by org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabaseWorkerThread.run(). 01793 {
01794 return blobFilter;
01795 }
|
|
Definition at line 1578 of file VirtualDatabase.java. Referenced by org.objectweb.cjdbc.controller.monitoring.datacollector.DataCollector.retrieveVirtualDatabasesData(), and org.objectweb.cjdbc.controller.core.ControllerWorkerThread.run(). 01579 {
01580 return currentNbOfThreads;
01581 }
|
|
Gets the virtual database name to be used by the client (C-JDBC driver) This method should be used for local references only (it is faster). For remote RMI calls, use getVirtualDatabaseName().
Definition at line 1805 of file VirtualDatabase.java. Referenced by org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabase.equals(), and org.objectweb.cjdbc.controller.virtualdatabase.DistributedVirtualDatabase.equals(). 01806 {
01807 return name;
01808 }
|
|
Definition at line 1813 of file VirtualDatabase.java. 01814 {
01815 return databaseProductNames;
01816 }
|
|
Get the current database schema from merging the schemas of all active backends. This is needed when a backend is disabled.
Definition at line 1838 of file VirtualDatabase.java. References org.objectweb.cjdbc.controller.recoverylog.JDBCRecoveryLog.getBackendTableName(), org.objectweb.cjdbc.controller.recoverylog.JDBCRecoveryLog.getCheckpointTableName(), org.objectweb.cjdbc.controller.backend.DatabaseBackend.getDatabaseProductName(), org.objectweb.cjdbc.controller.backend.DatabaseBackend.getDatabaseSchema(), org.objectweb.cjdbc.controller.recoverylog.JDBCRecoveryLog.getLogTableName(), org.objectweb.cjdbc.common.sql.schema.DatabaseSchema.hasTable(), org.objectweb.cjdbc.controller.backend.DatabaseBackend.isReadEnabled(), org.objectweb.cjdbc.common.sql.schema.DatabaseSchema.mergeSchema(), org.objectweb.cjdbc.controller.backend.DatabaseBackend.refreshSchema(), and org.objectweb.cjdbc.common.sql.schema.DatabaseSchema.removeTable(). 01840 { 01841 try 01842 { 01843 acquireReadLockBackendLists(); 01844 } 01845 catch (InterruptedException e) 01846 { 01847 String msg = "Unable to acquire read lock on backend list in getDatabaseSchemaFromActiveBackends (" 01848 + e + ")"; 01849 logger.error(msg); 01850 throw new SQLException(msg); 01851 } 01852 // Build the new schema from all active backend's schemas 01853 int size = backends.size(); 01854 DatabaseSchema schema = null; 01855 DatabaseBackend b = null; 01856 String dbProductNames = "C-JDBC"; 01857 for (int i = 0; i < size; i++) 01858 { 01859 b = (DatabaseBackend) backends.get(i); 01860 if (b.isReadEnabled()) 01861 { 01862 // When no parsing is required, the schema is not dynamically updated 01863 // and therefore we need to force the refresh. 01864 if (requestManager.getRequiredParsingGranularity() == ParsingGranularities.NO_PARSING) 01865 b.refreshSchema(); 01866 if (schema == null) 01867 schema = new DatabaseSchema(b.getDatabaseSchema()); 01868 else 01869 schema.mergeSchema(b.getDatabaseSchema()); 01870 } 01871 01872 // Update the list of database product names 01873 if (dbProductNames.indexOf(b.getDatabaseProductName()) == -1) 01874 dbProductNames += "," + b.getDatabaseProductName(); 01875 } 01876 01877 releaseReadLockBackendLists(); 01878 databaseProductNames = dbProductNames; 01879 if (logger.isDebugEnabled()) 01880 logger.debug("getDatabaseSchemaFromActiveBackends - end"); 01881 if (requestManager.getRecoveryLog() != null) 01882 { 01883 try 01884 { 01885 JDBCRecoveryLog log = (JDBCRecoveryLog) requestManager.getRecoveryLog(); 01886 // Remove recovery log tables from schema 01887 if (schema.hasTable(log.getBackendTableName())) 01888 schema.removeTable(new DatabaseTable(log.getBackendTableName())); 01889 if (schema.hasTable(log.getCheckpointTableName())) 01890 schema.removeTable(new DatabaseTable(log.getCheckpointTableName())); 01891 if (schema.hasTable(log.getLogTableName())) 01892 schema.removeTable(new DatabaseTable(log.getLogTableName())); 01893 } 01894 catch (RuntimeException ignore) 01895 { 01896 // Should be a ClassCastException 01897 } 01898 } 01899 return schema; 01900 }
|
|
Get the XML dump of the Distribution element if any.
Reimplemented in org.objectweb.cjdbc.controller.virtualdatabase.DistributedVirtualDatabase. Definition at line 2331 of file VirtualDatabase.java. 02332 { 02333 return ""; 02334 }
|
|
Definition at line 1822 of file VirtualDatabase.java. 01823 { 01824 if (metadata == null) 01825 { 01826 metadata = new VirtualDatabaseDynamicMetaData(this); 01827 } 01828 return metadata; 01829 }
|
|
Returns the number of idle zorker threads. Warning! This method must be called in a synchronized block on activeThreads.
Definition at line 1589 of file VirtualDatabase.java. Referenced by org.objectweb.cjdbc.controller.core.ControllerWorkerThread.run(). 01590 {
01591 return idleThreads;
01592 }
|
|
Returns the maxNbOfConnections.
Definition at line 1907 of file VirtualDatabase.java. Referenced by org.objectweb.cjdbc.controller.core.ControllerWorkerThread.run(). 01908 {
01909 return maxNbOfConnections;
01910 }
|
|
Returns the maxNbOfThreads.
Definition at line 1599 of file VirtualDatabase.java. Referenced by org.objectweb.cjdbc.controller.core.ControllerWorkerThread.run(). 01600 {
01601 return maxNbOfThreads;
01602 }
|
|
Returns the maxThreadIdleTime.
Definition at line 1609 of file VirtualDatabase.java. Referenced by org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabaseWorkerThread.run(). 01610 {
01611 return maxThreadIdleTime;
01612 }
|
|
Returns the minNbOfThreads.
Definition at line 1619 of file VirtualDatabase.java. Referenced by org.objectweb.cjdbc.controller.core.ControllerWorkerThread.run(). 01620 {
01621 return minNbOfThreads;
01622 }
|
|
Returns the pendingConnections.
Definition at line 1917 of file VirtualDatabase.java. Referenced by org.objectweb.cjdbc.controller.monitoring.datacollector.DataCollector.retrieveVirtualDatabasesData(), org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabaseWorkerThread.run(), and org.objectweb.cjdbc.controller.core.ControllerWorkerThread.run(). 01918 {
01919 return pendingConnections;
01920 }
|
|
Gets the request manager associated to this database.
Definition at line 1927 of file VirtualDatabase.java. Referenced by org.objectweb.cjdbc.common.monitor.scheduler.AbstractSchedulerDataCollector.collectValue(), org.objectweb.cjdbc.common.monitor.cache.AbstractCacheStatsDataCollector.collectValue(), org.objectweb.cjdbc.controller.virtualdatabase.protocol.VirtualDatabaseConfiguration.isCompatible(), org.objectweb.cjdbc.controller.monitoring.datacollector.DataCollector.retrieveCacheData(), org.objectweb.cjdbc.controller.monitoring.datacollector.DataCollector.retrieveCacheStatsData(), org.objectweb.cjdbc.controller.monitoring.datacollector.DataCollector.retrieveRecoveryLogData(), org.objectweb.cjdbc.controller.monitoring.datacollector.DataCollector.retrieveSchedulerData(), org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabaseWorkerThread.run(), org.objectweb.cjdbc.controller.virtualdatabase.protocol.VirtualDatabaseConfiguration.VirtualDatabaseConfiguration(), and org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabaseDynamicMetaData.VirtualDatabaseDynamicMetaData(). 01928 {
01929 return requestManager;
01930 }
|
|
Returns the current SQL monitor
Definition at line 1963 of file VirtualDatabase.java. Referenced by org.objectweb.cjdbc.controller.monitoring.datacollector.DataCollector.retrieveSQLStats(). 01964 {
01965 return sqlMonitor;
01966 }
|
|
Return the sql short form length to use when reporting an error.
Definition at line 1974 of file VirtualDatabase.java. Referenced by org.objectweb.cjdbc.controller.loadbalancer.paralleldb.ParallelDB_RR.chooseBackendForReadRequest(), org.objectweb.cjdbc.controller.loadbalancer.paralleldb.ParallelDB_LPRF.chooseBackendForReadRequest(), org.objectweb.cjdbc.controller.requestmanager.distributed.RAIDb2DistributedRequestManager.execDistributedWriteRequest(), org.objectweb.cjdbc.controller.requestmanager.distributed.RAIDb1DistributedRequestManager.execDistributedWriteRequest(), org.objectweb.cjdbc.controller.loadbalancer.singledb.SingleDB.execReadRequest(), org.objectweb.cjdbc.controller.loadbalancer.raidb2.RAIDb2_RR.execReadRequest(), org.objectweb.cjdbc.controller.loadbalancer.raidb2.RAIDb2_LPRF.execReadRequest(), org.objectweb.cjdbc.controller.loadbalancer.raidb0.RAIDb0.execReadRequest(), org.objectweb.cjdbc.controller.loadbalancer.paralleldb.ParallelDB.execReadRequest(), org.objectweb.cjdbc.controller.requestmanager.distributed.RAIDb2DistributedRequestManager.execRemoteReadRequest(), and org.objectweb.cjdbc.controller.requestmanager.distributed.RAIDb1DistributedRequestManager.execRemoteReadRequest(). 01975 {
01976 return sqlShortFormLength;
01977 }
|
|
Get the static metadata for this virtual database. A new one is created lazily if none is found.
Definition at line 1938 of file VirtualDatabase.java. 01939 { 01940 if (staticMetadata == null) 01941 { 01942 staticMetadata = new VirtualDatabaseStaticMetaData(this); 01943 } 01944 return staticMetadata; 01945 }
|
|
Gets the virtual database name to be used by the client (C-JDBC driver)
Definition at line 1952 of file VirtualDatabase.java. Referenced by org.objectweb.cjdbc.controller.virtualdatabase.protocol.VirtualDatabaseConfiguration.isCompatible(), org.objectweb.cjdbc.controller.core.Controller.removeVirtualDatabase(), org.objectweb.cjdbc.controller.monitoring.datacollector.DataCollector.retrieveVirtualDatabasesData(), org.objectweb.cjdbc.controller.virtualdatabase.protocol.VirtualDatabaseConfiguration.VirtualDatabaseConfiguration(), org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabaseDynamicMetaData.VirtualDatabaseDynamicMetaData(), org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabaseStaticMetaData.VirtualDatabaseStaticMetaData(), and org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabaseWorkerThread.VirtualDatabaseWorkerThread(). 01953 {
01954 return name;
01955 }
|
|
Retrieves this
Definition at line 2277 of file VirtualDatabase.java. References org.objectweb.cjdbc.controller.backend.DatabaseBackend.toString(). 02278 { 02279 StringBuffer info = new StringBuffer(); 02280 info.append("<C-JDBC>"); 02281 info.append("<" + DatabasesXmlTags.ELT_VirtualDatabase + " " 02282 + DatabasesXmlTags.ATT_name + "=\"" + this.getVirtualDatabaseName() 02283 + "\" " + DatabasesXmlTags.ATT_maxNbOfConnections + "=\"" 02284 + this.getMaxNbOfConnections() + "\" " 02285 + DatabasesXmlTags.ATT_poolThreads + "=\"" 02286 + this.isPoolConnectionThreads() + "\" " 02287 + DatabasesXmlTags.ATT_minNbOfThreads + "=\"" 02288 + this.getMinNbOfThreads() + "\" " 02289 + DatabasesXmlTags.ATT_maxNbOfThreads + "=\"" 02290 + this.getMaxNbOfThreads() + "\" " 02291 + DatabasesXmlTags.ATT_maxThreadIdleTime + "=\"" 02292 + this.getMaxThreadIdleTime() / 1000 + "\" " 02293 + DatabasesXmlTags.ATT_sqlDumpLength + "=\"" + this.sqlShortFormLength 02294 + "\" " + DatabasesXmlTags.ATT_blobEncodingMethod + "=\"" 02295 + this.blobFilter.getXml() + "\">"); 02296 02297 info.append(getDistributionXml()); 02298 02299 if (this.getSQLMonitor() != null) 02300 info.append(sqlMonitor.getXml()); 02301 02302 info.append(requestManager.getBackupManager().getXml()); 02303 02304 if (this.getAuthenticationManager() != null) 02305 info.append(authenticationManager.getXml()); 02306 02307 try 02308 { 02309 acquireReadLockBackendLists(); 02310 int size = backends.size(); 02311 for (int i = 0; i < size; i++) 02312 info.append(((DatabaseBackend) backends.get(i)).getXml()); 02313 releaseReadLockBackendLists(); 02314 } 02315 catch (InterruptedException e) 02316 { 02317 logger.error(Translate.get("virtualdatabase.fail.read.lock", e)); 02318 } 02319 if (requestManager != null) 02320 info.append(requestManager.getXml()); 02321 info.append("</" + DatabasesXmlTags.ELT_VirtualDatabase + ">"); 02322 info.append("</C-JDBC>"); 02323 return info.toString(); 02324 }
|
|
Definition at line 1982 of file VirtualDatabase.java. 01983 { 01984 AbstractRecoveryLog log = requestManager.getRecoveryLog(); 01985 if (log == null) 01986 return false; 01987 else 01988 return true; 01989 }
|
|
Definition at line 1994 of file VirtualDatabase.java. 01995 { 01996 AbstractResultCache cache = requestManager.getResultCache(); 01997 if (cache == null) 01998 return false; 01999 else 02000 return true; 02001 }
|
|
Is this virtual database distributed ?
Reimplemented in org.objectweb.cjdbc.controller.virtualdatabase.DistributedVirtualDatabase. Definition at line 265 of file VirtualDatabase.java. 00266 { 00267 return false; 00268 }
|
|
Returns the poolConnectionThreads.
Definition at line 1629 of file VirtualDatabase.java. 01630 {
01631 return poolConnectionThreads;
01632 }
|
|
Return true if this database is shutting down.
Definition at line 2158 of file VirtualDatabase.java. Referenced by org.objectweb.cjdbc.controller.core.ControllerWorkerThread.run(). 02159 {
02160 return shuttingDown;
02161 }
|
|
Releases the read lock on the backend lists (both enabled and disabled backends). This should be called after traversing the backend Definition at line 255 of file VirtualDatabase.java. References org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabase.rwLock. Referenced by org.objectweb.cjdbc.controller.virtualdatabase.DistributedVirtualDatabase.isCompatibleBackend(), and org.objectweb.cjdbc.controller.monitoring.datacollector.DataCollector.retrieveBackendsData(). 00256 { 00257 rwLock.releaseRead(); 00258 }
|
|
Remove a backend from this virtual database.
Definition at line 1301 of file VirtualDatabase.java. References org.objectweb.cjdbc.controller.backend.DatabaseBackend.getLastKnownCheckpoint(), and org.objectweb.cjdbc.controller.backend.DatabaseBackend.getName(). 01302 { 01303 if (db == null) 01304 { 01305 String msg = "Illegal null database backend in removeBackend(DatabaseBackend) method"; 01306 logger.error(msg); 01307 throw new VirtualDatabaseException(msg); 01308 } 01309 01310 try 01311 { 01312 rwLock.acquireWrite(); 01313 } 01314 catch (InterruptedException e) 01315 { 01316 String msg = Translate.get( 01317 "loadbalancer.backendlist.acquire.writelock.failed", e); 01318 logger.error(msg); 01319 throw new VirtualDatabaseException(msg); 01320 } 01321 01322 // Sanity checks 01323 int idx = backends.indexOf(db); 01324 if (idx == -1) 01325 { 01326 rwLock.releaseWrite(); // Release the lock 01327 String msg = "Trying to remove a non-existing backend " + db.getName(); 01328 logger.warn(msg); 01329 throw new VirtualDatabaseException(msg); 01330 } 01331 01332 if (((DatabaseBackend) backends.get(idx)).isReadEnabled()) 01333 { 01334 rwLock.releaseWrite(); // Release the lock 01335 String msg = "Trying to remove an enabled backend " + db.getName(); 01336 logger.error(msg); 01337 throw new VirtualDatabaseException(msg); 01338 } 01339 01340 // Remove it 01341 backends.remove(idx); 01342 rwLock.releaseWrite(); // Relase the lock 01343 01344 // Send notification 01345 if (MBeanServerManager.isJmxEnabled()) 01346 { 01347 // Send notification 01348 Hashtable data = new Hashtable(); 01349 data.put(CjdbcNotificationList.DATA_DATABASE, this.name); 01350 data.put(CjdbcNotificationList.DATA_DRIVER, db.getDriverClassName()); 01351 String checkpoint = db.getLastKnownCheckpoint(); 01352 checkpoint = (checkpoint == null) ? "" : checkpoint; 01353 data.put(CjdbcNotificationList.DATA_CHECKPOINT, checkpoint); 01354 data.put(CjdbcNotificationList.DATA_NAME, db.getName()); 01355 data.put(CjdbcNotificationList.DATA_URL, db.getURL()); 01356 RmiConnector.broadcastNotification(this, 01357 CjdbcNotificationList.VIRTUALDATABASE_BACKEND_REMOVED, 01358 CjdbcNotificationList.NOTIFICATION_LEVEL_INFO, Translate.get( 01359 "notification.backend.removed", db.getName()), data); 01360 01361 // Remove backend mbean to jmx server 01362 ObjectName objectName = JmxConstants.getDatabaseBackendObjectName(name, 01363 db.getName()); 01364 try 01365 { 01366 MBeanServerManager.unregister(objectName); 01367 } 01368 catch (JmxException e1) 01369 { 01370 logger.error(Translate.get( 01371 "virtualdatabase.fail.unregister.backend.mbean", db.getName()), e1); 01372 } 01373 } 01374 01375 if (logger.isDebugEnabled()) 01376 logger.debug("Backend " + db.getName() + " removed successfully"); 01377 }
|
|
Reimplemented in org.objectweb.cjdbc.controller.virtualdatabase.DistributedVirtualDatabase. Definition at line 1290 of file VirtualDatabase.java. 01291 { 01292 removeBackend(getAndCheckBackend(backend, NO_CHECK_BACKEND)); 01293 }
|
|
Remove a checkpoint from the recovery log of this virtual database
Definition at line 1471 of file VirtualDatabase.java. 01473 { 01474 try 01475 { 01476 requestManager.removeCheckpoint(checkpointName); 01477 } 01478 catch (Exception e) 01479 { 01480 throw new VirtualDatabaseException(e.getMessage()); 01481 } 01482 }
|
|
Substract one to currentNbOfThreads. Warning! This method is not synchronized. Definition at line 1638 of file VirtualDatabase.java. Referenced by org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabaseWorkerThread.run(). 01639 { 01640 currentNbOfThreads--; 01641 }
|
|
Definition at line 1442 of file VirtualDatabase.java. 01443 { 01444 logger.info(Translate.get("controller.remove.dump", dumpFile.getName())); 01445 if (!dumpFile.delete()) 01446 { 01447 logger.info(Translate.get("controller.remove.dump.failed", dumpFile 01448 .getName())); 01449 dumpFile = new File(getRequestManager().getBackupManager().getBackupDir() 01450 + File.separatorChar + dumpFile.getName()); 01451 logger.info(Translate.get("controller.remove.dump", dumpFile.getName())); 01452 if (!dumpFile.delete()) 01453 { 01454 logger.info(Translate.get("controller.remove.dump.failed", dumpFile 01455 .getName())); 01456 return false; 01457 } 01458 else 01459 return true; 01460 } 01461 else 01462 return true; 01463 }
|
|
Remove an idle thread. Warning! This method must be called in a synchronized block on activeThreads. Definition at line 1647 of file VirtualDatabase.java. Referenced by org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabaseWorkerThread.run(). 01648 { 01649 idleThreads--; 01650 }
|
|
Definition at line 1264 of file VirtualDatabase.java. References org.objectweb.cjdbc.controller.backend.DatabaseBackend.copy(). 01266 { 01267 // Access the backend we want to replicate 01268 DatabaseBackend backend = getAndCheckBackend(backendName, NO_CHECK_BACKEND); 01269 DatabaseBackend newBackend = null; 01270 01271 // Create a clone of the backend with additionnal parameters 01272 try 01273 { 01274 newBackend = backend.copy(newBackendName, parameters); 01275 } 01276 catch (Exception e) 01277 { 01278 String msg = Translate.get("virtualdatabase.fail.backend.copy"); 01279 logger.warn(msg, e); 01280 throw new VirtualDatabaseException(msg); 01281 } 01282 01283 // Add the backend to the virtual database. 01284 addBackend(newBackend); 01285 }
|
|
Definition at line 1488 of file VirtualDatabase.java. 01491 { 01492 DatabaseBackend backend = getAndCheckBackend(databaseBackendName, 01493 NO_CHECK_BACKEND); 01494 // Backend cannot be null, otherwise the above throws an 01495 // VirtualDatabaseException 01496 requestManager.restoreBackendFromBackupCheckpoint(backend, checkpointName, 01497 true, null); 01498 }
|
|
Definition at line 2131 of file VirtualDatabase.java. 02132 { 02133 try 02134 { 02135 acquireReadLockBackendLists(); 02136 } 02137 catch (InterruptedException e) 02138 { 02139 String msg = Translate.get("virtualdatabase.fail.read.lock", e); 02140 throw new VirtualDatabaseException(msg); 02141 } 02142 ArrayList backends = this.getBackends(); 02143 int backendListSize = backends.size(); 02144 String[][] data = new String[backendListSize][]; 02145 for (int i = 0; i < backendListSize; i++) 02146 { 02147 data[i] = ((DatabaseBackend) backends.get(i)).getBackendData(); 02148 } 02149 releaseReadLockBackendLists(); 02150 return data; 02151 }
|
|
Rollbacks a transaction given its id.
Definition at line 618 of file VirtualDatabase.java. Referenced by org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabaseWorkerThread.run(). 00619 { 00620 try 00621 { 00622 if (requestLogger.isInfoEnabled()) 00623 requestLogger.info("R " + transactionId); 00624 requestManager.rollback(transactionId); 00625 } 00626 catch (SQLException e) 00627 { 00628 String msg = "Rollback of transaction '" + transactionId + "' failed (" 00629 + e.getMessage() + ")"; 00630 logger.warn(msg); 00631 throw e; 00632 } 00633 }
|
|
Sets the authentication manager for this virtual database.
Reimplemented in org.objectweb.cjdbc.controller.virtualdatabase.DistributedVirtualDatabase. Definition at line 2009 of file VirtualDatabase.java. 02011 {
02012 this.authenticationManager = authenticationManager;
02013 }
|
|
Definition at line 1503 of file VirtualDatabase.java. References org.objectweb.cjdbc.controller.backend.DatabaseBackend.getName(), org.objectweb.cjdbc.controller.backend.DatabaseBackend.getStateValue(), org.objectweb.cjdbc.controller.backend.DatabaseBackend.isDisabled(), org.objectweb.cjdbc.controller.backend.DatabaseBackend.name, org.objectweb.cjdbc.controller.backend.DatabaseBackend.setLastKnownCheckpoint(), and org.objectweb.cjdbc.controller.recoverylog.AbstractRecoveryLog.storeBackendRecoveryInfo(). 01505 { 01506 AbstractRecoveryLog log = requestManager.getRecoveryLog(); 01507 DatabaseBackend backend = getAndCheckBackend(backendName, NO_CHECK_BACKEND); 01508 if (log == null) 01509 throw new VirtualDatabaseException(ExceptionTypes.NO_RECOVERY_LOG); 01510 else 01511 { 01512 if (!backend.isDisabled()) 01513 throw new VirtualDatabaseException( 01514 "Cannot setLastKnownCheckpoint on a non-disabled backend"); 01515 else 01516 { 01517 try 01518 { 01519 log.storeBackendRecoveryInfo(this.name, 01520 new BackendRecoveryInfo(backend.getName(), checkpoint, backend 01521 .getStateValue(), this.name)); 01522 01523 backend.setLastKnownCheckpoint(checkpoint); 01524 } 01525 catch (SQLException e) 01526 { 01527 throw new VirtualDatabaseException( 01528 "Failed to store recovery info for backend '" + backendName 01529 + "' (" + e + ")"); 01530 } 01531 } 01532 } 01533 }
|
|
Set the BLOB filter to use for this database.
Definition at line 2020 of file VirtualDatabase.java. 02021 {
02022 this.blobFilter = filter;
02023 }
|
|
Sets a new database schema for this database if no one exist or merge the given schema to the existing one. A static schema can only be replaced by another static schema.
Definition at line 2033 of file VirtualDatabase.java. 02034 { 02035 if (requestManager != null) 02036 requestManager.setDatabaseSchema(schema, isStatic); 02037 else 02038 logger 02039 .warn("Unable to set database schema, no request manager has been defined."); 02040 }
|
|
Sets the maxNbOfConnections.
Definition at line 2047 of file VirtualDatabase.java. 02048 {
02049 this.maxNbOfConnections = maxNbOfConnections;
02050 }
|
|
Sets the maxNbOfThreads.
Definition at line 2057 of file VirtualDatabase.java. 02058 {
02059 this.maxNbOfThreads = maxNbOfThreads;
02060 }
|
|
Sets the maxThreadIdleTime.
Definition at line 1657 of file VirtualDatabase.java. 01658 {
01659 this.maxThreadIdleTime = maxThreadIdleTime;
01660 }
|
|
Sets the minNbOfThreads.
Definition at line 1667 of file VirtualDatabase.java. 01668 {
01669 this.minNbOfThreads = minNbOfThreads;
01670 }
|
|
Definition at line 2085 of file VirtualDatabase.java. 02087 { 02088 if (sqlMonitor == null) 02089 throw new VirtualDatabaseException(Translate 02090 .get("virtualdatabase.monitoring.not.defined")); 02091 else 02092 sqlMonitor.setActive(active); 02093 }
|
|
Sets the poolConnectionThreads.
Definition at line 1677 of file VirtualDatabase.java. 01678 {
01679 this.poolConnectionThreads = poolConnectionThreads;
01680 }
|
|
Sets a new request manager for this database.
Reimplemented in org.objectweb.cjdbc.controller.virtualdatabase.DistributedVirtualDatabase. Definition at line 2067 of file VirtualDatabase.java. 02068 {
02069 this.requestManager = requestManager;
02070 }
|
|
Sets a new SQL Monitor
Definition at line 2077 of file VirtualDatabase.java. 02078 {
02079 this.sqlMonitor = sqlMonitor;
02080 }
|
|
Definition at line 2166 of file VirtualDatabase.java. References org.objectweb.cjdbc.controller.core.shutdown.ShutdownThread.getShutdownGroup(). 02167 { 02168 VirtualDatabaseShutdownThread vdst = null; 02169 synchronized (this) 02170 { 02171 if (shuttingDown) 02172 return; 02173 switch (level) 02174 { 02175 case Constants.SHUTDOWN_WAIT : 02176 vdst = new VirtualDatabaseWaitShutdownThread(this); 02177 logger.info(Translate.get("controller.shutdown.type.wait", this 02178 .getVirtualDatabaseName())); 02179 break; 02180 case Constants.SHUTDOWN_SAFE : 02181 shuttingDown = true; 02182 vdst = new VirtualDatabaseSafeShutdownThread(this); 02183 logger.info(Translate.get("controller.shutdown.type.safe", this 02184 .getVirtualDatabaseName())); 02185 break; 02186 case Constants.SHUTDOWN_FORCE : 02187 shuttingDown = true; 02188 vdst = new VirtualDatabaseForceShutdownThread(this); 02189 logger.warn(Translate.get("controller.shutdown.type.force", this 02190 .getVirtualDatabaseName())); 02191 break; 02192 default : 02193 String msg = Translate 02194 .get("controller.shutdown.unknown.level", level); 02195 logger.error(msg); 02196 throw new RuntimeException(msg); 02197 } 02198 } 02199 02200 new Thread(vdst.getShutdownGroup(), vdst, "VirtualDatabase Shutdown Thread") 02201 .start(); 02202 }
|
|
Write the checkpoints for all backends on the recovery log Definition at line 2207 of file VirtualDatabase.java. 02208 { 02209 requestManager.storeBackendsInfo(this.name, getBackends()); 02210 }
|
|
Reimplemented in org.objectweb.cjdbc.controller.virtualdatabase.DistributedVirtualDatabase. Definition at line 1383 of file VirtualDatabase.java. 01385 { 01386 throw new VirtualDatabaseException("Cannot transfer backend to controller:" 01387 + controllerDestination + " because database is not distributed"); 01388 }
|
|
Get all users connected to that database
Definition at line 2218 of file VirtualDatabase.java. 02219 { 02220 ArrayList list = this.getActiveThreads(); 02221 int size = list.size(); 02222 ArrayList clients = new ArrayList(size); 02223 for (int i = 0; i < list.size(); i++) 02224 clients.add(((VirtualDatabaseWorkerThread) list.get(i)).getUser()); 02225 return clients; 02226 }
|
|
Definition at line 2231 of file VirtualDatabase.java. References org.objectweb.cjdbc.controller.backend.DatabaseBackend.getBackendData(). 02233 { 02234 DatabaseBackend backend = getAndCheckBackend(backendName, NO_CHECK_BACKEND); 02235 return backend.getBackendData(); 02236 }
|
|
Definition at line 1538 of file VirtualDatabase.java. References org.objectweb.cjdbc.controller.recoverylog.AbstractRecoveryLog.getCheckpointNames(). 01539 { 01540 try 01541 { 01542 AbstractRecoveryLog recoveryLog = requestManager.getRecoveryLog(); 01543 if (recoveryLog == null) 01544 return new ArrayList(); 01545 else 01546 return recoveryLog.getCheckpointNames(); 01547 } 01548 catch (SQLException e) 01549 { 01550 return new ArrayList(); 01551 } 01552 }
|
|
Reimplemented in org.objectweb.cjdbc.controller.virtualdatabase.DistributedVirtualDatabase. Definition at line 2241 of file VirtualDatabase.java. 02242 { 02243 return new String[]{viewOwningController()}; 02244 }
|
|
Reimplemented in org.objectweb.cjdbc.controller.virtualdatabase.DistributedVirtualDatabase. Definition at line 2249 of file VirtualDatabase.java. 02250 { 02251 Hashtable map = new Hashtable(); 02252 map.put(controller.getJmxName(), getAllBackendNames()); 02253 return map; 02254 }
|
|
Definition at line 2259 of file VirtualDatabase.java. Referenced by org.objectweb.cjdbc.controller.virtualdatabase.protocol.VirtualDatabaseConfiguration.VirtualDatabaseConfiguration(). 02260 { 02261 return controller.getJmxName(); 02262 }
|
|
Authentification manager matching virtual database login/password to backends login/password Definition at line 118 of file VirtualDatabase.java. Referenced by org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabase.checkAdminAuthentication(), and org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabase.checkUserAuthentication(). |
|
Definition at line 121 of file VirtualDatabase.java. Referenced by org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabase.VirtualDatabase(). |
|
Use for method getAndCheck Definition at line 170 of file VirtualDatabase.java. |
|
Use for method getAndCheck Definition at line 168 of file VirtualDatabase.java. |
|
The controller we belong to Definition at line 181 of file VirtualDatabase.java. Referenced by org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabaseWorkerThread.VirtualDatabaseWorkerThread(). |
|
Current number of worker threads Definition at line 159 of file VirtualDatabase.java. Referenced by org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabaseWorkerThread.run(). |
|
Virtual database logger Definition at line 130 of file VirtualDatabase.java. Referenced by org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabase.checkAdminAuthentication(), org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabase.checkUserAuthentication(), org.objectweb.cjdbc.controller.requestmanager.distributed.DistributedRequestManager.enableBackend(), org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabase.execReadRequest(), org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabase.execReadStoredProcedure(), org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabase.execWriteRequest(), org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabase.execWriteRequestWithKeys(), org.objectweb.cjdbc.controller.virtualdatabase.protocol.VirtualDatabaseConfiguration.isCompatible(), org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabase.VirtualDatabase(), org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabaseDynamicMetaData.VirtualDatabaseDynamicMetaData(), org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabaseStaticMetaData.VirtualDatabaseStaticMetaData(), and org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabaseWorkerThread.VirtualDatabaseWorkerThread(). |
|
Maximum number of concurrent accepted for this virtual database Definition at line 141 of file VirtualDatabase.java. |
|
Maximum number of worker threads to fork Definition at line 156 of file VirtualDatabase.java. |
|
Maximum time a worker thread can remain idle before dying Definition at line 147 of file VirtualDatabase.java. |
|
Virtual Database MetaData Definition at line 162 of file VirtualDatabase.java. |
|
Minimum number of worker threads to keep in the pool if poolConnectionThreads is true Definition at line 153 of file VirtualDatabase.java. Referenced by org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabaseWorkerThread.run(). |
|
Virtual database name Definition at line 112 of file VirtualDatabase.java. Referenced by org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabase.VirtualDatabase(). |
|
Use for method getAndCheck Definition at line 172 of file VirtualDatabase.java. |
|
If false one worker thread is forked per connection else Definition at line 144 of file VirtualDatabase.java. Referenced by org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabaseWorkerThread.run(). |
|
The request manager to use for this database Definition at line 127 of file VirtualDatabase.java. Referenced by org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabase.execReadRequest(), org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabase.execReadStoredProcedure(), org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabase.execWriteRequest(), and org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabase.execWriteRequestWithKeys(). |
|
Read/Write lock for backend list Definition at line 124 of file VirtualDatabase.java. Referenced by org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabase.acquireReadLockBackendLists(), org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabase.releaseReadLockBackendLists(), and org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabase.VirtualDatabase(). |