@Override protected void shutdownSessions() throws Exception { // Invalidate all sessions to cause unbind events ArrayList<HashedSession> sessions=new ArrayList<HashedSession>(_sessions.values()); int loop=100; while (sessions.size()>0 && loop-->0) { // If we are called from doStop if (isStopping() && _storeDir != null && _storeDir.exists() && _storeDir.canWrite()) { // Then we only save and remove the session from memory- it is not invalidated. for (HashedSession session : sessions) { session.save(false); _sessions.remove(session.getClusterId()); } } else { for (HashedSession session : sessions) session.invalidate(); } // check that no new sessions were created while we were iterating sessions=new ArrayList<HashedSession>(_sessions.values()); } }
@Override protected void shutdownSessions() throws Exception { // Invalidate all sessions to cause unbind events ArrayList<HashedSession> sessions=new ArrayList<HashedSession>(_sessions.values()); int loop=100; while (sessions.size()>0 && loop-->0) { // If we are called from doStop if (isStopping() && _storeDir != null && _storeDir.exists() && _storeDir.canWrite()) { // Then we only save and remove the session from memory- it is not invalidated. for (HashedSession session : sessions) { session.save(false); _sessions.remove(session.getClusterId()); } } else { for (HashedSession session : sessions) session.invalidate(); } // check that no new sessions were created while we were iterating sessions=new ArrayList<HashedSession>(_sessions.values()); } }
public synchronized void save(OutputStream os) throws IOException { DataOutputStream out = new DataOutputStream(os); out.writeUTF(getClusterId()); out.writeUTF(getNodeId()); out.writeLong(getCreationTime()); out.writeLong(getAccessed()); /* Don't write these out, as they don't make sense to store because they * either they cannot be true or their value will be restored in the * Session constructor. */ //out.writeBoolean(_invalid); //out.writeBoolean(_doInvalidate); //out.writeLong(_maxIdleMs); //out.writeBoolean( _newSession); out.writeInt(getRequests()); out.writeInt(getAttributes()); ObjectOutputStream oos = new ObjectOutputStream(out); Enumeration<String> e=getAttributeNames(); while(e.hasMoreElements()) { String key=e.nextElement(); oos.writeUTF(key); oos.writeObject(doGet(key)); } oos.close(); }
public synchronized void save(OutputStream os) throws IOException { DataOutputStream out = new DataOutputStream(os); out.writeUTF(getClusterId()); out.writeUTF(getNodeId()); out.writeLong(getCreationTime()); out.writeLong(getAccessed()); /* Don't write these out, as they don't make sense to store because they * either they cannot be true or their value will be restored in the * Session constructor. */ //out.writeBoolean(_invalid); //out.writeBoolean(_doInvalidate); //out.writeLong(_maxIdleMs); //out.writeBoolean( _newSession); out.writeInt(getRequests()); out.writeInt(getAttributes()); ObjectOutputStream oos = new ObjectOutputStream(out); Enumeration<String> e=getAttributeNames(); while(e.hasMoreElements()) { String key=e.nextElement(); oos.writeUTF(key); oos.writeObject(doGet(key)); } oos.close(); }
public synchronized void save(OutputStream os) throws IOException { DataOutputStream out = new DataOutputStream(os); out.writeUTF(getClusterId()); out.writeUTF(getNodeId()); out.writeLong(getCreationTime()); out.writeLong(getAccessed()); /* Don't write these out, as they don't make sense to store because they * either they cannot be true or their value will be restored in the * Session constructor. */ //out.writeBoolean(_invalid); //out.writeBoolean(_doInvalidate); //out.writeBoolean( _newSession); out.writeInt(getRequests()); out.writeInt(getAttributes()); ObjectOutputStream oos = new ObjectOutputStream(out); Enumeration<String> e=getAttributeNames(); while(e.hasMoreElements()) { String key=e.nextElement(); oos.writeUTF(key); oos.writeObject(doGet(key)); } out.writeInt(getMaxInactiveInterval()); }
public synchronized void save(OutputStream os) throws IOException { DataOutputStream out = new DataOutputStream(os); out.writeUTF(getClusterId()); out.writeUTF(getNodeId()); out.writeLong(getCreationTime()); out.writeLong(getAccessed()); /* Don't write these out, as they don't make sense to store because they * either they cannot be true or their value will be restored in the * Session constructor. */ //out.writeBoolean(_invalid); //out.writeBoolean(_doInvalidate); //out.writeLong(_maxIdleMs); //out.writeBoolean( _newSession); out.writeInt(getRequests()); out.writeInt(getAttributes()); ObjectOutputStream oos = new ObjectOutputStream(out); Enumeration<String> e=getAttributeNames(); while(e.hasMoreElements()) { String key=e.nextElement(); oos.writeUTF(key); oos.writeObject(doGet(key)); } oos.close(); }
public synchronized void save(OutputStream os) throws IOException { DataOutputStream out = new DataOutputStream(os); out.writeUTF(getClusterId()); out.writeUTF(getNodeId()); out.writeLong(getCreationTime()); out.writeLong(getAccessed()); /* Don't write these out, as they don't make sense to store because they * either they cannot be true or their value will be restored in the * Session constructor. */ //out.writeBoolean(_invalid); //out.writeBoolean(_doInvalidate); //out.writeLong(_maxIdleMs); //out.writeBoolean( _newSession); out.writeInt(getRequests()); out.writeInt(getAttributes()); ObjectOutputStream oos = new ObjectOutputStream(out); Enumeration<String> e=getAttributeNames(); while(e.hasMoreElements()) { String key=e.nextElement(); oos.writeUTF(key); oos.writeObject(doGet(key)); } oos.close(); }
public synchronized void save(OutputStream os) throws IOException { DataOutputStream out = new DataOutputStream(os); out.writeUTF(getClusterId()); out.writeUTF(getNodeId()); out.writeLong(getCreationTime()); out.writeLong(getAccessed()); /* Don't write these out, as they don't make sense to store because they * either they cannot be true or their value will be restored in the * Session constructor. */ //out.writeBoolean(_invalid); //out.writeBoolean(_doInvalidate); //out.writeLong(_maxIdleMs); //out.writeBoolean( _newSession); out.writeInt(getRequests()); out.writeInt(getAttributes()); ObjectOutputStream oos = new ObjectOutputStream(out); Enumeration<String> e=getAttributeNames(); while(e.hasMoreElements()) { String key=e.nextElement(); oos.writeUTF(key); oos.writeObject(doGet(key)); } oos.close(); }
public synchronized void save(OutputStream os) throws IOException { DataOutputStream out = new DataOutputStream(os); out.writeUTF(getClusterId()); out.writeUTF(getNodeId()); out.writeLong(getCreationTime()); out.writeLong(getAccessed()); /* Don't write these out, as they don't make sense to store because they * either they cannot be true or their value will be restored in the * Session constructor. */ //out.writeBoolean(_invalid); //out.writeBoolean(_doInvalidate); //out.writeLong(_maxIdleMs); //out.writeBoolean( _newSession); out.writeInt(getRequests()); out.writeInt(getAttributes()); ObjectOutputStream oos = new ObjectOutputStream(out); Enumeration<String> e=getAttributeNames(); while(e.hasMoreElements()) { String key=e.nextElement(); oos.writeUTF(key); oos.writeObject(doGet(key)); } oos.close(); }
public synchronized void save(OutputStream os) throws IOException { DataOutputStream out = new DataOutputStream(os); out.writeUTF(getClusterId()); out.writeUTF(getNodeId()); out.writeLong(getCreationTime()); out.writeLong(getAccessed()); /* Don't write these out, as they don't make sense to store because they * either they cannot be true or their value will be restored in the * Session constructor. */ //out.writeBoolean(_invalid); //out.writeBoolean(_doInvalidate); //out.writeLong(_maxIdleMs); //out.writeBoolean( _newSession); out.writeInt(getRequests()); out.writeInt(getAttributes()); ObjectOutputStream oos = new ObjectOutputStream(out); Enumeration<String> e=getAttributeNames(); while(e.hasMoreElements()) { String key=e.nextElement(); oos.writeUTF(key); oos.writeObject(doGet(key)); } oos.close(); }
public synchronized void save(OutputStream os) throws IOException { DataOutputStream out = new DataOutputStream(os); out.writeUTF(getClusterId()); out.writeUTF(getNodeId()); out.writeLong(getCreationTime()); out.writeLong(getAccessed()); /* Don't write these out, as they don't make sense to store because they * either they cannot be true or their value will be restored in the * Session constructor. */ //out.writeBoolean(_invalid); //out.writeBoolean(_doInvalidate); //out.writeBoolean( _newSession); out.writeInt(getRequests()); out.writeInt(getAttributes()); ObjectOutputStream oos = new ObjectOutputStream(out); Enumeration<String> e=getAttributeNames(); while(e.hasMoreElements()) { String key=e.nextElement(); oos.writeUTF(key); oos.writeObject(doGet(key)); } out.writeInt(getMaxInactiveInterval()); }