src/org/sonews/storage/impl/DrupalDatabaseProvider.java
changeset 93 3009cb0be547
parent 64 72950b29569e
     1.1 --- a/src/org/sonews/storage/impl/DrupalDatabaseProvider.java	Sun Oct 09 00:00:25 2011 +0200
     1.2 +++ b/src/org/sonews/storage/impl/DrupalDatabaseProvider.java	Mon Oct 17 21:11:59 2011 +0200
     1.3 @@ -17,7 +17,6 @@
     1.4   */
     1.5  package org.sonews.storage.impl;
     1.6  
     1.7 -import java.sql.SQLException;
     1.8  import java.util.Map;
     1.9  import java.util.concurrent.ConcurrentHashMap;
    1.10  import org.sonews.storage.Storage;
    1.11 @@ -38,19 +37,14 @@
    1.12  	}
    1.13  
    1.14  	@Override
    1.15 -	public Storage storage(Thread thread)
    1.16 -			throws StorageBackendException {
    1.17 -		try {
    1.18 -			if (!instances.containsKey(Thread.currentThread())) {
    1.19 -				DrupalDatabase db = new DrupalDatabase();
    1.20 -				db.arise();
    1.21 -				instances.put(Thread.currentThread(), db);
    1.22 -				return db;
    1.23 -			} else {
    1.24 -				return instances.get(Thread.currentThread());
    1.25 -			}
    1.26 -		} catch (SQLException ex) {
    1.27 -			throw new StorageBackendException(ex);
    1.28 +	public Storage storage(Thread thread) throws StorageBackendException {
    1.29 +		DrupalDatabase db = instances.get(Thread.currentThread());
    1.30 +
    1.31 +		if (db == null) {
    1.32 +			db = new DrupalDatabase();
    1.33 +			instances.put(Thread.currentThread(), db);
    1.34  		}
    1.35 +
    1.36 +		return db;
    1.37  	}
    1.38 -}
    1.39 +}
    1.40 \ No newline at end of file