public static void setConnectionProvider(ConnectionProvider provider) {
        synchronized (providerLock) {
            if (connectionProvider != null) {
                connectionProvider.destroy();
                connectionProvider = null;
            }
            connectionProvider = provider;
            connectionProvider.start();
            // Now, get a connection to determine meta data.
            Connection con = null;
            try {
                con = connectionProvider.getConnection();
                setMetaData(con);

                // Check to see if the database schema needs to be upgraded.
                schemaManager.checkOpenfireSchema(con);
            }
            catch (MissingResourceException mre) {
                Log.error(mre.getMessage());
            }
            catch (Exception e) {
                Log.error(e.getMessage(), e);
            }
            finally {
                closeConnection(con);
            }
        }
        // Remember what connection provider we want to use for restarts.
        JiveGlobals.setXMLProperty("connectionProvider.className", provider.getClass().getName());
    }
Sets the connection provider. The old provider (if it exists) is shut
down before the new one is started. A connection provider <b>should
not</b> be started before being passed to the connection manager
because the manager will call the start() method automatically.

@param provider the ConnectionProvider that the manager should obtain
                connections from.
xmppserver/src/main/java/org/jivesoftware/database/DbConnectionManager.java