Class MemcachedSessionDataMap

  • All Implemented Interfaces:
    SessionDataMap, org.eclipse.jetty.util.component.LifeCycle

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

      Nested Classes 
      Modifier and Type Class Description
      static class  MemcachedSessionDataMap.SessionDataTranscoder
      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
      • 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 _builder  
      protected net.rubyeye.xmemcached.MemcachedClient _client  
      protected int _expirySec  
      protected boolean _heartbeats  
      static java.lang.String DEFAULT_HOST  
      static java.lang.String DEFAULT_PORT  
      • Fields inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle

        FAILED, RUNNING, STARTED, STARTING, STOPPED, STOPPING
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean delete​(java.lang.String id)  
      protected void doStop()  
      net.rubyeye.xmemcached.XMemcachedClientBuilder getBuilder()  
      int getExpirySec()
      Expiry time for memached entries.
      void initialize​(SessionContext context)  
      boolean isHeartbeats()  
      SessionData load​(java.lang.String id)  
      void setExpirySec​(int sec)  
      void setHeartbeats​(boolean heartbeats)  
      void store​(java.lang.String id, SessionData data)  
      • Methods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle

        addLifeCycleListener, doStart, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, setStopTimeout, 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

        addLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
    • Field Detail

      • _client

        protected net.rubyeye.xmemcached.MemcachedClient _client
      • _expirySec

        protected int _expirySec
      • _heartbeats

        protected boolean _heartbeats
      • _builder

        protected net.rubyeye.xmemcached.XMemcachedClientBuilder _builder
    • Constructor Detail

      • MemcachedSessionDataMap

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

        public MemcachedSessionDataMap​(java.util.List<java.net.InetSocketAddress> addresses)
      • MemcachedSessionDataMap

        public MemcachedSessionDataMap​(java.util.List<java.net.InetSocketAddress> addresses,
                                       int[] weights)
    • Method Detail

      • 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)
      • load

        public SessionData load​(java.lang.String id)
                         throws java.lang.Exception
        Specified by:
        load in interface SessionDataMap
        Throws:
        java.lang.Exception
      • store

        public void store​(java.lang.String id,
                          SessionData data)
                   throws java.lang.Exception
        Specified by:
        store in interface SessionDataMap
        Throws:
        java.lang.Exception
      • delete

        public boolean delete​(java.lang.String id)
                       throws java.lang.Exception
        Specified by:
        delete in interface SessionDataMap
        Throws:
        java.lang.Exception
      • doStop

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