[jboss-cvs] JBossAS SVN: r87220 - projects/cluster/ha-server-cache-spi/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/spi.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Apr 13 21:22:28 EDT 2009
Author: bstansberry at jboss.com
Date: 2009-04-13 21:22:28 -0400 (Mon, 13 Apr 2009)
New Revision: 87220
Added:
projects/cluster/ha-server-cache-spi/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/spi/IncomingDistributableSessionData.java
projects/cluster/ha-server-cache-spi/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/spi/OutgoingAttributeGranularitySessionData.java
projects/cluster/ha-server-cache-spi/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/spi/OutgoingDistributableSessionData.java
projects/cluster/ha-server-cache-spi/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/spi/OutgoingSessionGranularitySessionData.java
Removed:
projects/cluster/ha-server-cache-spi/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/spi/DistributableSession.java
projects/cluster/ha-server-cache-spi/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/spi/DistributableSessionData.java
Modified:
projects/cluster/ha-server-cache-spi/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/spi/DistributedCacheManager.java
projects/cluster/ha-server-cache-spi/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/spi/DistributedCacheManagerFactory.java
projects/cluster/ha-server-cache-spi/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/spi/DistributedCacheManagerFactoryFactory.java
Log:
[JBCLUSTER-233] Get rid of DistributableSession
[JBCLUSTER-221] Don't expose Atomic objects for session version and timestamp
[JBCLUSTER-222] For ATTRIBUTE granularity, pass modification maps through to DistributedCacheManager
Deleted: projects/cluster/ha-server-cache-spi/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/spi/DistributableSession.java
===================================================================
--- projects/cluster/ha-server-cache-spi/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/spi/DistributableSession.java 2009-04-14 01:20:26 UTC (rev 87219)
+++ projects/cluster/ha-server-cache-spi/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/spi/DistributableSession.java 2009-04-14 01:22:28 UTC (rev 87220)
@@ -1,74 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.web.tomcat.service.session.distributedcache.spi;
-
-import java.util.Map;
-import java.util.concurrent.atomic.AtomicInteger;
-import java.util.concurrent.atomic.AtomicLong;
-
-/**
- * Interface implemented by a <code>Session</code> implementation that
- * can be handled by a DistributedCacheManager.
- *
- * @author Brian Stansberry
- * @version $Revision: $
- */
-public interface DistributableSession
-{
- /**
- * Gets the session id with any appended jvmRoute info removed.
- */
- String getRealId();
-
- /**
- * Gets the session's version.
- */
- AtomicInteger getVersion();
-
- /**
- * Gets whether the timestamp must be replicated.
- *
- * @return <code>true</code> if timestamp replication is required
- */
- boolean getMustReplicateTimestamp();
-
- /**
- * Gets the timestamp of the most recent access of the session.
- */
- AtomicLong getSessionTimestamp();
-
- boolean isSessionMetadataDirty();
-
- DistributableSessionMetadata getSessionMetadata();
-
- boolean isSessionAttributeMapDirty();
-
- Map<String, Object> getSessionAttributeMap();
-
- void update(DistributableSessionData sessionData);
-
- boolean needRegionForSession();
-
- boolean hasRegionForSession();
-
- void createdRegionForSession();
-}
\ No newline at end of file
Deleted: projects/cluster/ha-server-cache-spi/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/spi/DistributableSessionData.java
===================================================================
--- projects/cluster/ha-server-cache-spi/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/spi/DistributableSessionData.java 2009-04-14 01:20:26 UTC (rev 87219)
+++ projects/cluster/ha-server-cache-spi/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/spi/DistributableSessionData.java 2009-04-14 01:22:28 UTC (rev 87220)
@@ -1,71 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.web.tomcat.service.session.distributedcache.spi;
-
-import java.util.Map;
-
-/**
- * Encapsulates the four types of data about a session that are stored
- * in a distributed cache.
- *
- * @author Brian Stansberry
- */
-public interface DistributableSessionData
-{
- /**
- * Gets the session's version.
- */
- int getVersion();
-
- /**
- * Gets the timestamp of the most recent session access.
- */
- long getTimestamp();
-
- /**
- * Gets the other session metadata besides the version and timestamp.
- */
- DistributableSessionMetadata getMetadata();
-
- /**
- * Gets whether it is safe to invoke {@link #getSessionAttributes()}
- * on this object.
- *
- * @return <code>true</code> if {@link #getSessionAttributes()} will
- * return a map; <code>false</code> if it will throw an
- * IllegalStateException.
- */
- boolean providesSessionAttributes();
-
- /**
- * Returns the session's attribute map, or throws an
- * IllegalStateException if {@link #providesSessionAttributes()} would
- * return <code>false</code>.
- *
- * @return the session attribute map. Will not return <code>null</code>
- *
- * @throws IllegalStateException if {@link #providesSessionAttributes()} would
- * return <code>false</code>.
- */
- Map<String, Object> getSessionAttributes();
-}
Modified: projects/cluster/ha-server-cache-spi/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/spi/DistributedCacheManager.java
===================================================================
--- projects/cluster/ha-server-cache-spi/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/spi/DistributedCacheManager.java 2009-04-14 01:20:26 UTC (rev 87219)
+++ projects/cluster/ha-server-cache-spi/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/spi/DistributedCacheManager.java 2009-04-14 01:22:28 UTC (rev 87220)
@@ -31,7 +31,7 @@
* @author Brian Stansberry
* @version $Revision: $
*/
-public interface DistributedCacheManager
+public interface DistributedCacheManager<T extends OutgoingDistributableSessionData>
{
/**
* Starts the distributed caching layer.
@@ -52,26 +52,16 @@
* Notification to the distributed cache that a session has been
* newly created.
*
- * @param session the new session
+ * @param realId the session id with any appended jvmRoute info removed
*/
- void sessionCreated(DistributableSession session);
-
- /**
- * Loads any serialized data in the cache into the given session
- * using its <code>readExternal</code> method.
- *
- * @return the session passed as <code>toLoad</code>, or
- * <code>null</code> if the cache had no data stored
- * under the given session id.
- */
- <T extends DistributableSession> T loadSession(String realId, T toLoad);
+ void sessionCreated(String realId);
/**
* Store or update a session in the distributed cache.
*
* @param session the session
*/
- void putSession(DistributableSession session);
+ void storeSessionData(T sessionData);
/**
* Globally remove a session from the distributed cache.
@@ -114,20 +104,32 @@
void evictSession(String realId, String dataOwner);
/**
- * Get the {@link DistributableSessionData} that encapsulates the distributed
+ * Get the {@link IncomingDistributableSessionData} that encapsulates the distributed
* cache's information about the given session.
*
* @param realId the session's id, excluding any jvmRoute
+ * @param initialLoad <code>true</code> if this is the first access of
+ * this session's data on this node
+ *
+ * @return the session data
+ */
+ IncomingDistributableSessionData getSessionData(String realId, boolean initialLoad);
+
+ /**
+ * Get the {@link IncomingDistributableSessionData} that encapsulates the distributed
+ * cache's information about the given session.
+ *
+ * @param realId the session's id, excluding any jvmRoute
* @param dataOwner identifier of node where the session is active;
* <code>null</code> if locally active or location where
* active is unknown
* @param includeAttributes should
- * @link DistributableSessionData#providesSessionAttributes()}
+ * @link IncomingDistributableSessionData#providesSessionAttributes()}
* return <code>true</code>?
*
* @return the session data
*/
- DistributableSessionData getSessionData(String realId, String dataOwner, boolean includeAttributes);
+ IncomingDistributableSessionData getSessionData(String realId, String dataOwner, boolean includeAttributes);
/**
* Gets the ids of all sessions in the underlying cache.
Modified: projects/cluster/ha-server-cache-spi/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/spi/DistributedCacheManagerFactory.java
===================================================================
--- projects/cluster/ha-server-cache-spi/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/spi/DistributedCacheManagerFactory.java 2009-04-14 01:20:26 UTC (rev 87219)
+++ projects/cluster/ha-server-cache-spi/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/spi/DistributedCacheManagerFactory.java 2009-04-14 01:22:28 UTC (rev 87220)
@@ -30,5 +30,5 @@
*/
public interface DistributedCacheManagerFactory
{
- DistributedCacheManager getDistributedCacheManager(LocalDistributableSessionManager localManager) throws ClusteringNotSupportedException;
+ <T extends OutgoingDistributableSessionData> DistributedCacheManager<T> getDistributedCacheManager(LocalDistributableSessionManager localManager) throws ClusteringNotSupportedException;
}
Modified: projects/cluster/ha-server-cache-spi/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/spi/DistributedCacheManagerFactoryFactory.java
===================================================================
--- projects/cluster/ha-server-cache-spi/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/spi/DistributedCacheManagerFactoryFactory.java 2009-04-14 01:20:26 UTC (rev 87219)
+++ projects/cluster/ha-server-cache-spi/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/spi/DistributedCacheManagerFactoryFactory.java 2009-04-14 01:22:28 UTC (rev 87220)
@@ -153,9 +153,9 @@
}
else
{
- return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() {
+ return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
- public Object run()
+ public ClassLoader run()
{
return Thread.currentThread().getContextClassLoader();
}
Copied: projects/cluster/ha-server-cache-spi/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/spi/IncomingDistributableSessionData.java (from rev 80759, projects/cluster/ha-server-cache-spi/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/spi/DistributableSessionData.java)
===================================================================
--- projects/cluster/ha-server-cache-spi/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/spi/IncomingDistributableSessionData.java (rev 0)
+++ projects/cluster/ha-server-cache-spi/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/spi/IncomingDistributableSessionData.java 2009-04-14 01:22:28 UTC (rev 87220)
@@ -0,0 +1,71 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.web.tomcat.service.session.distributedcache.spi;
+
+import java.util.Map;
+
+/**
+ * Encapsulates the four types of data about a session that can be retrieved
+ * from a distributed cache.
+ *
+ * @author Brian Stansberry
+ */
+public interface IncomingDistributableSessionData
+{
+ /**
+ * Gets the session's version.
+ */
+ int getVersion();
+
+ /**
+ * Gets the timestamp of the most recent session access.
+ */
+ long getTimestamp();
+
+ /**
+ * Gets the other session metadata besides the version and timestamp.
+ */
+ DistributableSessionMetadata getMetadata();
+
+ /**
+ * Gets whether it is safe to invoke {@link #getSessionAttributes()}
+ * on this object.
+ *
+ * @return <code>true</code> if {@link #getSessionAttributes()} will
+ * return a map; <code>false</code> if it will throw an
+ * IllegalStateException.
+ */
+ boolean providesSessionAttributes();
+
+ /**
+ * Returns the session's attribute map, or throws an
+ * IllegalStateException if {@link #providesSessionAttributes()} would
+ * return <code>false</code>.
+ *
+ * @return the session attribute map. Will not return <code>null</code>
+ *
+ * @throws IllegalStateException if {@link #providesSessionAttributes()} would
+ * return <code>false</code>.
+ */
+ Map<String, Object> getSessionAttributes();
+}
Property changes on: projects/cluster/ha-server-cache-spi/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/spi/IncomingDistributableSessionData.java
___________________________________________________________________
Name: svn:mergeinfo
+
Added: projects/cluster/ha-server-cache-spi/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/spi/OutgoingAttributeGranularitySessionData.java
===================================================================
--- projects/cluster/ha-server-cache-spi/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/spi/OutgoingAttributeGranularitySessionData.java (rev 0)
+++ projects/cluster/ha-server-cache-spi/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/spi/OutgoingAttributeGranularitySessionData.java 2009-04-14 01:22:28 UTC (rev 87220)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.web.tomcat.service.session.distributedcache.spi;
+
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * @author Brian Stansberry
+ *
+ */
+public interface OutgoingAttributeGranularitySessionData
+ extends OutgoingDistributableSessionData
+{
+ Map<String, Object> getModifiedSessionAttributes();
+
+ Set<String> getRemovedSessionAttributes();
+}
Property changes on: projects/cluster/ha-server-cache-spi/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/spi/OutgoingAttributeGranularitySessionData.java
___________________________________________________________________
Name: svn:keywords
+
Added: projects/cluster/ha-server-cache-spi/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/spi/OutgoingDistributableSessionData.java
===================================================================
--- projects/cluster/ha-server-cache-spi/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/spi/OutgoingDistributableSessionData.java (rev 0)
+++ projects/cluster/ha-server-cache-spi/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/spi/OutgoingDistributableSessionData.java 2009-04-14 01:22:28 UTC (rev 87220)
@@ -0,0 +1,54 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.web.tomcat.service.session.distributedcache.spi;
+
+
+/**
+ * Encapsulates the types of data about a session that can be stored to a
+ * distributed cache, except for the attributes. How to obtain the attributes,
+ * if available, would be specified via a subinterface.
+ *
+ * @author Brian Stansberry
+ */
+public interface OutgoingDistributableSessionData
+{
+ /**
+ * Gets the session id with any appended jvmRoute info removed.
+ */
+ String getRealId();
+
+ /**
+ * Gets the session's version.
+ */
+ int getVersion();
+
+ /**
+ * Gets the timestamp of the most recent session access.
+ */
+ Long getTimestamp();
+
+ /**
+ * Gets the other session metadata besides the version and timestamp.
+ */
+ DistributableSessionMetadata getMetadata();
+}
Property changes on: projects/cluster/ha-server-cache-spi/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/spi/OutgoingDistributableSessionData.java
___________________________________________________________________
Name: svn:keywords
+
Added: projects/cluster/ha-server-cache-spi/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/spi/OutgoingSessionGranularitySessionData.java
===================================================================
--- projects/cluster/ha-server-cache-spi/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/spi/OutgoingSessionGranularitySessionData.java (rev 0)
+++ projects/cluster/ha-server-cache-spi/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/spi/OutgoingSessionGranularitySessionData.java 2009-04-14 01:22:28 UTC (rev 87220)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.web.tomcat.service.session.distributedcache.spi;
+
+import java.util.Map;
+
+/**
+ * @author Brian Stansberry
+ *
+ */
+public interface OutgoingSessionGranularitySessionData
+ extends OutgoingDistributableSessionData
+{
+
+ Map<String, Object> getSessionAttributes();
+}
Property changes on: projects/cluster/ha-server-cache-spi/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/spi/OutgoingSessionGranularitySessionData.java
___________________________________________________________________
Name: svn:keywords
+
More information about the jboss-cvs-commits
mailing list