plugins/org.apache.karaf.eik.app/src/main/java/org/apache/karaf/main/DefaultJDBCLock.java [129:203]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
            if (rows >= 1) {
                result=true;
            }
        } catch (Exception e) {
            LOG.warning("Failed to acquire database lock: " + e.getMessage());
        }finally {
            if (statement != null) {
                try {
                    statement.close();
                } catch (SQLException e) {
                    LOG.severe("Failed to close statement" + e);
                }
            }
        }
        return result;
    }

    /**
     * release - terminate the lock connection safely.
     */
    public void release() throws Exception {
        if (lockConnection != null && !lockConnection.isClosed()) {
            lockConnection.rollback();
            lockConnection.close();
            lockConnection = null;
        }
    }

    /**
     * isAlive - test if lock still exists.
     */
    public boolean isAlive() throws Exception {
        if ((lockConnection == null) || (lockConnection.isClosed())) {
            LOG.severe("Lost lock!");
            return false;
        }
        PreparedStatement statement = null;
        boolean result = true;
        try {
            long time = System.currentTimeMillis();
            statement = lockConnection.prepareStatement(statements.getLockUpdateStatement(time));
            int rows = statement.executeUpdate();
            if (rows < 1) {
                result = false;
            }
        } catch (Exception ex) {
            LOG.severe("Error occured while testing lock: " + ex + " " + ex.getMessage());
            return false;
        } finally {
            if (statement != null) {
                try {
                    statement.close();
                } catch (Exception ex1) {
                    LOG.severe("Error occured after testing lock: " + ex1.getMessage());
                }
            }
        }
        return result;
    }

    /**
     * getConnection - Obtain connection to database via jdbc driver.
     *
     * @throws Exception
     * @param driver, the JDBC driver class.
     * @param url, url to data source.
     * @param username, user to access data source.
     * @param password, password for specified user.
     * @return connection, null returned if conenction fails.
     */
    private Connection getConnection(String driver, String url,
                                     String username, String password) throws Exception {
        Connection conn = null;
        try {
            Class.forName(driver);
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



plugins/org.apache.karaf.eik.app/src/main/java/org/apache/karaf/main/MySQLJDBCLock.java [161:235]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
            if (rows >= 1) {
                result=true;
            }
        } catch (Exception e) {
            LOG.warning("Failed to acquire database lock: " + e.getMessage());
        }finally {
            if (statement != null) {
                try {
                    statement.close();
                } catch (SQLException e) {
                    LOG.severe("Failed to close statement" + e);
                }
            }
        }
        return result;
    }

    /**
     * release - terminate the lock connection safely.
     */
    public void release() throws Exception {
        if (lockConnection != null && !lockConnection.isClosed()) {
            lockConnection.rollback();
            lockConnection.close();
            lockConnection = null;
        }
    }

    /**
     * isAlive - test if lock still exists.
     */
    public boolean isAlive() throws Exception {
        if ((lockConnection == null) || (lockConnection.isClosed())) { 
            LOG.severe("Lost lock!");
            return false; 
        }
        PreparedStatement statement = null;
        boolean result = true;
        try { 
            long time = System.currentTimeMillis();
            statement = lockConnection.prepareStatement(statements.getLockUpdateStatement(time));
            int rows = statement.executeUpdate();
            if (rows < 1) {
                result = false;
            }
        } catch (Exception ex) {
            LOG.severe("Error occured while testing lock: " + ex + " " + ex.getMessage());
            return false;
        } finally {
            if (statement != null) {
                try {
                    statement.close();
                } catch (Exception ex1) {
                    LOG.severe("Error occured after testing lock: " + ex1.getMessage());
                }
            }
        }
        return result;
    }

    /**
     * getConnection - Obtain connection to database via jdbc driver.
     *
     * @throws Exception
     * @param driver, the JDBC driver class.
     * @param url, url to data source.
     * @param username, user to access data source.
     * @param password, password for specified user.
     * @return connection, null returned if conenction fails.
     */
    private Connection getConnection(String driver, String url, 
                                     String username, String password) throws Exception {
        Connection conn = null;
        try {
            Class.forName(driver);
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



