Class MemcachedSessionDataMap

java.lang.Object
org.eclipse.jetty.util.component.AbstractLifeCycle
org.eclipse.jetty.memcached.session.MemcachedSessionDataMap
All Implemented Interfaces:
org.eclipse.jetty.server.session.SessionDataMap, org.eclipse.jetty.util.component.LifeCycle

@ManagedObject public class MemcachedSessionDataMap extends org.eclipse.jetty.util.component.AbstractLifeCycle implements org.eclipse.jetty.server.session.SessionDataMap
MemcachedSessionDataMap Uses memcached as a cache for SessionData.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    SessionDataTranscoder We override memcached deserialization to use our classloader-aware ObjectInputStream.

    Nested classes/interfaces inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle

    org.eclipse.jetty.util.component.AbstractLifeCycle.AbstractLifeCycleListener, org.eclipse.jetty.util.component.AbstractLifeCycle.StopException

    Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle

    org.eclipse.jetty.util.component.LifeCycle.Listener
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected net.rubyeye.xmemcached.XMemcachedClientBuilder
     
    protected net.rubyeye.xmemcached.MemcachedClient
     
    protected org.eclipse.jetty.server.session.SessionContext
     
    protected int
     
    protected boolean
     
    static final String
     
    static final String
     

    Fields inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle

    FAILED, STARTED, STARTING, STOPPED, STOPPING
  • Constructor Summary

    Constructors
    Constructor
    Description
     
     
    MemcachedSessionDataMap(List<InetSocketAddress> addresses, int[] weights)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     
    protected void
     
    net.rubyeye.xmemcached.XMemcachedClientBuilder
     
    int
    Expiry time for memached entries.
    void
    initialize(org.eclipse.jetty.server.session.SessionContext context)
     
    boolean
     
    org.eclipse.jetty.server.session.SessionData
     
    void
    setExpirySec(int sec)
     
    void
    setHeartbeats(boolean heartbeats)
     
    void
    store(String id, org.eclipse.jetty.server.session.SessionData data)
     

    Methods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle

    addEventListener, doStart, getEventListeners, getState, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeEventListener, setEventListeners, start, stop, toString

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.eclipse.jetty.util.component.LifeCycle

    addEventListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeEventListener, start, stop
  • Field Details

    • DEFAULT_HOST

      public static final String DEFAULT_HOST
      See Also:
    • DEFAULT_PORT

      public static final String DEFAULT_PORT
      See Also:
    • _client

      protected net.rubyeye.xmemcached.MemcachedClient _client
    • _expirySec

      protected int _expirySec
    • _heartbeats

      protected boolean _heartbeats
    • _builder

      protected net.rubyeye.xmemcached.XMemcachedClientBuilder _builder
    • _context

      protected org.eclipse.jetty.server.session.SessionContext _context
  • Constructor Details

    • MemcachedSessionDataMap

      public MemcachedSessionDataMap(String host, String port)
      Parameters:
      host - address of memcache server
      port - address of memcache server
    • MemcachedSessionDataMap

      public MemcachedSessionDataMap(List<InetSocketAddress> addresses)
    • MemcachedSessionDataMap

      public MemcachedSessionDataMap(List<InetSocketAddress> addresses, int[] weights)
  • Method Details

    • getBuilder

      public net.rubyeye.xmemcached.XMemcachedClientBuilder getBuilder()
      Returns:
      the builder
    • setExpirySec

      public void setExpirySec(int sec)
      Parameters:
      sec - the expiry to use in seconds
    • getExpirySec

      @ManagedAttribute(value="memcached expiry time in sec", readonly=true) public int getExpirySec()
      Expiry time for memached entries.
      Returns:
      memcached expiry time in sec
    • isHeartbeats

      @ManagedAttribute(value="enable memcached heartbeats", readonly=true) public boolean isHeartbeats()
    • setHeartbeats

      public void setHeartbeats(boolean heartbeats)
    • initialize

      public void initialize(org.eclipse.jetty.server.session.SessionContext context)
      Specified by:
      initialize in interface org.eclipse.jetty.server.session.SessionDataMap
    • load

      public org.eclipse.jetty.server.session.SessionData load(String id) throws Exception
      Specified by:
      load in interface org.eclipse.jetty.server.session.SessionDataMap
      Throws:
      Exception
    • store

      public void store(String id, org.eclipse.jetty.server.session.SessionData data) throws Exception
      Specified by:
      store in interface org.eclipse.jetty.server.session.SessionDataMap
      Throws:
      Exception
    • delete

      public boolean delete(String id) throws Exception
      Specified by:
      delete in interface org.eclipse.jetty.server.session.SessionDataMap
      Throws:
      Exception
    • doStop

      protected void doStop() throws Exception
      Overrides:
      doStop in class org.eclipse.jetty.util.component.AbstractLifeCycle
      Throws:
      Exception