View | Details | Raw Unified | Return to bug 34319
Collapse All | Expand All

(-)JDBCStore.java (+45 lines)
Line 961 Link Here
961
     * Remove any old (expired) Sessions from this JDBCStore.   For
962
     * efficiency, this overrides the behavior of StoreBase so that we
963
     * don't have to load sessions into memory before deleting them.
964
     *
965
     */
966
    public void processExpires() {
967
968
        synchronized (this) {
969
            int numberOfTries = 2;
970
            while (numberOfTries > 0) {
971
                Connection _conn = getConnection();
972
973
                if (_conn == null) {
974
                    return;
975
                }
976
977
                try {
978
                    if (preparedExpireSql == null) {
979
                        String expireSql =
980
                            "DELETE FROM " + sessionTable +
981
                            " WHERE " + sessionAppCol + " = ?" +
982
                            " AND ? > (" +
983
                            sessionLastAccessedCol + " + (" +
984
                            sessionMaxInactiveCol + "*1000))";
985
                        preparedExpireSql = _conn.prepareStatement(expireSql);
986
                    }
987
988
                    preparedExpireSql.setString(1, getName());
989
                    preparedExpireSql.setLong(2, System.currentTimeMillis());
990
                    preparedExpireSql.execute();
991
                    // break out after the finally block
992
                    numberOfTries = 0;
993
                } catch (SQLException e) {
994
                    log(sm.getString(getStoreName() + ".SQLException", e));
995
                    if (dbConnection != null)
996
                        close(dbConnection);
997
                } finally {
998
                    release(_conn);
999
                }
1000
                numberOfTries--;
1001
            }
1002
        }
1003
    }
1004
1005
    /**

Return to bug 34319