public synchronized Store open()

in src/main/java/org/apache/servicemix/store/jdbc/JdbcStoreFactory.java [50:87]


    public synchronized Store open(String name) throws IOException {
        if (adapter == null) {
            Connection connection = null;
            try {
                connection = getDataSource().getConnection();
                adapter = JDBCAdapterFactory.getAdapter(connection);
                if (statements == null) {
                    statements = new Statements();
                    statements.setStoreTableName(tableName);
                }
                adapter.setStatements(statements);
                if (createDataBase) {
                    adapter.doCreateTables(connection);
                }
                if (!connection.getAutoCommit())
                    connection.commit();
            } catch (SQLException e) {
                throw (IOException) new IOException("Exception while creating database").initCause(e); 
            } finally {
                if (connection != null) {
                    try {
                        connection.close();
                    } catch (Exception e) {
                        // Do nothing
                    }
                }
            }
        }
        JdbcStore store = stores.get(name);
        if (store == null) {
            store = new JdbcStore(this, name);
            for(StoreListener listener:storeListeners) {
                store.addListener(listener);
            }
            stores.put(name, store);
        }
        return store;
    }