void doInvalidations(Connection nukerCon) throws SQLException {
        //create local variable - JIT performance improvement
        final boolean isTraceOn = com.ibm.websphere.ras.TraceComponent.isAnyTracingEnabled();
        if (isTraceOn && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
            LoggingUtil.SESSION_LOGGER_WAS.entering(methodClassName, methodNames[DO_INVALIDATIONS]);
        }
        String id = null;
        long lastAccessTime = 0;
        long createTime = 0;
        ResultSet rs = null;
        PreparedStatement delNukeStatement = null;
        PreparedStatement scanPropPs = null;
        PreparedStatement delNuke2 = null;
        PreparedStatement subDel = null;
        ResultSet rs2 = null;
        boolean delClose = false;
        boolean scanClose = false;
        boolean subClose = false;
        boolean del2Close = false;

        try {
            int oldIsolationLevel = 0;

            long now = System.currentTimeMillis();
            String appName = getIStore().getId();

            String selDelNoListener = this.selDelNoListener;

            if (usingDB2 || usingDerby) {
                selDelNoListener = selDelNoListener + " for read only";
                oldIsolationLevel = nukerCon.getTransactionIsolation();
                nukerCon.setTransactionIsolation(java.sql.Connection.TRANSACTION_READ_UNCOMMITTED);
            }

            delNukeStatement = nukerCon.prepareStatement(selDelNoListener);
            delNukeStatement.setString(1, appName);
            setPSLong(delNukeStatement, 2, now);

            if (isTraceOn && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
                LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, methodNames[DO_INVALIDATIONS], "executing read/uncom scan");
            }

            rs = delNukeStatement.executeQuery();

            if (isTraceOn && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
                LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, methodNames[DO_INVALIDATIONS], "after uncom query ");
            }

            //get all the candidates eligible for invalidation
            Hashtable primaryRows = new Hashtable();
            Hashtable creationTimes = new Hashtable();
            while (rs.next()) {
                id = rs.getString(1);
                lastAccessTime = rs.getLong(2);
                createTime = rs.getLong(3);
                primaryRows.put(id, new Long(lastAccessTime));
                creationTimes.put(id, new Long(createTime));
                if (isTraceOn && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
                    LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, methodNames[DO_INVALIDATIONS], "executing read/uncom scan, recording " + id);
                }
                if ((now + _smc.getInvalidationCheckInterval() * 1000) <= System.currentTimeMillis()) {
                    //If the scan is taking more than pollInterval,just break and
                    //invalidate the sessions so far determined
                    break;
                }
            }

            rs.close();
            delNukeStatement.close();
            delClose = true;

            /*
             * PK71265: Remove the section retrieving attribute rows as session manager
             * will remove the attribute rows in a single query.
             *
             *
             * if (isTraceOn&&LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
             * LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, methodNames[DO_INVALIDATIONS], "before read of ucom scan results ");
             * }
             *
             * Enumeration enum1 = primaryRows.keys();
             *
             *
             * Hashtable multiRowProps = new Hashtable();
             * while (_smc.isUsingMultirow() && enum1.hasMoreElements()) {
             * scanPropPs = null;
             * scanPropPs = nukerCon.prepareStatement(findAllKeys);
             * id = (String) enum1.nextElement();
             * scanPropPs.setString(1, id);
             * scanPropPs.setString(2, appName);
             * rs2 = scanPropPs.executeQuery();
             * Vector propVec = new Vector();
             * while (rs2.next()) {
             * String propid = rs2.getString(propCol);
             * propVec.addElement(propid);
             * if (isTraceOn&&LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
             * LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, methodNames[DO_INVALIDATIONS], "executing read/uncom scan," + "recording for " + id + " prop " +
             * propid);
             * LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, methodNames[DO_INVALIDATIONS], "propVec currently " + propVec.toString());
             * }
             * }
             * multiRowProps.put(id, propVec);
             * if (isTraceOn&&LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
             * LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, methodNames[DO_INVALIDATIONS], "ht currently " + multiRowProps.toString());
             * }
             * rs2.close();
             * scanPropPs.close();
             * scanClose = true;
             * }
             *
             * if (isTraceOn&&LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
             * LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, methodNames[DO_INVALIDATIONS], "after read of ucom scan results, befor commit ");
             * }
             */

            if (usingDB2) {
                nukerCon.setTransactionIsolation(oldIsolationLevel);
            }

            if (isTraceOn && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
                LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, methodNames[DO_INVALIDATIONS], "delete primary row vector " + primaryRows);
                if (primaryRows != null) {
                    LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, methodNames[DO_INVALIDATIONS], "with size reported " + primaryRows.size());
                }
            }
            //loop through each eligible candidate
            Enumeration enum1 = primaryRows.keys();
            int deleteCount = 0;
            BackedSession pmiStatSession = null; // fake session for pmi stats
            SessionStatistics pmiStats = null;
            while (enum1.hasMoreElements()) {
                id = (String) enum1.nextElement();
                if (isTraceOn && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
                    LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, methodNames[DO_INVALIDATIONS], "current index into delete primary row vector " + id);
                }

                now = System.currentTimeMillis();
                long lastAccess = ((Long) primaryRows.get(id)).longValue();
                delNuke2 = nukerCon.prepareStatement(delPrimaryRowInval);
                delNuke2.setString(1, id);
                delNuke2.setString(2, appName);
                setPSLong(delNuke2, 3, lastAccess);

                if (isTraceOn && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
                    LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, methodNames[DO_INVALIDATIONS], "delete for " + id);
                }

                int rc = delNuke2.executeUpdate();
                if (isTraceOn && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
                    LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, methodNames[DO_INVALIDATIONS], "after del of  " + id);
                }

                delNuke2.close();
                del2Close = true;

                if (isTraceOn && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
                    LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, methodNames[DO_INVALIDATIONS], "num of rows deleted " + rc);
                }

                if (rc > 0) {
                    //delete sub rows
                    if (_smc.isUsingMultirow()) {

                        /*
                         * PK71265 : Rather than removing the associated rows which persists the attributes individually.
                         * We will remove all associated rows in one query for an invalid non-listeners sessions, which
                         * is the same way we handle assoicated rows for invalid listeners sessions
                         *
                         * Vector vec2 = (Vector) multiRowProps.get(id);
                         * if (isTraceOn&&LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
                         * LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, methodNames[DO_INVALIDATIONS], "delete vector for sub rows " + vec2);
                         * if (vec2 != null) {
                         * LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, methodNames[DO_INVALIDATIONS], "delete vector for sub rows " + " with reported size " +
                         * vec2.size());
                         * }
                         * }
                         * if (vec2 != null) {
                         * for (int i2 = 0; i2 < vec2.size(); i2++) {
                         * if (isTraceOn&&LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
                         * LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, methodNames[DO_INVALIDATIONS], "current index in delete sub rows is " + i2);
                         * }
                         * String propid = (String) vec2.elementAt(i2);
                         * subDel = nukerCon.prepareStatement(delProp);
                         * subDel.setString(1, id);
                         * subDel.setString(2, propid);
                         * subDel.setString(3, appName);
                         * if (isTraceOn&&LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
                         * LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, methodNames[DO_INVALIDATIONS], "before deleting subrow " + propid + " for session " +
                         * id);
                         * }
                         *
                         * subDel.executeUpdate();
                         * subDel.close();
                         * subClose = true;
                         * }
                         * }
                         * }
                         *
                         * }
                         */
                        //PK71265 starts
                        subDel = nukerCon.prepareStatement(delPropall);
                        subDel.setString(1, id);
                        subDel.setString(2, appName);

                        int rc1 = subDel.executeUpdate();
                        subDel.close();
                        subClose = true;

                        if (isTraceOn && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
                            LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, methodNames[DO_INVALIDATIONS], "DatabaseHashMap:doInvalidations - for session: " + id +
                                                                                                                            " appName: " + appName + "number of rows deleted: "
                                                                                                                            + rc1);
                        }
                        //PK71265 ends

                    } //if (_smc.isUsingMultirow())
                }// if (rc>0)

                /*
                 * We already did cleanUpCache during the invalidation processing. Therefore, the session is no longer
                 * in our cache, and superRemove should return null. We need to create a temporary Session with an
                 * accurate Id and creationTime to send to the PMI counters.
                 */
                superRemove(id);
                createTime = ((Long) creationTimes.get(id)).longValue();
                //we don't want to retrieve session, so use a fake one for pmi
                if (pmiStatSession == null)
                    pmiStatSession = new DatabaseSession();
                if (pmiStats == null)
                    pmiStats = _iStore.getSessionStatistics();
                pmiStatSession.setId(id);
                pmiStatSession.setCreationTime(createTime);
                if (pmiStats != null) {
                    pmiStats.sessionDestroyed(pmiStatSession);
                    pmiStats.sessionDestroyedByTimeout(pmiStatSession);
                }
                deleteCount++;

            }
        } catch (SQLException se) {
            //            if (isStaleConnectionException(se)) {
            //                com.ibm.ws.ffdc.FFDCFilter.processException(se, "com.ibm.ws.session.store.db.DatabaseHashMap.doInvalidations", "867", this);
            //                if (isTraceOn&&LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
            //                    LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, methodNames[DO_INVALIDATIONS], "StaleConnectionException");
            //                }
            //                throw se;
            //            } else {
            com.ibm.ws.ffdc.FFDCFilter.processException(se, "com.ibm.ws.session.store.db.DatabaseHashMap.doInvalidations", "872", this);
            LoggingUtil.SESSION_LOGGER_WAS.logp(Level.SEVERE, methodClassName, methodNames[DO_INVALIDATIONS], "DatabaseHashMap.doInvalidationsError");
            LoggingUtil.SESSION_LOGGER_WAS.logp(Level.SEVERE, methodClassName, methodNames[DO_INVALIDATIONS], "CommonMessage.sessionid", id);
            LoggingUtil.SESSION_LOGGER_WAS.logp(Level.SEVERE, methodClassName, methodNames[DO_INVALIDATIONS], "CommonMessage.exception", se);
            throw se;
            //            }
        } catch (Exception e) {
            com.ibm.ws.ffdc.FFDCFilter.processException(e, "com.ibm.ws.session.store.db.DatabaseHashMap.doInvalidations", "877", this);
            LoggingUtil.SESSION_LOGGER_WAS.logp(Level.SEVERE, methodClassName, methodNames[DO_INVALIDATIONS], "DatabaseHashMap.doInvalidationsError");
            LoggingUtil.SESSION_LOGGER_WAS.logp(Level.SEVERE, methodClassName, methodNames[DO_INVALIDATIONS], "CommonMessage.exception", e);
        } finally {
            if (!delClose && delNukeStatement != null) {
                closeResultSet(rs);
                closeStatement(delNukeStatement);
            }
            if (!scanClose && scanPropPs != null) {
                closeResultSet(rs2);
                closeStatement(scanPropPs);
            }
            if (!del2Close && delNuke2 != null) {
                closeStatement(delNuke2);
            }
            if (!subClose && subDel != null) {
                closeStatement(subDel);
            }
        }
    }
void doInvalidations ( Connection nukerCon ) throws SQLException { final boolean isTraceOn = com . ibm . websphere . ras . TraceComponent . isAnyTracingEnabled ( ) ; if ( isTraceOn && LoggingUtil . SESSION_LOGGER_WAS . isLoggable ( Level . FINE ) ) { LoggingUtil . SESSION_LOGGER_WAS . entering ( methodClassName , methodNames [ DO_INVALIDATIONS ] ) ; } String id = null ; long lastAccessTime = 0 ; long createTime = 0 ; ResultSet rs = null ; PreparedStatement delNukeStatement = null ; PreparedStatement scanPropPs = null ; PreparedStatement delNuke2 = null ; PreparedStatement subDel = null ; ResultSet rs2 = null ; boolean delClose = false ; boolean scanClose = false ; boolean subClose = false ; boolean del2Close = false ; try { int oldIsolationLevel = 0 ; long now = System . currentTimeMillis ( ) ; String appName = getIStore ( ) . getId ( ) ; String selDelNoListener = this . selDelNoListener ; if ( usingDB2 || usingDerby ) { selDelNoListener = selDelNoListener + " for read only" ; oldIsolationLevel = nukerCon . getTransactionIsolation ( ) ; nukerCon . setTransactionIsolation ( java . sql . Connection . TRANSACTION_READ_UNCOMMITTED ) ; } delNukeStatement = nukerCon . prepareStatement ( selDelNoListener ) ; delNukeStatement . setString ( 1 , appName ) ; setPSLong ( delNukeStatement , 2 , now ) ; if ( isTraceOn && LoggingUtil . SESSION_LOGGER_WAS . isLoggable ( Level . FINE ) ) { LoggingUtil . SESSION_LOGGER_WAS . logp ( Level . FINE , methodClassName , methodNames [ DO_INVALIDATIONS ] , "executing read/uncom scan" ) ; } rs = delNukeStatement . executeQuery ( ) ; if ( isTraceOn && LoggingUtil . SESSION_LOGGER_WAS . isLoggable ( Level . FINE ) ) { LoggingUtil . SESSION_LOGGER_WAS . logp ( Level . FINE , methodClassName , methodNames [ DO_INVALIDATIONS ] , "after uncom query " ) ; } Hashtable primaryRows = new Hashtable ( ) ; Hashtable creationTimes = new Hashtable ( ) ; while ( rs . next ( ) ) { id = rs . getString ( 1 ) ; lastAccessTime = rs . getLong ( 2 ) ; createTime = rs . getLong ( 3 ) ; primaryRows . put ( id , new Long ( lastAccessTime ) ) ; creationTimes . put ( id , new Long ( createTime ) ) ; if ( isTraceOn && LoggingUtil . SESSION_LOGGER_WAS . isLoggable ( Level . FINE ) ) { LoggingUtil . SESSION_LOGGER_WAS . logp ( Level . FINE , methodClassName , methodNames [ DO_INVALIDATIONS ] , "executing read/uncom scan, recording " + id ) ; } if ( ( now + _smc . getInvalidationCheckInterval ( ) * 1000 ) <= System . currentTimeMillis ( ) ) { break ; } } rs . close ( ) ; delNukeStatement . close ( ) ; delClose = true ; if ( usingDB2 ) { nukerCon . setTransactionIsolation ( oldIsolationLevel ) ; } if ( isTraceOn && LoggingUtil . SESSION_LOGGER_WAS . isLoggable ( Level . FINE ) ) { LoggingUtil . SESSION_LOGGER_WAS . logp ( Level . FINE , methodClassName , methodNames [ DO_INVALIDATIONS ] , "delete primary row vector " + primaryRows ) ; if ( primaryRows != null ) { LoggingUtil . SESSION_LOGGER_WAS . logp ( Level . FINE , methodClassName , methodNames [ DO_INVALIDATIONS ] , "with size reported " + primaryRows . size ( ) ) ; } } Enumeration enum1 = primaryRows . keys ( ) ; int deleteCount = 0 ; BackedSession pmiStatSession = null ; SessionStatistics pmiStats = null ; while ( enum1 . hasMoreElements ( ) ) { id = ( String ) enum1 . nextElement ( ) ; if ( isTraceOn && LoggingUtil . SESSION_LOGGER_WAS . isLoggable ( Level . FINE ) ) { LoggingUtil . SESSION_LOGGER_WAS . logp ( Level . FINE , methodClassName , methodNames [ DO_INVALIDATIONS ] , "current index into delete primary row vector " + id ) ; } now = System . currentTimeMillis ( ) ; long lastAccess = ( ( Long ) primaryRows . get ( id ) ) . longValue ( ) ; delNuke2 = nukerCon . prepareStatement ( delPrimaryRowInval ) ; delNuke2 . setString ( 1 , id ) ; delNuke2 . setString ( 2 , appName ) ; setPSLong ( delNuke2 , 3 , lastAccess ) ; if ( isTraceOn && LoggingUtil . SESSION_LOGGER_WAS . isLoggable ( Level . FINE ) ) { LoggingUtil . SESSION_LOGGER_WAS . logp ( Level . FINE , methodClassName , methodNames [ DO_INVALIDATIONS ] , "delete for " + id ) ; } int rc = delNuke2 . executeUpdate ( ) ; if ( isTraceOn && LoggingUtil . SESSION_LOGGER_WAS . isLoggable ( Level . FINE ) ) { LoggingUtil . SESSION_LOGGER_WAS . logp ( Level . FINE , methodClassName , methodNames [ DO_INVALIDATIONS ] , "after del of  " + id ) ; } delNuke2 . close ( ) ; del2Close = true ; if ( isTraceOn && LoggingUtil . SESSION_LOGGER_WAS . isLoggable ( Level . FINE ) ) { LoggingUtil . SESSION_LOGGER_WAS . logp ( Level . FINE , methodClassName , methodNames [ DO_INVALIDATIONS ] , "num of rows deleted " + rc ) ; } if ( rc > 0 ) { if ( _smc . isUsingMultirow ( ) ) { subDel = nukerCon . prepareStatement ( delPropall ) ; subDel . setString ( 1 , id ) ; subDel . setString ( 2 , appName ) ; int rc1 = subDel . executeUpdate ( ) ; subDel . close ( ) ; subClose = true ; if ( isTraceOn && LoggingUtil . SESSION_LOGGER_WAS . isLoggable ( Level . FINE ) ) { LoggingUtil . SESSION_LOGGER_WAS . logp ( Level . FINE , methodClassName , methodNames [ DO_INVALIDATIONS ] , "DatabaseHashMap:doInvalidations - for session: " + id + " appName: " + appName + "number of rows deleted: " + rc1 ) ; } } } superRemove ( id ) ; createTime = ( ( Long ) creationTimes . get ( id ) ) . longValue ( ) ; if ( pmiStatSession == null ) pmiStatSession = new DatabaseSession ( ) ; if ( pmiStats == null ) pmiStats = _iStore . getSessionStatistics ( ) ; pmiStatSession . setId ( id ) ; pmiStatSession . setCreationTime ( createTime ) ; if ( pmiStats != null ) { pmiStats . sessionDestroyed ( pmiStatSession ) ; pmiStats . sessionDestroyedByTimeout ( pmiStatSession ) ; } deleteCount ++ ; } } catch ( SQLException se ) { com . ibm . ws . ffdc . FFDCFilter . processException ( se , "com.ibm.ws.session.store.db.DatabaseHashMap.doInvalidations" , "872" , this ) ; LoggingUtil . SESSION_LOGGER_WAS . logp ( Level . SEVERE , methodClassName , methodNames [ DO_INVALIDATIONS ] , "DatabaseHashMap.doInvalidationsError" ) ; LoggingUtil . SESSION_LOGGER_WAS . logp ( Level . SEVERE , methodClassName , methodNames [ DO_INVALIDATIONS ] , "CommonMessage.sessionid" , id ) ; LoggingUtil . SESSION_LOGGER_WAS . logp ( Level . SEVERE , methodClassName , methodNames [ DO_INVALIDATIONS ] , "CommonMessage.exception" , se ) ; throw se ; } catch ( Exception e ) { com . ibm . ws . ffdc . FFDCFilter . processException ( e , "com.ibm.ws.session.store.db.DatabaseHashMap.doInvalidations" , "877" , this ) ; LoggingUtil . SESSION_LOGGER_WAS . logp ( Level . SEVERE , methodClassName , methodNames [ DO_INVALIDATIONS ] , "DatabaseHashMap.doInvalidationsError" ) ; LoggingUtil . SESSION_LOGGER_WAS . logp ( Level . SEVERE , methodClassName , methodNames [ DO_INVALIDATIONS ] , "CommonMessage.exception" , e ) ; } finally { if ( ! delClose && delNukeStatement != null ) { closeResultSet ( rs ) ; closeStatement ( delNukeStatement ) ; } if ( ! scanClose && scanPropPs != null ) { closeResultSet ( rs2 ) ; closeStatement ( scanPropPs ) ; } if ( ! del2Close && delNuke2 != null ) { closeStatement ( delNuke2 ) ; } if ( ! subClose && subDel != null ) { closeStatement ( subDel ) ; } } }
/*
this method removes timed out sessions that do not require listener processin