PageRenderTime 42ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/jboss-as-7.1.1.Final/web/src/main/java/org/jboss/as/web/session/DistributableSessionManagerMBean.java

#
Java | 197 lines | 27 code | 22 blank | 148 comment | 0 complexity | 6128273dd6c9ba5aecfee36875f5f0b3 MD5 | raw file
Possible License(s): LGPL-2.1, Apache-2.0
  1. /*
  2. * JBoss, Home of Professional Open Source.
  3. * Copyright 2008, Red Hat Middleware LLC, and individual contributors
  4. * as indicated by the @author tags. See the copyright.txt file in the
  5. * distribution for a full listing of individual contributors.
  6. *
  7. * This is free software; you can redistribute it and/or modify it
  8. * under the terms of the GNU Lesser General Public License as
  9. * published by the Free Software Foundation; either version 2.1 of
  10. * the License, or (at your option) any later version.
  11. *
  12. * This software is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Lesser General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General Public
  18. * License along with this software; if not, write to the Free
  19. * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  20. * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  21. */
  22. package org.jboss.as.web.session;
  23. import org.jboss.metadata.web.jboss.ReplicationGranularity;
  24. import org.jboss.metadata.web.jboss.ReplicationTrigger;
  25. import org.jboss.metadata.web.jboss.SnapshotMode;
  26. public interface DistributableSessionManagerMBean extends SessionManagerMBean {
  27. /**
  28. * Gets the value of the attribute with the given key from the given session. If the session is in the distributed store but
  29. * hasn't been loaded on this node, invoking this method will cause it to be loaded.
  30. *
  31. * @param sessionId the id of the session
  32. * @param key the attribute key
  33. * @return the value, converted to a String via toString(), or <code>null</code> if the session or key does not exist.
  34. */
  35. String getSessionAttribute(String sessionId, String key);
  36. /**
  37. * Expires the given session. If the session is in the distributed store but hasn't been loaded on this node, invoking this
  38. * method will cause it to be loaded.
  39. *
  40. * @param sessionId the id of the session
  41. */
  42. void expireSession(String sessionId);
  43. /**
  44. * Gets the last time the given session was accessed. If the session is in the distributed store but hasn't been loaded on
  45. * this node, invoking this method will cause it to be loaded.
  46. *
  47. * @param sessionId
  48. * @return the last accessed time, or the empty string if the session doesn't exist.
  49. */
  50. String getLastAccessedTime(String sessionId);
  51. /**
  52. * Gets the creation time of the given session. If the session is in the distributed store but hasn't been loaded on this
  53. * node, invoking this method will cause it to be loaded.
  54. *
  55. * @param sessionId
  56. * @return the creation time, or or the empty string if the session doesn't exist.
  57. */
  58. String getCreationTime(String sessionId);
  59. /**
  60. * Gets the cache config name used to get the underlying cache from a cache manager.
  61. *
  62. * @return the config name, or <code>null</code> if this has not yet been configured or the cache was directly injected.
  63. */
  64. String getCacheConfigName();
  65. /**
  66. * Gets the replication granularity.
  67. *
  68. * @return SESSION, ATTRIBUTE or FIELD, or <code>null</code> if this has not yet been configured.
  69. */
  70. ReplicationGranularity getReplicationGranularity();
  71. /**
  72. * Gets the replication trigger.
  73. *
  74. * @return SET, SET_AND_GET, SET_AND_NON_PRIMITIVE_GET or <code>null</code> if this has not yet been configured.
  75. */
  76. ReplicationTrigger getReplicationTrigger();
  77. /**
  78. * Gets whether JK is being used and special handling of a jvmRoute portion of session ids is needed.
  79. */
  80. boolean getUseJK();
  81. /**
  82. * Gets the snapshot mode.
  83. *
  84. * @return "instant" or "interval"
  85. */
  86. SnapshotMode getSnapshotMode();
  87. /**
  88. * Gets the number of milliseconds between replications if "interval" mode is used.
  89. */
  90. int getSnapshotInterval();
  91. /**
  92. * Get the maximum interval between requests, in seconds, after which a request will trigger replication of the session's
  93. * metadata regardless of whether the request has otherwise made the session dirty. Such replication ensures that other
  94. * nodes in the cluster are aware of a relatively recent value for the session's timestamp and won't incorrectly expire an
  95. * unreplicated session upon failover.
  96. * <p/>
  97. * Default value is <code>-1</code>.
  98. * <p/>
  99. * The cost of the metadata replication depends on the configured {@link #setReplicationGranularityString(String)
  100. * replication granularity}. With <code>SESSION</code>, the session's attribute map is replicated along with the metadata,
  101. * so it can be fairly costly. With other granularities, the metadata object is replicated separately from the attributes
  102. * and only contains a String, and a few longs, ints and booleans.
  103. *
  104. * @return the maximum interval since last replication after which a request will trigger session metadata replication. A
  105. * value of <code>0</code> means replicate metadata on every request; a value of <code>-1</code> means never
  106. * replicate metadata unless the session is otherwise dirty.
  107. */
  108. int getMaxUnreplicatedInterval();
  109. /**
  110. * Sets the maximum interval between requests, in seconds, after which a request will trigger replication of the session's
  111. * metadata regardless of whether the request has otherwise made the session dirty.
  112. *
  113. * @param maxUnreplicatedInterval the maximum interval since last replication after which a request will trigger session
  114. * metadata replication. A value of <code>0</code> means replicate metadata on every request; a value of
  115. * <code>-1</code> means never replicate metadata unless the session is otherwise dirty.
  116. */
  117. void setMaxUnreplicatedInterval(int maxUnreplicatedInterval);
  118. /**
  119. * Lists all session ids known to this manager, including those in the distributed store that have not been accessed on this
  120. * node.
  121. *
  122. * @return a comma-separated list of session ids
  123. */
  124. String listSessionIds();
  125. /**
  126. * Lists all session ids known to this manager, excluding those in the distributed store that have not been accessed on this
  127. * node.
  128. *
  129. * @return a comma-separated list of session ids
  130. */
  131. String listLocalSessionIds();
  132. /**
  133. * Gets whether passivation was enabled in jboss-web.xml and in the underlying cache.
  134. *
  135. * @return <code>true</code> if passivation is enabled in both jboss-web.xml and in the cache; <code>false</code> otherwise
  136. */
  137. boolean isPassivationEnabled();
  138. /**
  139. * Gets the number of passivated sessions
  140. *
  141. * @return
  142. */
  143. long getPassivatedSessionCount();
  144. /**
  145. * Gets the highest number of passivated sessions seen.
  146. *
  147. * @return
  148. */
  149. long getMaxPassivatedSessionCount();
  150. /**
  151. * Elapsed time after which an inactive session will be passivated to persistent storage if {@link #isPassivationEnabled()
  152. * passivation is enabled}.
  153. *
  154. * @return
  155. */
  156. long getPassivationMaxIdleTime();
  157. /**
  158. * Elapsed time after which an inactive session will be passivated to persistent storage if {@link #isPassivationEnabled()
  159. * passivation is enabled} and the manager needs to passivate sessions early in order to comply with a
  160. * {@link SessionManagerMBean#getMaxActiveAllowed()} setting.
  161. *
  162. * @return
  163. */
  164. long getPassivationMinIdleTime();
  165. /**
  166. * Gets the number of duplicated session ids generated.
  167. */
  168. int getDuplicates();
  169. /**
  170. * Sets the number of duplicated session ids generated.
  171. *
  172. * @param duplicates the number of duplicates session ids
  173. */
  174. void setDuplicates(int duplicates);
  175. }