Refine search
@Override public void recycle() { super.recycle(); map = null; }
public void superSetAttribute(String name, Object value, boolean notify) { super.setAttribute(name, value, notify); }
@Override public Object getAttribute(String name) { if (readMode == ReadMode.REDIS) { if (!isValidInternal()) { throw new IllegalStateException(sm.getString("standardSession.getAttribute.ise")); } if (name == null) { return null; } return map.get(name); } return super.getAttribute(name); }
Context context = getManager().getContext(); Log contextLog = context.getLogger(); if (contextLog.isDebugEnabled()) { contextLog.debug(sm.getString(getStoreName()+".loading", id, file.getAbsolutePath())); ClassLoader oldThreadContextCL = context.bind(Globals.IS_SECURITY_ENABLED, null); StandardSession session = (StandardSession) manager.createEmptySession(); session.readObjectData(ois); session.setManager(manager); return session; } catch (FileNotFoundException e) { if (contextLog.isDebugEnabled()) { contextLog.debug("No persisted data file found"); context.unbind(Globals.IS_SECURITY_ENABLED, oldThreadContextCL);
/** * Save the specified Session into this Store. Any previously saved * information for the associated session identifier is replaced. * * @param session Session to be saved * * @exception IOException if an input/output error occurs */ @Override public void save(Session session) throws IOException { // Open an output stream to the specified pathname, if any File file = file(session.getIdInternal()); if (file == null) { return; } if (manager.getContext().getLogger().isDebugEnabled()) { manager.getContext().getLogger().debug(sm.getString(getStoreName() + ".saving", session.getIdInternal(), file.getAbsolutePath())); } try (FileOutputStream fos = new FileOutputStream(file.getAbsolutePath()); ObjectOutputStream oos = new ObjectOutputStream(new BufferedOutputStream(fos))) { ((StandardSession)session).writeObjectData(oos); } }
return; if (manager.getContainer().getLogger().isDebugEnabled()) { manager.getContainer().getLogger().debug(sm.getString(getStoreName()+".saving", session.getIdInternal(), file.getAbsolutePath())); ((StandardSession)session).writeObjectData(oos); } finally { oos.close();
File store = sessionStore(context.getPath()); if (store == null) { getLogger().debug("No session store file found"); return; if (getLogger().isDebugEnabled()) { getLogger().debug("Loading sessions from " + store.getAbsolutePath()); bis = new BufferedInputStream(fis); if (getTheContext() != null) { loader = getTheContext().getLoader(); session.readObjectData(ois); session.setManager(this); DeltaSessionInterface existingSession = (DeltaSessionInterface) region.get(session.getId()); && existingSession.getLastAccessedTime() > session.getLastAccessedTime()) { if (getLogger().isDebugEnabled()) { getLogger().debug("Loaded session " + session.getId() + " is older than cached copy"); if (!session.isValid()) { if (getLogger().isDebugEnabled()) { getLogger().debug("Loaded session " + session.getId() + " is invalid"); getLogger().debug("Loading session " + session.getId()); session.activate(); add(session);
stream.writeObject(Long.valueOf(thisAccessedTime)); stream.writeObject(id); if (manager.getContext().getLogger().isDebugEnabled()) manager.getContext().getLogger().debug ("writeObject() storing session " + id); String keys[] = keys(); List<String> saveNames = new ArrayList<>(); List<Object> saveValues = new ArrayList<>(); if (value == null) { continue; } else if (isAttributeDistributable(keys[i], value) && !exclude(keys[i], value)) { saveNames.add(keys[i]); saveValues.add(value); } else { removeAttributeInternal(keys[i], true); try { stream.writeObject(saveValues.get(i)); if (manager.getContext().getLogger().isDebugEnabled()) manager.getContext().getLogger().debug( " storing attribute '" + saveNames.get(i) + "' with value '" + saveValues.get(i) + "'"); } catch (NotSerializableException e) { manager.getContext().getLogger().warn( sm.getString("standardSession.notSerializable", saveNames.get(i), id), e);
+ " as s where s.contextName = '" + context.getPath() + "'"); getLogger().debug("Query: " + query.getQueryString()); results = (SelectResults) query.execute(); } catch (Exception ex) { getLogger().error("Unable to perform query during doUnload", ex); return; getLogger().debug("No sessions to unload for context " + context.getPath()); return; // nothing to do File store = sessionStore(context.getPath()); if (store == null) { return; if (session instanceof StandardSession) { StandardSession standardSession = (StandardSession) session; standardSession.passivate(); standardSession.writeObjectData(oos); } else {
stream.writeObject(Long.valueOf(thisAccessedTime)); stream.writeObject(id); if (manager.getContainer().getLogger().isDebugEnabled()) manager.getContainer().getLogger().debug ("writeObject() storing session " + id); String keys[] = keys(); ArrayList<String> saveNames = new ArrayList<String>(); ArrayList<Object> saveValues = new ArrayList<Object>(); continue; else if ( (value instanceof Serializable) && (!exclude(keys[i]) )) { saveNames.add(keys[i]); saveValues.add(value); } else { removeAttributeInternal(keys[i], true); try { stream.writeObject(saveValues.get(i)); if (manager.getContainer().getLogger().isDebugEnabled()) manager.getContainer().getLogger().debug (" storing attribute '" + saveNames.get(i) +
@Override public void setPrincipal(Principal principal) { super.setPrincipal(principal); // Put the session into the region to serialize the principal if (getManager() != null) { // TODO convert this to a delta getManager().add(this); DeltaSessionManager mgr = (DeltaSessionManager) getManager(); if (mgr.getLogger().isDebugEnabled()) { mgr.getLogger().debug(this + ": Cached principal: " + principal); // mgr.logCurrentStack(); } } }
@Override public void processExpired() { DeltaSessionManager manager = (DeltaSessionManager) getManager(); if (manager != null && manager.getLogger() != null && manager.getLogger().isDebugEnabled()) { ((DeltaSessionManager) getManager()).getLogger().debug(this + ": Expired"); } // Set expired (so region.destroy is not called again) setExpired(true); // Do expire processing super.expire(true); // Update statistics if (manager != null) { manager.getStatistics().incSessionsExpired(); } }
public void expire(boolean notify, boolean notifyCluster) { if (expiring) return; String expiredId = getIdInternal(); if(notifyCluster && expiredId != null && manager != null && manager instanceof DeltaManager) { DeltaManager dmanager = (DeltaManager)manager; CatalinaCluster cluster = dmanager.getCluster(); ClusterMessage msg = dmanager.requestCompleted(expiredId, true); if (msg != null) { cluster.send(msg); } } super.expire(notify); if (notifyCluster) { if (log.isDebugEnabled()) log.debug(sm.getString("deltaSession.notifying", ((ClusterManager)manager).getName(), Boolean.valueOf(isPrimarySession()), expiredId)); if ( manager instanceof DeltaManager ) { ( (DeltaManager) manager).sessionExpired(expiredId); } } }
/** * Invalidates this session and unbinds any objects bound to it. * * @exception IllegalStateException if this method is called on * an invalidated session */ @Override public void invalidate() { if (!isValidInternal()) throw new IllegalStateException (sm.getString("standardSession.invalidate.ise")); // Cause this session to expire expire(); }
keys = keys(); } catch (IOException e) { manager.getContainer().getLogger().error("Error getting keys", e); return; if (manager.getContainer().getLogger().isDebugEnabled()) { manager.getContainer().getLogger().debug(getStoreName()+ ": processExpires check number of " + keys.length + " sessions" ); continue; if (session.isValid()) { continue; session.recycle(); } else { session.expire(); remove(session.getIdInternal()); } catch (Exception e) { manager.getContainer().getLogger().error("Session: "+keys[i]+"; ", e);
@Override public Object getAttribute(String name) { checkBackingCacheAvailable(); Object value = super.getAttribute(name); // If the attribute is a byte[] (meaning it came from the server), // deserialize it and add it to attributes map before returning it. if (value instanceof byte[]) { try { value = BlobHelper.deserializeBlob((byte[]) value); } catch (Exception e) { StringBuilder builder = new StringBuilder(); builder.append(this).append(": Attribute named ").append(name).append( " contains a byte[] that cannot be deserialized due to the following exception"); ((DeltaSessionManager) getManager()).getLogger().warn(builder.toString(), e); } if (this.preferDeserializedForm) { localUpdateAttribute(name, value); } } // Touch the session region if necessary. This is an asynchronous operation // that prevents the session region from prematurely expiring a session that // is only getting attributes. ((DeltaSessionManager) getManager()).addSessionToTouch(getId()); return value; }
return; if (manager.getContainer().getLogger().isDebugEnabled()) { manager.getContainer().getLogger().debug (MESSAGES.fileStoreSessionSave(session.getIdInternal(), file.getAbsolutePath())); ((StandardSession)session).writeObjectData(oos); } finally { oos.close();
Context context = this.manager.getContext(); ClassLoader oldThreadContextCL = context.bind(Globals.IS_SECURITY_ENABLED, null); StandardSession standardSession = (StandardSession) this.manager.createEmptySession(); standardSession.readObjectData(in); context.unbind(Globals.IS_SECURITY_ENABLED, oldThreadContextCL);
public void superRemoveAttributeInternal(String name, boolean notify) { super.removeAttributeInternal(name, notify); }