Move newSessionData method to AbstractSessionDataStore. Organize imports.

This commit is contained in:
Jan Bartel 2015-11-12 15:50:09 +11:00
parent b1113940e6
commit 98558faffd
5 changed files with 14 additions and 39 deletions

View File

@ -82,4 +82,15 @@ public abstract class AbstractSessionDataStore extends AbstractLifeCycle impleme
data.setDirty(false);
}
}
/**
* @see org.eclipse.jetty.server.session.SessionDataStore#newSessionData(org.eclipse.jetty.server.session.SessionKey, long, long, long, long)
*/
@Override
public SessionData newSessionData(SessionKey key, long created, long accessed, long lastAccessed, long maxInactiveMs)
{
return new SessionData(key.getId(), key.getCanonicalContextPath(), key.getVhost(), created, accessed, lastAccessed, maxInactiveMs);
}
}

View File

@ -27,12 +27,12 @@ import javax.servlet.http.HttpServletRequest;
import org.eclipse.jetty.util.component.AbstractLifeCycle;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.util.statistic.CounterStatistic;
/**
* AbstractSessionStore
*
*
* Basic behaviour for maintaining an in-memory store of Session objects and
* making sure that any backing SessionDataStore is kept in sync.
*/
public abstract class AbstractSessionStore extends AbstractLifeCycle implements SessionStore
{

View File

@ -86,15 +86,7 @@ public class FileSessionDataStore extends AbstractSessionDataStore
_deleteUnrestorableFiles = deleteUnrestorableFiles;
}
/**
* @see org.eclipse.jetty.server.session.SessionDataStore#newSessionData(org.eclipse.jetty.server.session.SessionKey, long, long, long, long)
*/
@Override
public SessionData newSessionData(SessionKey key, long created, long accessed, long lastAccessed, long maxInactiveMs)
{
return new SessionData(key.getId(), key.getCanonicalContextPath(), key.getVhost(),created,accessed,lastAccessed,maxInactiveMs);
}
/**
* @see org.eclipse.jetty.server.session.SessionDataStore#delete(org.eclipse.jetty.server.session.SessionKey)
*/

View File

@ -30,10 +30,7 @@ import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
@ -587,15 +584,6 @@ public class JDBCSessionDataStore extends AbstractSessionDataStore
/**
* @see org.eclipse.jetty.server.session.SessionDataStore#newSessionData(org.eclipse.jetty.server.session.SessionKey, long, long, long, long)
*/
@Override
public SessionData newSessionData(SessionKey key, long created, long accessed, long lastAccessed, long maxInactiveMs)
{
return new SessionData(key.getId(), key.getCanonicalContextPath(), key.getVhost(), created, accessed, lastAccessed, maxInactiveMs);
}
@Override

View File

@ -18,36 +18,20 @@
package org.eclipse.jetty.server.session;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.sql.Blob;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.Driver;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.HashSet;
import java.util.Locale;
import java.util.Random;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import javax.naming.InitialContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import javax.sql.DataSource;
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;
import org.eclipse.jetty.util.thread.ScheduledExecutorScheduler;
import org.eclipse.jetty.util.thread.Scheduler;