[jboss-cvs] JBossAS SVN: r107222 - in projects/cluster/ha-server-ispn/trunk/src/main/java/org/jboss/ha/ispn: atomic and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Jul 29 23:51:20 EDT 2010
Author: pferraro
Date: 2010-07-29 23:51:20 -0400 (Thu, 29 Jul 2010)
New Revision: 107222
Added:
projects/cluster/ha-server-ispn/trunk/src/main/java/org/jboss/ha/ispn/atomic/
projects/cluster/ha-server-ispn/trunk/src/main/java/org/jboss/ha/ispn/atomic/AtomicMapFactory.java
projects/cluster/ha-server-ispn/trunk/src/main/java/org/jboss/ha/ispn/atomic/DefaultAtomicMapFactory.java
Log:
Facade for AtomicMapLookup
Added: projects/cluster/ha-server-ispn/trunk/src/main/java/org/jboss/ha/ispn/atomic/AtomicMapFactory.java
===================================================================
--- projects/cluster/ha-server-ispn/trunk/src/main/java/org/jboss/ha/ispn/atomic/AtomicMapFactory.java (rev 0)
+++ projects/cluster/ha-server-ispn/trunk/src/main/java/org/jboss/ha/ispn/atomic/AtomicMapFactory.java 2010-07-30 03:51:20 UTC (rev 107222)
@@ -0,0 +1,46 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.ha.ispn.atomic;
+
+import org.infinispan.Cache;
+import org.infinispan.atomic.AtomicMap;
+
+/**
+ * Mockable facade to {@link org.infinispan.atomic.AtomicMapLookup}.
+ * @author Paul Ferraro
+ */
+public interface AtomicMapFactory
+{
+ /**
+ * Gets an atomic map from the cache entry with the specified key.
+ * If no such entry exists, a new entry will be created if indicated.
+ * @param <K> the cache key type
+ * @param <AMK> the atomic map key type
+ * @param <AMV> the atomic map value type
+ * @param cache an infinispan cache
+ * @param key a cache key
+ * @param create indicates whether or not to create a cache entry if none exists.
+ * @return the atomic map associated with the given key, or null, if no entry exists,
+ * and we did not indicate that a new entry should be created
+ */
+ <K, AMK, AMV> AtomicMap<AMK, AMV> get(Cache<K, AtomicMap<AMK, AMV>> cache, K key, boolean create);
+}
Added: projects/cluster/ha-server-ispn/trunk/src/main/java/org/jboss/ha/ispn/atomic/DefaultAtomicMapFactory.java
===================================================================
--- projects/cluster/ha-server-ispn/trunk/src/main/java/org/jboss/ha/ispn/atomic/DefaultAtomicMapFactory.java (rev 0)
+++ projects/cluster/ha-server-ispn/trunk/src/main/java/org/jboss/ha/ispn/atomic/DefaultAtomicMapFactory.java 2010-07-30 03:51:20 UTC (rev 107222)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.ha.ispn.atomic;
+
+import org.infinispan.Cache;
+import org.infinispan.atomic.AtomicMap;
+import org.infinispan.atomic.AtomicMapLookup;
+
+/**
+ * Default atomic map factory that delegates to {@link AtomicMapLookup}.
+ * @author Paul Ferraro
+ */
+public class DefaultAtomicMapFactory implements AtomicMapFactory
+{
+ /**
+ * {@inheritDoc}
+ * @see org.jboss.ha.ispn.atomic.AtomicMapFactory#get(org.infinispan.Cache, java.lang.Object, boolean)
+ */
+ @Override
+ public <K, AMK, AMV> AtomicMap<AMK, AMV> get(Cache<K, AtomicMap<AMK, AMV>> cache, K key, boolean create)
+ {
+ return AtomicMapLookup.getAtomicMap(cache, key, create);
+ }
+}
More information about the jboss-cvs-commits
mailing list