[jboss-cvs] JBossAS SVN: r65922 - projects/ejb3/branches/cluster-dev/ejb3-cache/src/main/java/org/jboss/ejb3/cache/grouped.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Oct 8 13:26:29 EDT 2007


Author: bstansberry at jboss.com
Date: 2007-10-08 13:26:29 -0400 (Mon, 08 Oct 2007)
New Revision: 65922

Added:
   projects/ejb3/branches/cluster-dev/ejb3-cache/src/main/java/org/jboss/ejb3/cache/grouped/SerializationGroup.java
   projects/ejb3/branches/cluster-dev/ejb3-cache/src/main/java/org/jboss/ejb3/cache/grouped/SerializationGroupMember.java
Log:
First draft of clustering support

Added: projects/ejb3/branches/cluster-dev/ejb3-cache/src/main/java/org/jboss/ejb3/cache/grouped/SerializationGroup.java
===================================================================
--- projects/ejb3/branches/cluster-dev/ejb3-cache/src/main/java/org/jboss/ejb3/cache/grouped/SerializationGroup.java	                        (rev 0)
+++ projects/ejb3/branches/cluster-dev/ejb3-cache/src/main/java/org/jboss/ejb3/cache/grouped/SerializationGroup.java	2007-10-08 17:26:29 UTC (rev 65922)
@@ -0,0 +1,162 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.ejb3.cache.grouped;
+
+import java.io.Serializable;
+
+import org.jboss.ejb3.cache.Cacheable;
+
+/**
+ * Defines a group of serializable objects which must be serialized in
+ * one unit of work.
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @author Brian Stansberry
+ * @version $Revision: $
+ */
+public interface SerializationGroup extends Cacheable, Serializable
+{
+   /**
+    * Gets whether this groups supports (and requires) clustering functionality
+    * from its members.
+    * 
+    * @return <code>true</code> if clustering is supported, <code>false</code>
+    *         otherwise
+    */
+   boolean isClustered();
+   
+   /**
+    * Sets whether this groups supports (and requires) clustering functionality
+    * from its members.
+    * 
+    * @return
+    */
+   void setClustered(boolean clustered);
+   
+   /**
+    * Initially associate a new member with the group. Also
+    * {@link #addActive(SerializationGroupMember) marks the member as
+    * active}.
+    * 
+    * @param member
+    * 
+    * @throws IllegalStateException if <code>member</code> was previously
+    *                               added to the group
+    * @throws IllegalArgumentException if the 
+    *   {@link SerializationGroupMember#isClustered() member's support for clustering}
+    *   does not match {@link #isClustered() our own}.
+    */
+   void addMember(SerializationGroupMember member);
+   
+   /**
+    * Remove the specified member from the group.
+    * 
+    * @param key the {@link Identifiable#getId() id} of the member
+    */
+   void removeMember(Object key);
+   
+   /**
+    * Gets the number of group members.
+    */
+   int size();
+   
+   /**
+    * Returns the {@link SerializationGroupMember#getSerializableObject() member object}
+    * associated with the member whose {@link Identifiable#getId() id}
+    * matches <code>key</code>.
+    * 
+    * @param key the {@link Identifiable#getId() id} of the member
+    * 
+    * @return the object associated with the member, or <code>null</code> if
+    *         <code>key</code> does not identify a member.
+    */
+   Object getMemberObject(Object key);
+   
+   /**
+    * Records that the given member is "active"; i.e. needs to have
+    * @PrePassivate callbacks invoked before serialization.
+    * 
+    * @param member the member
+    * 
+    * @throws IllegalStateException if <code>member</code> wasn't previously
+    *                               added to the group via
+    *                               {@link #addMember(SerializationGroupMember)}
+    */
+   void addActive(SerializationGroupMember member);
+   
+   /**
+    * Records that the given member is no longer "active"; i.e. does not need
+    * to have @PrePassivate callbacks invoked before serialization.
+    * 
+    * @param key the {@link Identifiable#getId() id} of the member
+    * 
+    * @throws IllegalStateException if <code>member</code> wasn't previously
+    *                               added to the group via
+    *                               {@link #addMember(SerializationGroupMember)}
+    */
+   void removeActive(Object key);
+   
+   /**
+    * Notification that the given member is "in use", and therefore the
+    * group should not be serialized.
+    * 
+    * @param key the {@link Identifiable#getId() id} of the member
+    * 
+    * @throws IllegalStateException if <code>member</code> wasn't previously
+    *                               added to the group via
+    *                               {@link #addMember(SerializationGroupMember)}
+    */
+   void addInUse(Object key);
+   
+   /**
+    * Notification that the given member is no longer "in use", and therefore 
+    * should not prevent the group being serialized.
+    * 
+    * @param key the {@link Identifiable#getId() id} of the member
+    * 
+    * @throws IllegalStateException if <code>member</code> wasn't previously
+    *                               added to the group via
+    *                               {@link #addMember(SerializationGroupMember)}
+    */
+   void removeInUse(Object key);
+   
+   /**
+    * Prepare members for passivation.
+    */
+   void prePassivate();
+   
+   /**
+    * Notification that the group has been activated from a passivated state.
+    */
+   void postActivate();;
+   
+   /**
+    * Prepare members for replication.
+    */
+   void preReplicate();
+   
+   /**
+    * Notification that the previously replicated group has been retrieved from 
+    * a clustered cache.
+    */
+   void postReplicate();
+}


Property changes on: projects/ejb3/branches/cluster-dev/ejb3-cache/src/main/java/org/jboss/ejb3/cache/grouped/SerializationGroup.java
___________________________________________________________________
Name: svn:executable
   + *

Added: projects/ejb3/branches/cluster-dev/ejb3-cache/src/main/java/org/jboss/ejb3/cache/grouped/SerializationGroupMember.java
===================================================================
--- projects/ejb3/branches/cluster-dev/ejb3-cache/src/main/java/org/jboss/ejb3/cache/grouped/SerializationGroupMember.java	                        (rev 0)
+++ projects/ejb3/branches/cluster-dev/ejb3-cache/src/main/java/org/jboss/ejb3/cache/grouped/SerializationGroupMember.java	2007-10-08 17:26:29 UTC (rev 65922)
@@ -0,0 +1,69 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.ejb3.cache.grouped;
+
+import org.jboss.ejb3.cache.Identifiable;
+
+/**
+ * A member of a {@link SerializationGroup}.
+ * 
+ * @author Brian Stansberry
+ * @version $Revision$
+ */
+public interface SerializationGroupMember extends Identifiable
+{
+   /**
+    * Gets the underlying object that should be serialized as part of 
+    * serialization of the group.
+    * 
+    * @return
+    */
+   Object getSerializableObject();
+   
+   /**
+    * Prepare the group member for passivation. Ensure any @PrePassivate 
+    * callback is invoked on the underlying object.  Ensure any reference to 
+    * the {@link #getSerializableObject() underlying object} or to the 
+    * {@link SerializationGroup} is nulled.
+    */
+   void prePassivate();
+   
+   /**
+    * Gets whether this member supports clustering functionality.
+    * 
+    * @return <code>true</code> if clustering is supported, <code>false</code>
+    *         otherwise
+    */
+   boolean isClustered();
+   
+   /**
+    * Prepare the group member for replication. Ensure any required callback
+    * (e.g. @PrePassivate) is invoked on the underlying object.  Ensure any 
+    * reference to the {@link #getSerializableObject() underlying object} or to 
+    * the {@link SerializationGroup} is nulled. 
+    * 
+    * @throws UnsupportedOperationException if {@link #isClustered()} returns
+    *                                       <code>false</code>
+    */
+   void preReplicate();
+}




More information about the jboss-cvs-commits mailing list