Merge remote-tracking branch 'origin/jetty-9.4.x'
This commit is contained in:
commit
2793812fcb
|
@ -23,6 +23,7 @@ import java.io.IOException;
|
||||||
import org.eclipse.jetty.server.session.SessionContext;
|
import org.eclipse.jetty.server.session.SessionContext;
|
||||||
import org.eclipse.jetty.server.session.SessionData;
|
import org.eclipse.jetty.server.session.SessionData;
|
||||||
import org.eclipse.jetty.server.session.SessionDataMap;
|
import org.eclipse.jetty.server.session.SessionDataMap;
|
||||||
|
import org.eclipse.jetty.util.component.AbstractLifeCycle;
|
||||||
|
|
||||||
import net.rubyeye.xmemcached.MemcachedClient;
|
import net.rubyeye.xmemcached.MemcachedClient;
|
||||||
import net.rubyeye.xmemcached.XMemcachedClientBuilder;
|
import net.rubyeye.xmemcached.XMemcachedClientBuilder;
|
||||||
|
@ -34,7 +35,7 @@ import net.rubyeye.xmemcached.XMemcachedClientBuilder;
|
||||||
*
|
*
|
||||||
* Uses memcached as a cache for SessionData.
|
* Uses memcached as a cache for SessionData.
|
||||||
*/
|
*/
|
||||||
public class MemcachedSessionDataMap implements SessionDataMap
|
public class MemcachedSessionDataMap extends AbstractLifeCycle implements SessionDataMap
|
||||||
{
|
{
|
||||||
public static final String DEFAULT_HOST = "localhost";
|
public static final String DEFAULT_HOST = "localhost";
|
||||||
public static final String DEFAULT_PORT = "11211";
|
public static final String DEFAULT_PORT = "11211";
|
||||||
|
@ -125,4 +126,19 @@ public class MemcachedSessionDataMap implements SessionDataMap
|
||||||
_client.delete(id);
|
_client.delete(id);
|
||||||
return true; //delete returns false if the value didn't exist
|
return true; //delete returns false if the value didn't exist
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void doStop() throws Exception
|
||||||
|
{
|
||||||
|
super.doStop();
|
||||||
|
if (_client != null)
|
||||||
|
{
|
||||||
|
_client.shutdown();
|
||||||
|
_client = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,12 +18,14 @@
|
||||||
|
|
||||||
package org.eclipse.jetty.server.session;
|
package org.eclipse.jetty.server.session;
|
||||||
|
|
||||||
|
import org.eclipse.jetty.util.component.LifeCycle;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SessionDataMap
|
* SessionDataMap
|
||||||
*
|
*
|
||||||
* A map style access to SessionData keyed by the session id.
|
* A map style access to SessionData keyed by the session id.
|
||||||
*/
|
*/
|
||||||
public interface SessionDataMap
|
public interface SessionDataMap extends LifeCycle
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Initialize this data map for the
|
* Initialize this data map for the
|
||||||
|
|
|
@ -29,7 +29,7 @@ import org.eclipse.jetty.util.component.LifeCycle;
|
||||||
* A store for the data contained in a Session object. The store
|
* A store for the data contained in a Session object. The store
|
||||||
* would usually be persistent.
|
* would usually be persistent.
|
||||||
*/
|
*/
|
||||||
public interface SessionDataStore extends SessionDataMap, LifeCycle
|
public interface SessionDataStore extends SessionDataMap
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -132,6 +132,14 @@ public class MemcachedTestServer extends AbstractTestServer
|
||||||
|
|
||||||
return expiredIds;
|
return expiredIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void doStop() throws Exception
|
||||||
|
{
|
||||||
|
super.doStop();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue