View Javadoc
1   //
2   //  ========================================================================
3   //  Copyright (c) 1995-2016 Mort Bay Consulting Pty. Ltd.
4   //  ------------------------------------------------------------------------
5   //  All rights reserved. This program and the accompanying materials
6   //  are made available under the terms of the Eclipse Public License v1.0
7   //  and Apache License v2.0 which accompanies this distribution.
8   //
9   //      The Eclipse Public License is available at
10  //      http://www.eclipse.org/legal/epl-v10.html
11  //
12  //      The Apache License v2.0 is available at
13  //      http://www.opensource.org/licenses/apache2.0.php
14  //
15  //  You may elect to redistribute this code under either of these licenses.
16  //  ========================================================================
17  //
18  
19  
20  package org.eclipse.jetty.server.session;
21  
22  /**
23   * NullSessionCacheFactory
24   *
25   * Factory for NullSessionCaches.
26   */
27  public class NullSessionCacheFactory implements SessionCacheFactory
28  {    
29      boolean _saveOnCreate;
30      boolean _removeUnloadableSessions;
31      
32  
33      /**
34       * @return the saveOnCreate
35       */
36      public boolean isSaveOnCreate()
37      {
38          return _saveOnCreate;
39      }
40  
41  
42  
43      /**
44       * @param saveOnCreate the saveOnCreate to set
45       */
46      public void setSaveOnCreate(boolean saveOnCreate)
47      {
48          _saveOnCreate = saveOnCreate;
49      }
50  
51  
52  
53      /**
54       * @return the removeUnloadableSessions
55       */
56      public boolean isRemoveUnloadableSessions()
57      {
58          return _removeUnloadableSessions;
59      }
60  
61  
62  
63      /**
64       * @param removeUnloadableSessions the removeUnloadableSessions to set
65       */
66      public void setRemoveUnloadableSessions(boolean removeUnloadableSessions)
67      {
68          _removeUnloadableSessions = removeUnloadableSessions;
69      }
70  
71  
72  
73      /** 
74       * @see org.eclipse.jetty.server.session.SessionCacheFactory#getSessionCache(org.eclipse.jetty.server.session.SessionHandler)
75       */
76      @Override
77      public SessionCache getSessionCache(SessionHandler handler)
78      {
79          NullSessionCache cache = new NullSessionCache(handler);
80          cache.setSaveOnCreate(isSaveOnCreate());
81          cache.setRemoveUnloadableSessions(isRemoveUnloadableSessions());
82          return cache;
83          
84      }
85  
86  }