[Bug 352133] resolve java 1.5isms with sessions, fix misspelling in
mbean and add access to underlying server in session test server
This commit is contained in:
parent
3919023be5
commit
fde7831a81
|
@ -18,7 +18,6 @@ import javax.servlet.http.HttpSessionBindingListener;
|
|||
import javax.servlet.http.HttpSessionContext;
|
||||
import javax.servlet.http.HttpSessionEvent;
|
||||
|
||||
import org.eclipse.jetty.util.log.Log;
|
||||
import org.eclipse.jetty.util.log.Logger;
|
||||
|
||||
/**
|
||||
|
@ -126,13 +125,13 @@ public abstract class AbstractSession implements AbstractSessionManager.SessionI
|
|||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public Enumeration getAttributeNames()
|
||||
@SuppressWarnings({ "unchecked" })
|
||||
public Enumeration<String> getAttributeNames()
|
||||
{
|
||||
synchronized (this)
|
||||
{
|
||||
checkValid();
|
||||
List names=_attributes==null?Collections.EMPTY_LIST:new ArrayList(_attributes.keySet());
|
||||
List<String> names=_attributes==null?Collections.EMPTY_LIST:new ArrayList<String>(_attributes.keySet());
|
||||
return Collections.enumeration(names);
|
||||
}
|
||||
}
|
||||
|
@ -491,7 +490,7 @@ public abstract class AbstractSession implements AbstractSessionManager.SessionI
|
|||
synchronized(this)
|
||||
{
|
||||
HttpSessionEvent event = new HttpSessionEvent(this);
|
||||
for (Iterator iter = _attributes.values().iterator(); iter.hasNext();)
|
||||
for (Iterator<Object> iter = _attributes.values().iterator(); iter.hasNext();)
|
||||
{
|
||||
Object value = iter.next();
|
||||
if (value instanceof HttpSessionActivationListener)
|
||||
|
@ -509,7 +508,7 @@ public abstract class AbstractSession implements AbstractSessionManager.SessionI
|
|||
synchronized(this)
|
||||
{
|
||||
HttpSessionEvent event = new HttpSessionEvent(this);
|
||||
for (Iterator iter = _attributes.values().iterator(); iter.hasNext();)
|
||||
for (Iterator<Object> iter = _attributes.values().iterator(); iter.hasNext();)
|
||||
{
|
||||
Object value = iter.next();
|
||||
if (value instanceof HttpSessionActivationListener)
|
||||
|
|
|
@ -15,23 +15,17 @@ package org.eclipse.jetty.server.session;
|
|||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.eclipse.jetty.server.SessionIdManager;
|
||||
import org.eclipse.jetty.util.MultiMap;
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
|
|
|
@ -20,7 +20,6 @@ import java.io.IOException;
|
|||
import java.io.InputStream;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Timer;
|
||||
|
@ -32,7 +31,6 @@ import javax.servlet.ServletContext;
|
|||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.eclipse.jetty.server.handler.ContextHandler;
|
||||
import org.eclipse.jetty.util.log.Log;
|
||||
import org.eclipse.jetty.util.log.Logger;
|
||||
|
||||
|
||||
|
@ -513,7 +511,7 @@ public class HashSessionManager extends AbstractSessionManager
|
|||
*/
|
||||
DataInputStream in = new DataInputStream(is);
|
||||
String clusterId = in.readUTF();
|
||||
String nodeId = in.readUTF();
|
||||
in.readUTF(); // nodeId
|
||||
long created = in.readLong();
|
||||
long accessed = in.readLong();
|
||||
int requests = in.readInt();
|
||||
|
|
|
@ -9,7 +9,6 @@ import java.io.IOException;
|
|||
import java.io.ObjectOutputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
|
|
|
@ -39,7 +39,6 @@ import org.eclipse.jetty.server.Handler;
|
|||
import org.eclipse.jetty.server.Server;
|
||||
import org.eclipse.jetty.server.SessionManager;
|
||||
import org.eclipse.jetty.server.handler.ContextHandler;
|
||||
import org.eclipse.jetty.util.log.Log;
|
||||
import org.eclipse.jetty.util.log.Logger;
|
||||
|
||||
|
||||
|
@ -650,7 +649,7 @@ public class JDBCSessionIdManager extends AbstractSessionIdManager
|
|||
private void scavenge ()
|
||||
{
|
||||
Connection connection = null;
|
||||
List expiredSessionIds = new ArrayList();
|
||||
List<String> expiredSessionIds = new ArrayList<String>();
|
||||
try
|
||||
{
|
||||
if (__log.isDebugEnabled()) __log.debug("Scavenge sweep started at "+System.currentTimeMillis());
|
||||
|
|
|
@ -24,7 +24,6 @@ import java.sql.Connection;
|
|||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.ListIterator;
|
||||
|
@ -38,7 +37,6 @@ import javax.servlet.http.HttpSessionListener;
|
|||
|
||||
import org.eclipse.jetty.server.SessionIdManager;
|
||||
import org.eclipse.jetty.server.handler.ContextHandler;
|
||||
import org.eclipse.jetty.util.LazyList;
|
||||
import org.eclipse.jetty.util.log.Log;
|
||||
|
||||
/**
|
||||
|
@ -75,7 +73,7 @@ public class JDBCSessionManager extends AbstractSessionManager
|
|||
protected String __updateSessionAccessTime;
|
||||
protected String __sessionTableRowId;
|
||||
|
||||
private ConcurrentHashMap _sessions;
|
||||
private ConcurrentHashMap<String, AbstractSession> _sessions;
|
||||
protected long _saveIntervalSec = 60; //only persist changes to session access times every 60 secs
|
||||
|
||||
/**
|
||||
|
@ -400,7 +398,7 @@ public class JDBCSessionManager extends AbstractSessionManager
|
|||
}
|
||||
|
||||
@Override
|
||||
public Class resolveClass (java.io.ObjectStreamClass cl) throws IOException, ClassNotFoundException
|
||||
public Class<?> resolveClass (java.io.ObjectStreamClass cl) throws IOException, ClassNotFoundException
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -603,7 +601,7 @@ public class JDBCSessionManager extends AbstractSessionManager
|
|||
|
||||
prepareTables();
|
||||
|
||||
_sessions = new ConcurrentHashMap();
|
||||
_sessions = new ConcurrentHashMap<String, AbstractSession>();
|
||||
super.doStart();
|
||||
}
|
||||
|
||||
|
@ -771,7 +769,7 @@ public class JDBCSessionManager extends AbstractSessionManager
|
|||
*
|
||||
* @param sessionIds
|
||||
*/
|
||||
protected void expire (List sessionIds)
|
||||
protected void expire (List<?> sessionIds)
|
||||
{
|
||||
//don't attempt to scavenge if we are shutting down
|
||||
if (isStopping() || isStopped())
|
||||
|
@ -780,7 +778,7 @@ public class JDBCSessionManager extends AbstractSessionManager
|
|||
//Remove any sessions we already have in memory that match the ids
|
||||
Thread thread=Thread.currentThread();
|
||||
ClassLoader old_loader=thread.getContextClassLoader();
|
||||
ListIterator itor = sessionIds.listIterator();
|
||||
ListIterator<?> itor = sessionIds.listIterator();
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -852,6 +850,7 @@ public class JDBCSessionManager extends AbstractSessionManager
|
|||
final AtomicReference<Exception> _exception = new AtomicReference<Exception>();
|
||||
Runnable load = new Runnable()
|
||||
{
|
||||
@SuppressWarnings("unchecked")
|
||||
public void run()
|
||||
{
|
||||
SessionData data = null;
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
|
||||
package org.eclipse.jetty.server.session.jmx;
|
||||
|
||||
import org.eclipse.jetty.jmx.ObjectMBean;
|
||||
import org.eclipse.jetty.server.handler.AbstractHandlerContainer;
|
||||
import org.eclipse.jetty.server.handler.ContextHandler;
|
||||
import org.eclipse.jetty.server.handler.jmx.AbstractHandlerMBean;
|
||||
|
|
|
@ -2,7 +2,7 @@ AbstractSessionManager: Abstract Session Manager
|
|||
httpOnly: True if cookies use the http only flag
|
||||
idManager: MObject:RO:The ID Manager instance
|
||||
maxCookieAge: if greater than zero, the time in seconds a session cookie will last for
|
||||
maxInactiveInterval: default maximim time in seconds a session may be idle
|
||||
maxInactiveInterval: default maximum time in seconds a session may be idle
|
||||
refreshCookieAge: The time in seconds after which a session cookie is re-set
|
||||
secureCookies: If true, the secure cookie flag is set on session cookies
|
||||
sessionCookie: The set session cookie
|
||||
|
|
|
@ -105,4 +105,9 @@ public abstract class AbstractTestServer
|
|||
|
||||
return context;
|
||||
}
|
||||
|
||||
public Server getServer()
|
||||
{
|
||||
return _server;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue