You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by dj...@apache.org on 2005/02/03 19:45:11 UTC
svn commit: r151201 - in
incubator/derby/code/trunk/java/engine/org/apache/derby:
iapi/jdbc/JDBCBoot.java jdbc/Driver169.java
Author: djd
Date: Thu Feb 3 10:45:10 2005
New Revision: 151201
URL: http://svn.apache.org/viewcvs?view=rev&rev=151201
Log:
Maintain boot state of system in Derby classes (Driver169, soon to be InternalDriver)
rather than relying on java.sql.DriverManager. This is because java.sql.DriverManager
is not part of J2ME/CDC/Foundation or JSR169.
Modified:
incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/JDBCBoot.java
incubator/derby/code/trunk/java/engine/org/apache/derby/jdbc/Driver169.java
Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/JDBCBoot.java
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/JDBCBoot.java?view=diff&r1=151200&r2=151201
==============================================================================
--- incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/JDBCBoot.java (original)
+++ incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/JDBCBoot.java Thu Feb 3 10:45:10 2005
@@ -60,12 +60,8 @@
*/
public void boot(String protocol, PrintStream logging) {
- try {
-
- // throws a SQLException if there is no driver
- DriverManager.getDriver(protocol);
-
- } catch (SQLException sqle) {
+ if (org.apache.derby.jdbc.Driver169.activeDriver() == null)
+ {
// request that the java.sql.Driver (JDBC) service and the
// authentication service be started.
Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/jdbc/Driver169.java
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/engine/org/apache/derby/jdbc/Driver169.java?view=diff&r1=151200&r2=151201
==============================================================================
--- incubator/derby/code/trunk/java/engine/org/apache/derby/jdbc/Driver169.java (original)
+++ incubator/derby/code/trunk/java/engine/org/apache/derby/jdbc/Driver169.java Thu Feb 3 10:45:10 2005
@@ -66,10 +66,18 @@
public abstract class Driver169 implements ModuleControl {
+ private static final Object syncMe = new Object();
+ private static Driver169 activeDriver;
+
protected boolean active;
private ContextService contextServiceFactory;
private AuthenticationService authenticationService;
+ public static final Driver169 activeDriver()
+ {
+ return activeDriver;
+ }
+
public Driver169() {
contextServiceFactory = ContextService.getFactory();
}
@@ -80,10 +88,20 @@
public void boot(boolean create, Properties properties) throws StandardException {
+ synchronized (Driver169.syncMe)
+ {
+ Driver169.activeDriver = this;
+ }
+
active = true;
}
public void stop() {
+
+ synchronized (Driver169.syncMe)
+ {
+ Driver169.activeDriver = null;
+ }
active = false;