Package org.apache.catalina.session

Examples of org.apache.catalina.session.StandardSession$PrivilegedSetTccl


            return ids;
        }
    }

    public Session load(String id) throws ClassNotFoundException, IOException {
        StandardSession _session = null;
        GenericValue sessionValue = null;
        try {
            sessionValue = delegator.findOne(entityName, false, "sessionId", id);
        } catch (GenericEntityException e) {
            throw new IOException(e.getMessage());
        }

        if (sessionValue != null) {
            byte[] bytes = sessionValue.getBytes("sessionInfo");
            if (bytes != null) {
                BufferedInputStream bis = new BufferedInputStream(new ByteArrayInputStream(bytes));

                Container container = manager.getContainer();
                ClassLoader classLoader = null;
                Loader loader = null;

                if (container != null) {
                    loader = container.getLoader();
                }
                if (loader != null) {
                    classLoader = loader.getClassLoader();
                }

                ObjectInputStream ois = null;
                if (classLoader != null) {
                    ois = new CustomObjectInputStream(bis, classLoader);
                } else {
                    ois = new ObjectInputStream(bis);
                }

                //Debug.logInfo("Loading Session Store [" + id + "]", module);
                _session = (StandardSession) manager.createEmptySession();
                _session.readObjectData(ois);
                _session.setManager(manager);
            }
        }

        return _session;
    }
View Full Code Here


            return ids;
        }
    }

    public Session load(String id) throws ClassNotFoundException, IOException {
        StandardSession _session = null;
        GenericValue sessionValue = null;
        try {
            sessionValue = delegator.findOne(entityName, false, "sessionId", id);
        } catch (GenericEntityException e) {
            throw new IOException(e.getMessage());
        }

        if (sessionValue != null) {
            byte[] bytes = sessionValue.getBytes("sessionInfo");
            if (bytes != null) {
                BufferedInputStream bis = new BufferedInputStream(new ByteArrayInputStream(bytes));

                Container container = manager.getContainer();
                ClassLoader classLoader = null;
                Loader loader = null;

                if (container != null) {
                    loader = container.getLoader();
                }
                if (loader != null) {
                    classLoader = loader.getClassLoader();
                }

                ObjectInputStream ois = null;
                if (classLoader != null) {
                    ois = new CustomObjectInputStream(bis, classLoader);
                } else {
                    ois = new ObjectInputStream(bis);
                }

                //Debug.logInfo("Loading Session Store [" + id + "]", module);
                _session = (StandardSession) manager.createEmptySession();
                _session.readObjectData(ois);
                _session.setManager(manager);
            }
        }

        return _session;
    }
View Full Code Here

        Session sess = this.getSession(request, true);
        if(_logger.isLoggable(Level.FINEST)) {
            _logger.finest("IN LOCK_SESSION: sess =" + sess);
        }
        if(sess != null) {
            StandardSession haSess = (StandardSession) sess;
            haSess.lockForegroundWithRetry();
            if(_logger.isLoggable(Level.FINEST)) {
                _logger.finest("finished locking session: sess =" + haSess);
                _logger.finest("LOCK = " + haSess.getSessionLock());
            }
        }
        return sess;
    }       
View Full Code Here

        }

        Session sessions[] = findSessions();

        for (int i = 0; i < sessions.length; i++) {
            StandardSession session = (StandardSession) sessions[i];
            if(session.getIsValid()
                    && (session.getIdInternal() != null)
                    && !session.hasExpired()
                    && isSessionOlderThan(session, repairStartTime)) {
                if(session.lockBackground()) {
                    try {
                        ((HASession)session).setPersistent(false);
                        ((HASession)session).setDirty(true, false);
                        doValveSave(session);
                    } finally {
                        session.unlockBackground();
                    }
                }                               
      }           
        }
    }       
View Full Code Here

        Session sessions[] = findSessions();
        if(_logger.isLoggable(Level.FINE)) {
            _logger.fine("ReplicationManagerBase>>repair sessions size = " + sessions.length);
        }        
        for (int i = 0; i < sessions.length; i++) {
            StandardSession session = (StandardSession) sessions[i];
            boolean condition = true;
            if(checkForStopping) {
                condition = (session.getIsValid()
                    && (session.getIdInternal() != null)
                    && !session.hasExpired()
                    && isSessionOlderThan(session, repairStartTime));
            } else {
                //during flush ignore age check
                condition = (session.getIsValid()
                    && (session.getIdInternal() != null)
                    && !session.hasExpired() );               
            }
            if(condition) {         
                if(session.lockBackground()) {
                    try {
                        ((HASession)session).setPersistent(false);
                        ((HASession)session).setDirty(true, false);
                        doValveSave(session);
                    } catch(Throwable t) {
                        // FIXME evaluate log level
                        if (_logger.isLoggable(Level.FINE)) {
                            _logger.log(Level.FINE, "Throwable occurred during force flush", t);
                        }
                        break;
                    } finally {
                        session.unlockBackground();
                    }
                }                               
      }           
        }
    }
View Full Code Here

            boolean keepTrying = true;
            boolean lockResult = false;
            if(_logger.isLoggable(Level.FINEST)) {
                _logger.finest("locking session: sess =" + sess);
            }
            StandardSession haSess = (StandardSession) sess;
            //try to lock up to maxNumberOfRetries times
            //poll and wait starting with 200 ms
            while(keepTrying) {
                lockResult = haSess.lockForeground();
                if(lockResult) {
                    keepTrying = false;
                    break;
                }
                tryNumber++;
                if(tryNumber < maxNumberOfRetries) {
                    pollTime = pollTime * 2L;
                    threadSleep(pollTime);
                } else {
                    //tried to wait and lock maxNumberOfRetries times; throw an exception
                    //throw new ServletException("unable to acquire session lock");
                    //instead of above; unlock the background so we can take over
                    _logger.warning("this should not happen-breaking background lock: sess =" + sess);
                    haSess.unlockBackground();
                }             
            }
            if(_logger.isLoggable(Level.FINEST)) {
                _logger.finest("finished locking session: sess =" + sess);
                _logger.finest("LOCK = " + haSess.getSessionLock());
            }
        }

        return sess;
    }   
View Full Code Here

        //now unlock the session
        if(sess != null) {
            if(_logger.isLoggable(Level.FINEST)) {
                _logger.finest("unlocking session: sess =" + sess);
            }
            StandardSession haSess = (StandardSession) sess;
            haSess.unlockForeground();
            if(_logger.isLoggable(Level.FINEST)) {
                _logger.finest("finished unlocking session: sess =" + sess);
                _logger.finest("LOCK = " + haSess.getSessionLock());
            }
        }       
    }    
View Full Code Here

            long pollTime = 200L;
            int maxNumberOfRetries = 7;
            int tryNumber = 0;
            boolean keepTrying = true;
            boolean lockResult = false;
            StandardSession stdSess = (StandardSession) sess;
            //try to lock up to maxNumberOfRetries times
            //poll and wait starting with 200 ms
            while(keepTrying) {
                lockResult = stdSess.lockForeground();
                if(lockResult) {
                    keepTrying = false;
                    result = true;
                    break;
                }
                tryNumber++;
                if(tryNumber < maxNumberOfRetries) {
                    pollTime = pollTime * 2L;
                    threadSleep(pollTime);
                } else {
                    //tried to wait and lock maxNumberOfRetries times; throw an exception
                    //throw new ServletException("unable to acquire session lock");
                    //instead of above; unlock the background so we can take over
                    stdSess.unlockBackground();
                }             
            }
        }
        return result;
    }
View Full Code Here

     */    
    public void unlockSession(ServletRequest request) {
        Session sess = this.getSession(request);
        //now unlock the session
        if(sess != null) {
            StandardSession stdSess = (StandardSession) sess;
            stdSess.unlockForeground();
        }       
    }   
View Full Code Here

            return ids;
        }
    }

    public Session load(String id) throws ClassNotFoundException, IOException {
        StandardSession _session = null;
        GenericValue sessionValue = null;
        try {
            sessionValue = delegator.findOne(entityName, false, "sessionId", id);
        } catch (GenericEntityException e) {
            throw new IOException(e.getMessage());
        }

        if (sessionValue != null) {
            byte[] bytes = sessionValue.getBytes("sessionInfo");
            if (bytes != null) {
                BufferedInputStream bis = new BufferedInputStream(new ByteArrayInputStream(bytes));

                Container container = manager.getContainer();
                ClassLoader classLoader = null;
                Loader loader = null;

                if (container != null) {
                    loader = container.getLoader();
                }
                if (loader != null) {
                    classLoader = loader.getClassLoader();
                }

                ObjectInputStream ois = null;
                if (classLoader != null) {
                    ois = new CustomObjectInputStream(bis, classLoader);
                } else {
                    ois = new ObjectInputStream(bis);
                }

                //Debug.logInfo("Loading Session Store [" + id + "]", module);
                _session = (StandardSession) manager.createEmptySession();
                _session.readObjectData(ois);
                _session.setManager(manager);
            }
        }

        return _session;
    }
View Full Code Here

TOP

Related Classes of org.apache.catalina.session.StandardSession$PrivilegedSetTccl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.