[jbosscache-commits] JBoss Cache SVN: r6886 - core/branches/flat/src/main/java/org/jboss/cache.
jbosscache-commits at lists.jboss.org
jbosscache-commits at lists.jboss.org
Wed Oct 8 12:29:32 EDT 2008
Author: manik.surtani at jboss.com
Date: 2008-10-08 12:29:32 -0400 (Wed, 08 Oct 2008)
New Revision: 6886
Removed:
core/branches/flat/src/main/java/org/jboss/cache/LegacyRegionManagerImpl.java
core/branches/flat/src/main/java/org/jboss/cache/PessimisticNodeFactory.java
core/branches/flat/src/main/java/org/jboss/cache/PessimisticUnversionedNode.java
core/branches/flat/src/main/java/org/jboss/cache/VersionedNode.java
core/branches/flat/src/main/java/org/jboss/cache/eviction/
core/branches/flat/src/main/java/org/jboss/cache/optimistic/
Modified:
core/branches/flat/src/main/java/org/jboss/cache/DataContainerImpl.java
core/branches/flat/src/main/java/org/jboss/cache/DefaultCacheFactory.java
core/branches/flat/src/main/java/org/jboss/cache/InternalNode.java
core/branches/flat/src/main/java/org/jboss/cache/InvocationContext.java
core/branches/flat/src/main/java/org/jboss/cache/NodeFactory.java
core/branches/flat/src/main/java/org/jboss/cache/NodeNotExistsException.java
core/branches/flat/src/main/java/org/jboss/cache/NodeNotValidException.java
core/branches/flat/src/main/java/org/jboss/cache/NodeSPI.java
core/branches/flat/src/main/java/org/jboss/cache/RPCManagerImpl.java
core/branches/flat/src/main/java/org/jboss/cache/Region.java
core/branches/flat/src/main/java/org/jboss/cache/RegionEmptyException.java
core/branches/flat/src/main/java/org/jboss/cache/RegionImpl.java
core/branches/flat/src/main/java/org/jboss/cache/RegionManager.java
core/branches/flat/src/main/java/org/jboss/cache/RegionManagerImpl.java
core/branches/flat/src/main/java/org/jboss/cache/RegionNotEmptyException.java
core/branches/flat/src/main/java/org/jboss/cache/RegionRegistry.java
core/branches/flat/src/main/java/org/jboss/cache/ReplicationException.java
core/branches/flat/src/main/java/org/jboss/cache/SuspectException.java
core/branches/flat/src/main/java/org/jboss/cache/UnversionedNode.java
Log:
Moved stuff
Modified: core/branches/flat/src/main/java/org/jboss/cache/DataContainerImpl.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/DataContainerImpl.java 2008-10-08 16:28:04 UTC (rev 6885)
+++ core/branches/flat/src/main/java/org/jboss/cache/DataContainerImpl.java 2008-10-08 16:29:32 UTC (rev 6886)
@@ -1,37 +1,38 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2000 - 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.
- */
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2000 - 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.cache;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jboss.cache.buddyreplication.BuddyFqnTransformer;
-import org.jboss.cache.config.Configuration;
-import org.jboss.cache.config.Configuration.NodeLockingScheme;
-import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.factories.annotations.NonVolatile;
-import org.jboss.cache.factories.annotations.Start;
-import org.jboss.cache.factories.annotations.Stop;
import org.jboss.cache.lock.LockManager;
import org.jboss.cache.marshall.NodeData;
+import org.jboss.starobrno.CacheException;
+import org.jboss.starobrno.config.Configuration;
+import org.jboss.starobrno.config.Configuration.NodeLockingScheme;
+import org.jboss.starobrno.factories.annotations.Inject;
+import org.jboss.starobrno.factories.annotations.NonVolatile;
+import org.jboss.starobrno.factories.annotations.Start;
+import org.jboss.starobrno.factories.annotations.Stop;
import java.util.ArrayList;
import java.util.Collections;
Modified: core/branches/flat/src/main/java/org/jboss/cache/DefaultCacheFactory.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/DefaultCacheFactory.java 2008-10-08 16:28:04 UTC (rev 6885)
+++ core/branches/flat/src/main/java/org/jboss/cache/DefaultCacheFactory.java 2008-10-08 16:29:32 UTC (rev 6886)
@@ -22,14 +22,13 @@
package org.jboss.cache;
import org.jboss.cache.annotations.Compat;
-import org.jboss.cache.config.Configuration;
-import org.jboss.cache.config.ConfigurationException;
-import org.jboss.cache.config.parsing.XmlConfigurationParser;
-import org.jboss.cache.config.parsing.XmlConfigurationParser2x;
import org.jboss.cache.factories.ComponentFactory;
import org.jboss.cache.factories.ComponentRegistry;
import org.jboss.cache.invocation.CacheInvocationDelegate;
import org.jboss.cache.jmx.PlatformMBeanServerRegistration;
+import org.jboss.starobrno.config.Configuration;
+import org.jboss.starobrno.config.ConfigurationException;
+import org.jboss.starobrno.config.parsing.XmlConfigurationParser;
import java.io.InputStream;
@@ -80,17 +79,7 @@
{
XmlConfigurationParser parser = new XmlConfigurationParser();
Configuration c;
- try
- {
- c = parser.parseFile(configFileName);
- }
- catch (ConfigurationException e)
- {
- XmlConfigurationParser2x oldParser = new XmlConfigurationParser2x();
- c = oldParser.parseFile(configFileName);
- if (c != null)
- log.warn("Detected legacy configuration file format when parsing [" + configFileName + "]. Migrating to the new (3.x) file format is recommended. See FAQs for details.");
- }
+ c = parser.parseFile(configFileName);
return createCache(c, start);
}
@@ -171,17 +160,7 @@
{
XmlConfigurationParser parser = new XmlConfigurationParser();
Configuration c = null;
- try
- {
- c = parser.parseStream(is);
- }
- catch (ConfigurationException e)
- {
- XmlConfigurationParser2x oldParser = new XmlConfigurationParser2x();
- c = oldParser.parseStream(is);
- if (c != null)
- log.warn("Detected legacy configuration file format when parsing configuration file. Migrating to the new (3.x) file format is recommended. See FAQs for details.");
- }
+ c = parser.parseStream(is);
return createCache(c);
}
Modified: core/branches/flat/src/main/java/org/jboss/cache/InternalNode.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/InternalNode.java 2008-10-08 16:28:04 UTC (rev 6885)
+++ core/branches/flat/src/main/java/org/jboss/cache/InternalNode.java 2008-10-08 16:29:32 UTC (rev 6886)
@@ -22,7 +22,6 @@
package org.jboss.cache;
import org.jboss.cache.lock.NodeLock;
-import org.jboss.cache.optimistic.DataVersion;
import org.jboss.cache.transaction.GlobalTransaction;
import java.util.Map;
@@ -203,9 +202,5 @@
CacheSPI<K, V> getCache();
- void setVersion(DataVersion version);
-
- DataVersion getVersion();
-
NodeLock getLock();
}
Modified: core/branches/flat/src/main/java/org/jboss/cache/InvocationContext.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/InvocationContext.java 2008-10-08 16:28:04 UTC (rev 6885)
+++ core/branches/flat/src/main/java/org/jboss/cache/InvocationContext.java 2008-10-08 16:29:32 UTC (rev 6886)
@@ -25,12 +25,12 @@
import org.apache.commons.logging.LogFactory;
import org.jboss.cache.annotations.Compat;
import org.jboss.cache.commands.VisitableCommand;
-import org.jboss.cache.config.Option;
import org.jboss.cache.marshall.MethodCall;
import org.jboss.cache.transaction.GlobalTransaction;
import org.jboss.cache.transaction.TransactionContext;
import org.jboss.cache.transaction.TransactionTable;
import org.jboss.cache.util.Immutables;
+import org.jboss.starobrno.config.Option;
import javax.transaction.Transaction;
import java.util.Collections;
Deleted: core/branches/flat/src/main/java/org/jboss/cache/LegacyRegionManagerImpl.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/LegacyRegionManagerImpl.java 2008-10-08 16:28:04 UTC (rev 6885)
+++ core/branches/flat/src/main/java/org/jboss/cache/LegacyRegionManagerImpl.java 2008-10-08 16:29:32 UTC (rev 6886)
@@ -1,169 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2000 - 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.cache;
-
-import net.jcip.annotations.ThreadSafe;
-import org.jboss.cache.buddyreplication.BuddyManager;
-import static org.jboss.cache.lock.LockType.WRITE;
-
-import java.util.ArrayList;
-import java.util.Set;
-
-/**
- * For optimistic and pessimistically locked caches
- *
- * @author <a href="mailto:manik at jboss.org">Manik Surtani</a>
- * @since 2.0.0
- * @deprecated will be removed along with optimistic and pessimistic locking.
- */
- at ThreadSafe
- at Deprecated
-public class LegacyRegionManagerImpl extends RegionManagerImpl
-{
- /**
- * Causes the cache to stop accepting replication events for the subtree
- * rooted at <code>subtreeFqn</code> and evict all nodes in that subtree.
- * <p/>
- * This is legacy code and should not be called directly. This is a private method for now and will be refactored out.
- * You should be using {@link #activate(Fqn)} and {@link #deactivate(Fqn)}
- * <p/>
- *
- * @param fqn Fqn string indicating the uppermost node in the
- * portion of the cache that should be activated.
- * @throws CacheException if there is a problem evicting nodes
- * @throws IllegalStateException if {@link org.jboss.cache.config.Configuration#isUseRegionBasedMarshalling()} is <code>false</code>
- */
- @Override
- protected void inactivateRegion(Fqn fqn) throws CacheException
- {
- NodeSPI parent = null;
- NodeSPI subtreeRoot = null;
- boolean parentLocked = false;
- boolean subtreeLocked = false;
-
- try
- {
- // Record that this fqn is in status change, so can't provide state
- lock(fqn);
-
- if (!isInactive(fqn))
- {
- deactivate(fqn);
- }
-
- // Create a list with the Fqn in the main cache and any buddy backup trees
- BuddyManager buddyManager = cache.getBuddyManager();
- ArrayList<Fqn> list = new ArrayList<Fqn>();
- list.add(fqn);
-
- if (buddyManager != null)
- {
- Set buddies = cache.peek(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN, false, false).getChildrenNames();
- if (buddies != null)
- {
- for (Object buddy : buddies)
- {
- list.add(buddyFqnTransformer.getBackupFqn((String) buddy, fqn));
- }
- }
- }
-
- long stateFetchTimeout = cache.getConfiguration().getLockAcquisitionTimeout() + 5000;
- // Remove the subtree from the main cache and any buddy backup trees
- for (Fqn subtree : list)
- {
- subtreeRoot = cache.peek(subtree, false);
- if (subtreeRoot != null)
- {
- // Acquire locks
- subtreeLocked = lockManager.lockAll(subtreeRoot, WRITE, getOwnerForLock(), stateFetchTimeout);
-
- // Lock the parent, as we're about to write to it
- parent = subtreeRoot.getParentDirect();
- if (parent != null)
- parentLocked = lockManager.lockAll(parent, WRITE, getOwnerForLock(), stateFetchTimeout);
-
- // Remove the subtree
- cache.evict(subtree, true);
-
- // Release locks
- if (parent != null)
- {
- log.debug("forcing release of locks in parent");
- lockManager.unlockAll(parent);
- }
-
- parentLocked = false;
-
- log.debug("forcing release of all locks in subtree");
- lockManager.unlockAll(subtreeRoot);
- subtreeLocked = false;
- }
- }
- }
- catch (InterruptedException e)
- {
- throw new CacheException(e);
- }
- finally
- {
- // If we didn't succeed, undo the marshalling change
- // NO. Since we inactivated, we may have missed changes
- //if (!success && !inactive)
- // marshaller_.activate(subtreeFqn);
-
- // If necessary, release locks
- if (parentLocked)
- {
- log.debug("forcing release of locks in parent");
- try
- {
- if (parent != null) lockManager.unlockAll(parent);
- }
- catch (Throwable t)
- {
- log.error("failed releasing locks", t);
- }
- }
- if (subtreeLocked)
- {
- log.debug("forcing release of all locks in subtree");
- try
- {
- if (subtreeRoot != null) lockManager.unlockAll(subtreeRoot);
- }
- catch (Throwable t)
- {
- log.error("failed releasing locks", t);
- }
- }
-
- unlock(fqn);
- }
- }
-
- private Object getOwnerForLock()
- {
- Object owner = cache.getCurrentTransaction();
- return owner == null ? Thread.currentThread() : owner;
- }
-}
\ No newline at end of file
Modified: core/branches/flat/src/main/java/org/jboss/cache/NodeFactory.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/NodeFactory.java 2008-10-08 16:28:04 UTC (rev 6885)
+++ core/branches/flat/src/main/java/org/jboss/cache/NodeFactory.java 2008-10-08 16:29:32 UTC (rev 6886)
@@ -22,8 +22,6 @@
package org.jboss.cache;
import org.jboss.cache.mvcc.ReadCommittedNode;
-import org.jboss.cache.optimistic.TransactionWorkspace;
-import org.jboss.cache.optimistic.WorkspaceNode;
import java.util.Map;
@@ -38,8 +36,6 @@
{
ReadCommittedNode createWrappedNode(InternalNode<K, V> node, InternalNode<K, V> parent);
- WorkspaceNode<K, V> createWrappedNode(NodeSPI<K, V> dataNode, TransactionWorkspace workspace);
-
/**
* Creates a new node and populates its attributes.
* <p/>
Modified: core/branches/flat/src/main/java/org/jboss/cache/NodeNotExistsException.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/NodeNotExistsException.java 2008-10-08 16:28:04 UTC (rev 6885)
+++ core/branches/flat/src/main/java/org/jboss/cache/NodeNotExistsException.java 2008-10-08 16:29:32 UTC (rev 6886)
@@ -21,7 +21,9 @@
*/
package org.jboss.cache;
+import org.jboss.starobrno.CacheException;
+
/**
* Thrown when an operation is attempted on a non-existing node in the cache
*
Modified: core/branches/flat/src/main/java/org/jboss/cache/NodeNotValidException.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/NodeNotValidException.java 2008-10-08 16:28:04 UTC (rev 6885)
+++ core/branches/flat/src/main/java/org/jboss/cache/NodeNotValidException.java 2008-10-08 16:29:32 UTC (rev 6886)
@@ -21,6 +21,8 @@
*/
package org.jboss.cache;
+import org.jboss.starobrno.CacheException;
+
/**
* Thrown whenever operations are attempted on a node that is no longer valid. See {@link org.jboss.cache.Node#isValid()}
* for details.
Modified: core/branches/flat/src/main/java/org/jboss/cache/NodeSPI.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/NodeSPI.java 2008-10-08 16:28:04 UTC (rev 6885)
+++ core/branches/flat/src/main/java/org/jboss/cache/NodeSPI.java 2008-10-08 16:29:32 UTC (rev 6886)
@@ -23,7 +23,6 @@
import net.jcip.annotations.NotThreadSafe;
import org.jboss.cache.lock.NodeLock;
-import org.jboss.cache.optimistic.DataVersion;
import org.jboss.cache.transaction.GlobalTransaction;
import java.util.Map;
@@ -191,7 +190,6 @@
* @param version data version to apply
* @throws UnsupportedOperationException if versioning is not supported
*/
- void setVersion(DataVersion version);
/**
* Returns the data version of this node if versioning is supported.
@@ -199,7 +197,6 @@
* @return data version
* @throws UnsupportedOperationException if versioning is not supported
*/
- DataVersion getVersion();
// ------- these XXXDirect() methods work directly on the node and bypass the interceptor chain.
Deleted: core/branches/flat/src/main/java/org/jboss/cache/PessimisticNodeFactory.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/PessimisticNodeFactory.java 2008-10-08 16:28:04 UTC (rev 6885)
+++ core/branches/flat/src/main/java/org/jboss/cache/PessimisticNodeFactory.java 2008-10-08 16:29:32 UTC (rev 6886)
@@ -1,55 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2000 - 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.cache;
-
-import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.lock.LockStrategyFactory;
-
-import java.util.Map;
-
-/**
- * Node factory specific to pessimistic locking.
- *
- * @author Manik Surtani (<a href="mailto:manik at jboss.org">manik at jboss.org</a>)
- * @since 3.0
- * @deprecated will be removed along with optimistic and pessimistic locking.
- */
- at Deprecated
-public class PessimisticNodeFactory<K, V> extends AbstractNodeFactory<K, V>
-{
- private LockStrategyFactory lockStrategyFactory;
-
- @Inject
- private void injectLockStrategyFactory(LockStrategyFactory lockStrategyFactory)
- {
- this.lockStrategyFactory = lockStrategyFactory;
- }
-
- @Override
- protected UnversionedNode<K, V> createInternalNode(Object childName, Fqn fqn, NodeSPI<K, V> parent, Map<K, V> data)
- {
- PessimisticUnversionedNode<K, V> internal = new PessimisticUnversionedNode<K, V>(childName, fqn, data, cache);
- internal.injectDependencies(cache, commandsFactory, this);
- internal.injectLockStrategyFactory(lockStrategyFactory);
- return internal;
- }
-}
Deleted: core/branches/flat/src/main/java/org/jboss/cache/PessimisticUnversionedNode.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/PessimisticUnversionedNode.java 2008-10-08 16:28:04 UTC (rev 6885)
+++ core/branches/flat/src/main/java/org/jboss/cache/PessimisticUnversionedNode.java 2008-10-08 16:29:32 UTC (rev 6886)
@@ -1,445 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2000 - 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.cache;
-
-import static org.jboss.cache.AbstractNode.NodeFlags.VALID;
-import org.jboss.cache.commands.CommandsFactory;
-import org.jboss.cache.commands.legacy.write.CreateNodeCommand;
-import org.jboss.cache.lock.IdentityLock;
-import org.jboss.cache.lock.LockStrategyFactory;
-import org.jboss.cache.marshall.MarshalledValue;
-import org.jboss.cache.transaction.GlobalTransaction;
-import org.jboss.cache.util.FastCopyHashMap;
-import org.jboss.cache.util.Immutables;
-
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ConcurrentMap;
-
-/**
- * UnversionedNode specific to pessimistic locking, with legacy code.
- *
- * @author Manik Surtani (<a href="mailto:manik at jboss.org">manik at jboss.org</a>)
- * @since 3.0
- * @deprecated will be removed along with optimistic and pessimistic locking.
- */
- at SuppressWarnings("deprecation")
- at Deprecated
-public class PessimisticUnversionedNode<K, V> extends UnversionedNode<K, V>
-{
- /**
- * Lock manager that manages locks to be acquired when accessing the node inside a transaction. Lazy set just in case
- * locking is not needed.
- */
- protected transient IdentityLock lock = null;
- protected LockStrategyFactory lockStrategyFactory;
- CommandsFactory commandsFactory;
- protected NodeFactory<K, V> nodeFactory;
-
- public PessimisticUnversionedNode(Object name, Fqn fqn, Map<K, V> data, CacheSPI<K, V> cache)
- {
- super(fqn, cache, false);
- if (!fqn.isRoot() && !name.equals(fqn.getLastElement()))
- throw new IllegalArgumentException("Child " + name + " must be last part of " + fqn);
-
-
- if (data != null && !data.isEmpty())
- setInternalState(data);
- else
- this.data = new FastCopyHashMap<K, V>();
-
- setLockForChildInsertRemove(cache != null && cache.getConfiguration() != null && cache.getConfiguration().isLockParentForChildInsertRemove());
-
-
- }
-
- /**
- * @return a genericized version of the child map.
- */
- @SuppressWarnings("unchecked")
- private ConcurrentMap<Object, Node<K, V>> children()
- {
- return children;
- }
-
- // ------ lock-per-node paradigm
-
- public void injectLockStrategyFactory(LockStrategyFactory lockStrategyFactory)
- {
- this.lockStrategyFactory = lockStrategyFactory;
- }
-
- public void injectDependencies(CacheSPI<K, V> spi, CommandsFactory commandsFactory, NodeFactory<K, V> nodeFactory)
- {
- this.cache = spi;
- this.commandsFactory = commandsFactory;
- this.nodeFactory = nodeFactory;
- }
-
-
- protected synchronized void initLock()
- {
- if (lock == null)
- {
- lock = new IdentityLock(lockStrategyFactory, delegate);
- }
- }
-
- @Override
- public IdentityLock getLock()
- {
- initLock();
- return lock;
- }
-
- @Override
- public String toString()
- {
- StringBuilder sb = new StringBuilder(super.toString());
- if (lock != null)
- {
- if (lock.isReadLocked())
- {
- sb.append(" RL");
- }
- if (lock.isWriteLocked())
- {
- sb.append(" WL");
- }
- }
- return sb.toString();
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public InternalNode<K, V> copy()
- {
- PessimisticUnversionedNode<K, V> n = new PessimisticUnversionedNode<K, V>(fqn.getLastElement(), fqn, data, cache);
- copyInternals(n);
- n.children = children;
- n.lockStrategyFactory = lockStrategyFactory;
- n.commandsFactory = commandsFactory;
- n.nodeFactory = nodeFactory;
- return n;
- }
-
- // ------ legacy addChild methods that used a lot of implicit locks.
-
- @Override
- public void addChildDirect(NodeSPI<K, V> child)
- {
- Fqn childFqn = child.getFqn();
- if (childFqn.isDirectChildOf(fqn))
- {
- synchronized (this)
- {
- children().put(child.getFqn().getLastElement(), child);
- }
- }
- else
- throw new CacheException("Attempting to add a child [" + child.getFqn() + "] to [" + getFqn() + "]. Can only add direct children.");
- }
-
- private NodeSPI<K, V> getOrCreateChild(Object childName, GlobalTransaction gtx, boolean createIfNotExists, boolean notify)
- {
- NodeSPI<K, V> child;
- if (childName == null)
- {
- throw new IllegalArgumentException("null child name");
- }
-
- child = (NodeSPI<K, V>) children().get(childName);
- InvocationContext ctx = cache.getInvocationContext();
- if (createIfNotExists && child == null)
- {
- // construct the new child outside the synchronized block to avoid
- // spending any more time than necessary in the synchronized section
- Fqn childFqn = Fqn.fromRelativeElements(fqn, childName);
- NodeSPI<K, V> newChild = nodeFactory.createNode(childFqn, delegate);
- if (newChild == null)
- {
- throw new IllegalStateException();
- }
- synchronized (this)
- {
- // check again to see if the child exists
- // after acquiring exclusive lock
- child = (NodeSPI<K, V>) children().get(childName);
- if (child == null)
- {
- if (notify) cache.getNotifier().notifyNodeCreated(childFqn, true, ctx);
- child = newChild;
- children().put(childName, child);
- }
- }
-
- // notify if we actually created a new child
- if (newChild == child)
- {
- if (trace) log.trace("created child: fqn=" + childFqn);
-
- if (gtx != null)
- {
- CreateNodeCommand createNodeCommand = commandsFactory.buildCreateNodeCommand(childFqn);
- ctx.getTransactionContext().addLocalModification(createNodeCommand);
- }
- if (notify) cache.getNotifier().notifyNodeCreated(childFqn, false, ctx);
- }
- }
- return child;
- }
-
- @Override
- public NodeSPI<K, V> addChildDirect(Fqn f, boolean notify)
- {
- if (f.size() == 1)
- {
- GlobalTransaction gtx = cache.getInvocationContext().getGlobalTransaction();
- return getOrCreateChild(f.getLastElement(), gtx, true, notify);
- }
- else
- {
- throw new UnsupportedOperationException("Cannot directly create children which aren't directly under the current node.");
- }
- }
-
- @Override
- public NodeSPI<K, V> addChildDirect(Object o, boolean notify)
- {
- GlobalTransaction gtx = cache.getInvocationContext().getGlobalTransaction();
- return getOrCreateChild(o, gtx, true, notify);
- }
-
- @Override
- public NodeSPI<K, V> getChildDirect(Fqn fqn)
- {
- if (fqn.size() == 1)
- {
- return getChildDirect(fqn.getLastElement());
- }
- else
- {
- NodeSPI<K, V> currentNode = delegate;
- for (int i = 0; i < fqn.size(); i++)
- {
- Object nextChildName = fqn.get(i);
- currentNode = currentNode.getChildDirect(nextChildName);
- if (currentNode == null) return null;
- }
- return currentNode;
- }
- }
-
- @Override
- public NodeSPI<K, V> getChildDirect(Object childName)
- {
- if (childName == null) return null;
- return (NodeSPI<K, V>) children().get(childName);
- }
-
- @Override
- public Set<NodeSPI<K, V>> getChildrenDirect()
- {
- // strip out deleted child nodes...
- if (children == null || children.size() == 0) return Collections.emptySet();
-
- Set<NodeSPI<K, V>> exclDeleted = new HashSet<NodeSPI<K, V>>();
- for (Node<K, V> n : children().values())
- {
- NodeSPI<K, V> spi = (NodeSPI<K, V>) n;
- if (!spi.isDeleted()) exclDeleted.add(spi);
- }
- exclDeleted = Collections.unmodifiableSet(exclDeleted);
- return exclDeleted;
- }
-
- @Override
- public Map<Object, Node<K, V>> getChildrenMapDirect()
- {
- return children();
- }
-
- @Override
- public void setChildrenMapDirect(Map<Object, Node<K, V>> children)
- {
- if (children == null)
- this.children = null;
- else
- {
- this.children.clear();
- this.children().putAll(children);
- }
- }
-
- @Override
- public void addChildDirect(Object nodeName, Node<K, V> nodeToAdd)
- {
- if (nodeName != null)
- {
- children().put(nodeName, nodeToAdd);
- }
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public Set<NodeSPI<K, V>> getChildrenDirect(boolean includeMarkedForRemoval)
- {
- if (includeMarkedForRemoval)
- {
- if (children != null && !children.isEmpty())
- {
- return Immutables.immutableSetConvert(children.values());
- }
- else
- {
- return Collections.emptySet();
- }
- }
- else
- {
- return getChildrenDirect();
- }
- }
-
- @Override
- public NodeSPI<K, V> addChildDirect(Fqn f)
- {
- return addChildDirect(f, true);
- }
-
- @Override
- public NodeSPI<K, V> getOrCreateChild(Object childName, GlobalTransaction gtx)
- {
- return getOrCreateChild(childName, gtx, true, true);
- }
-
- @Override
- public void markAsRemoved(boolean marker, boolean recursive)
- {
- setFlag(NodeFlags.REMOVED, marker);
-
- if (recursive && children != null)
- {
- synchronized (this)
- {
- for (Node<?, ?> child : children().values())
- {
- ((NodeSPI) child).markAsDeleted(marker, true);
- }
- }
- }
- }
-
- @Override
- public void setValid(boolean valid, boolean recursive)
- {
- setFlag(VALID, valid);
-
- if (trace) log.trace("Marking node " + getFqn() + " as " + (valid ? "" : "in") + "valid");
- if (recursive)
- {
- for (Node<K, V> child : children().values())
- {
- ((NodeSPI<K, V>) child).setValid(valid, recursive);
- }
- }
- }
-
- /**
- * Adds details of the node into a map as strings.
- */
- @Override
- protected void printDetailsInMap(StringBuilder sb, int indent)
- {
- printIndent(sb, indent);
- indent += 2;// increse it
- sb.append(Fqn.SEPARATOR);
- if (!fqn.isRoot()) sb.append(fqn.getLastElement());
- sb.append(" ");
- sb.append(data);
- for (Node n : children().values())
- {
- sb.append("\n");
- ((NodeSPI) n).printDetails(sb, indent);
- }
- }
-
-
- @Override
- public void setFqn(Fqn fqn)
- {
- if (trace)
- {
- log.trace(getFqn() + " set FQN " + fqn);
- }
- this.fqn = fqn;
-
- if (children == null)
- {
- return;
- }
-
- // invoke children
- for (Map.Entry<Object, ? extends Node<K, V>> me : children().entrySet())
- {
- NodeSPI<K, V> n = (NodeSPI<K, V>) me.getValue();
- Fqn cfqn = Fqn.fromRelativeElements(fqn, me.getKey());
- n.setFqn(cfqn);
- }
- }
-
- @Override
- public void releaseObjectReferences(boolean recursive)
- {
- if (recursive && children != null)
- {
- for (Node<K, V> child : children().values())
- {
- child.releaseObjectReferences(recursive);
- }
- }
-
- if (data != null)
- {
- for (K key : data.keySet())
- {
- // get the key first, before attempting to serialize stuff since data.get() may deserialize the key if doing
- // a hashcode() or equals().
-
- Object value = data.get(key);
- if (key instanceof MarshalledValue)
- {
- ((MarshalledValue) key).compact(true, true);
- }
-
- if (value instanceof MarshalledValue)
- {
- ((MarshalledValue) value).compact(true, true);
- }
-
- }
- }
- }
-
-}
Modified: core/branches/flat/src/main/java/org/jboss/cache/RPCManagerImpl.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/RPCManagerImpl.java 2008-10-08 16:28:04 UTC (rev 6885)
+++ core/branches/flat/src/main/java/org/jboss/cache/RPCManagerImpl.java 2008-10-08 16:29:32 UTC (rev 6886)
@@ -24,13 +24,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jboss.cache.commands.ReplicableCommand;
-import org.jboss.cache.config.Configuration;
-import org.jboss.cache.config.Configuration.NodeLockingScheme;
-import org.jboss.cache.config.RuntimeConfig;
import org.jboss.cache.factories.ComponentRegistry;
-import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.factories.annotations.Start;
-import org.jboss.cache.factories.annotations.Stop;
import org.jboss.cache.interceptors.InterceptorChain;
import org.jboss.cache.invocation.InvocationContextContainer;
import org.jboss.cache.jmx.annotations.MBean;
@@ -49,6 +43,12 @@
import org.jboss.cache.transaction.TransactionTable;
import org.jboss.cache.util.concurrent.ReclosableLatch;
import org.jboss.cache.util.reflect.ReflectionUtil;
+import org.jboss.starobrno.CacheException;
+import org.jboss.starobrno.config.Configuration;
+import org.jboss.starobrno.config.RuntimeConfig;
+import org.jboss.starobrno.factories.annotations.Inject;
+import org.jboss.starobrno.factories.annotations.Start;
+import org.jboss.starobrno.factories.annotations.Stop;
import org.jgroups.Address;
import org.jgroups.Channel;
import org.jgroups.ChannelException;
@@ -659,16 +659,7 @@
NodeSPI root = spi.getRoot();
if (root != null)
{
- // UGH!!! What a shameless hack!
- if (configuration.getNodeLockingScheme() == NodeLockingScheme.MVCC)
- {
-
- removeLocksForDeadMembers(root.getDelegationTarget(), removed);
- }
- else
- {
- removeLocksForDeadMembers(root, removed);
- }
+ removeLocksForDeadMembers(root.getDelegationTarget(), removed);
}
}
Modified: core/branches/flat/src/main/java/org/jboss/cache/Region.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/Region.java 2008-10-08 16:28:04 UTC (rev 6885)
+++ core/branches/flat/src/main/java/org/jboss/cache/Region.java 2008-10-08 16:29:32 UTC (rev 6886)
@@ -22,12 +22,9 @@
package org.jboss.cache;
import org.jboss.cache.annotations.Compat;
-import org.jboss.cache.config.Configuration;
-import org.jboss.cache.config.EvictionPolicyConfig;
-import org.jboss.cache.config.EvictionRegionConfig;
-import org.jboss.cache.eviction.EvictedEventNode;
-import org.jboss.cache.eviction.EvictionEvent;
-import org.jboss.cache.eviction.EvictionPolicy;
+import org.jboss.starobrno.config.Configuration;
+import org.jboss.starobrno.config.EvictionRegionConfig;
+import org.jboss.starobrno.eviction.EvictionEvent;
/**
* Defines characteristics such as class loading and eviction of {@link org.jboss.cache.Node}s belonging to a Region in a {@link Cache}.
@@ -157,19 +154,19 @@
* Registers an eviction event on the region's eviction event queue for later processing by
* {@link #processEvictionQueues()}.
*
- * @param fqn passed in to the constructor of {@link org.jboss.cache.eviction.EvictionEvent}
- * @param eventType passed in to the constructor of {@link org.jboss.cache.eviction.EvictionEvent}
- * @param elementDifference passed in to the constructor of {@link org.jboss.cache.eviction.EvictionEvent}
+ * @param fqn passed in to the constructor of {@link org.jboss.starobrno.eviction.EvictionEvent}
+ * @param eventType passed in to the constructor of {@link org.jboss.starobrno.eviction.EvictionEvent}
+ * @param elementDifference passed in to the constructor of {@link org.jboss.starobrno.eviction.EvictionEvent}
* @return an EvictedEventNode that has been created for this queue
*/
- EvictionEvent registerEvictionEvent(Fqn fqn, EvictionEvent.Type eventType, int elementDifference);
+ org.jboss.starobrno.eviction.EvictionEvent registerEvictionEvent(Fqn fqn, EvictionEvent.Type eventType, int elementDifference);
/**
- * An overloaded version of {@link #registerEvictionEvent(Fqn, org.jboss.cache.eviction.EvictionEvent.Type, int)} which
+ * An overloaded version of {@link #registerEvictionEvent(Fqn, org.jboss.starobrno.eviction.EvictionEvent.Type, int)} which
* uses a default elementDifference value.
*
- * @param fqn passed in to the constructor of {@link org.jboss.cache.eviction.EvictionEvent}
- * @param eventType passed in to the constructor of {@link org.jboss.cache.eviction.EvictionEvent}
+ * @param fqn passed in to the constructor of {@link org.jboss.starobrno.eviction.EvictionEvent}
+ * @param eventType passed in to the constructor of {@link org.jboss.starobrno.eviction.EvictionEvent}
* @return an EvictedEventNode that has been created for this queue
*/
EvictionEvent registerEvictionEvent(Fqn fqn, EvictionEvent.Type eventType);
@@ -177,7 +174,7 @@
/**
* Marks a {@link org.jboss.cache.Node} as currently in use, by adding an event to the eviction queue.
* If there is an {@link org.jboss.cache.config.EvictionRegionConfig} associated with this region, and
- * it respects this event (e.g., {@link org.jboss.cache.eviction.LRUAlgorithm} does), then the {@link org.jboss.cache.Node} will not
+ * it respects this event (e.g., {@link org.jboss.starobrno.eviction.LRUAlgorithm} does), then the {@link org.jboss.cache.Node} will not
* be evicted until {@link #unmarkNodeCurrentlyInUse(Fqn)} is invoked.
* <p/>
* This mechanism can be used to prevent eviction of data that the application
@@ -225,107 +222,4 @@
* @return a new Region instance.
*/
Region copy(Fqn newRoot);
-
- // -------- deprecated interfaces retained for compatibility with 2.x. -----------
-
-
- /**
- * Configures an eviction policy for this region.
- * <p/>
- * <b>Note:</b> This is deprecated since this is an internal method and never was
- * meant to be a part of the public API. Please do not treat this as public API, it may be removed in a future release
- * and its functionality is not guaranteed.
- * <p/>
- *
- * @param evictionPolicyConfig configuration to set
- * @deprecated
- */
- @Deprecated
- @Compat
- void setEvictionPolicy(EvictionPolicyConfig evictionPolicyConfig);
-
- /**
- * Returns an eviction policy configuration.
- * <p/>
- * <b>Note:</b> This is deprecated since this is an internal method and never was
- * meant to be a part of the public API. Please do not treat this as public API, it may be removed in a future release
- * and its functionality is not guaranteed.
- * <p/>
- *
- * @return an eviction policy configuration
- * @deprecated
- */
- @Deprecated
- @Compat
- EvictionPolicyConfig getEvictionPolicyConfig();
-
- /**
- * Returns an eviction policy.
- * <p/>
- * <b>Note:</b> This is deprecated since this is an internal method and never was
- * meant to be a part of the public API. Please do not treat this as public API, it may be removed in a future release
- * and its functionality is not guaranteed.
- * <p/>
- *
- * @return an eviction policy
- * @deprecated
- */
- @Deprecated
- @Compat
- EvictionPolicy getEvictionPolicy();
-
- /**
- * Returns the size of the node event queue, used by the eviction thread.
- * <p/>
- * <b>Note:</b> This is deprecated since this is an internal method and never was
- * meant to be a part of the public API. Please do not treat this as public API, it may be removed in a future release
- * and its functionality is not guaranteed.
- * <p/>
- *
- * @return number of events
- * @deprecated
- */
- @Deprecated
- @Compat
- int nodeEventQueueSize();
-
- /**
- * Returns the most recent {@link org.jboss.cache.eviction.EvictedEventNode} added to the event queue by
- * {@link #putNodeEvent(org.jboss.cache.eviction.EvictedEventNode)}.
- * <p/>
- * <b>Note:</b> This is deprecated since this is an internal method and never was
- * meant to be a part of the public API. Please do not treat this as public API, it may be removed in a future release
- * and its functionality is not guaranteed.
- * <p/>
- *
- * @return the last {@link org.jboss.cache.eviction.EvictedEventNode}, or null if no more events exist
- * @deprecated
- */
- @Compat
- @Deprecated
- EvictedEventNode takeLastEventNode();
-
- /**
- * Adds an {@link org.jboss.cache.eviction.EvictedEventNode} to the internal queue for processing
- * by the eviction thread.
- * <p/>
- * <b>Note:</b> This is deprecated since this is an internal method and never was
- * meant to be a part of the public API. Please do not treat this as public API, it may be removed in a future release
- * and its functionality is not guaranteed.
- * <p/>
- *
- * @param event event to add
- * @deprecated
- */
- @Deprecated
- @Compat
- void putNodeEvent(EvictedEventNode event);
-
- /**
- * @return a clone
- * @deprecated
- */
- @Deprecated
- @Compat
- Region clone() throws CloneNotSupportedException;
}
Modified: core/branches/flat/src/main/java/org/jboss/cache/RegionEmptyException.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/RegionEmptyException.java 2008-10-08 16:28:04 UTC (rev 6885)
+++ core/branches/flat/src/main/java/org/jboss/cache/RegionEmptyException.java 2008-10-08 16:29:32 UTC (rev 6886)
@@ -21,6 +21,8 @@
*/
package org.jboss.cache;
+import org.jboss.starobrno.CacheException;
+
/**
* Exception to represent a region being empty when state was expected in that region.
*
Modified: core/branches/flat/src/main/java/org/jboss/cache/RegionImpl.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/RegionImpl.java 2008-10-08 16:28:04 UTC (rev 6885)
+++ core/branches/flat/src/main/java/org/jboss/cache/RegionImpl.java 2008-10-08 16:29:32 UTC (rev 6886)
@@ -23,21 +23,15 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.annotations.Compat;
-import org.jboss.cache.config.Configuration;
-import org.jboss.cache.config.EvictionAlgorithmConfig;
-import org.jboss.cache.config.EvictionPolicyConfig;
-import org.jboss.cache.config.EvictionRegionConfig;
-import org.jboss.cache.eviction.EvictedEventNode;
-import org.jboss.cache.eviction.EvictionActionPolicy;
-import org.jboss.cache.eviction.EvictionAlgorithm;
-import org.jboss.cache.eviction.EvictionEvent;
-import org.jboss.cache.eviction.EvictionPolicy;
import org.jboss.cache.util.Util;
+import org.jboss.starobrno.config.Configuration;
+import org.jboss.starobrno.config.EvictionAlgorithmConfig;
+import org.jboss.starobrno.config.EvictionRegionConfig;
+import org.jboss.starobrno.eviction.EvictionActionPolicy;
+import org.jboss.starobrno.eviction.EvictionEvent;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
-import java.util.concurrent.TimeUnit;
/**
* Default implementation of a {@link Region}
@@ -55,7 +49,7 @@
private BlockingQueue<EvictionEvent> evictionEventQueue = null;
private int capacityWarnThreshold = 0;
private EvictionRegionConfig evictionRegionConfig;
- private EvictionAlgorithm evictionAlgorithm;
+ private org.jboss.starobrno.eviction.EvictionAlgorithm evictionAlgorithm;
/**
@@ -230,7 +224,7 @@
{
if (evictionAlgorithm.canIgnoreEvent(eventType)) return null;
- EvictionEvent event = new EvictionEvent(fqn, eventType, elementDifference);
+ org.jboss.starobrno.eviction.EvictionEvent event = new EvictionEvent(fqn, eventType, elementDifference);
registerEvictionEvent(event);
return event;
}
@@ -275,7 +269,7 @@
}
}
- private EvictionAlgorithm createEvictionAlgorithm(EvictionAlgorithmConfig algoConfig, String evictionActionPolicyClass)
+ private org.jboss.starobrno.eviction.EvictionAlgorithm createEvictionAlgorithm(EvictionAlgorithmConfig algoConfig, String evictionActionPolicyClass)
{
if (algoConfig == null)
throw new IllegalArgumentException("Eviction algorithm class must not be null!");
@@ -290,7 +284,7 @@
actionPolicy.setCache(regionManager.getCache());
if (trace) log.trace("Instantiating " + algoConfig.getEvictionAlgorithmClassName());
- EvictionAlgorithm algorithm = (EvictionAlgorithm) Util.getInstance(algoConfig.getEvictionAlgorithmClassName());
+ org.jboss.starobrno.eviction.EvictionAlgorithm algorithm = (org.jboss.starobrno.eviction.EvictionAlgorithm) Util.getInstance(algoConfig.getEvictionAlgorithmClassName());
algorithm.setEvictionActionPolicy(actionPolicy);
algorithm.assignToRegion(fqn, regionManager.getCache(), algoConfig, regionManager.getConfiguration());
return algorithm;
@@ -315,70 +309,4 @@
}
return clone;
}
-
- @Deprecated
- @Compat
- @SuppressWarnings("deprecation")
- public void setEvictionPolicy(EvictionPolicyConfig evictionPolicyConfig)
- {
- //TODO: Autogenerated. Implement me properly
- }
-
- @Deprecated
- @Compat
- @SuppressWarnings("deprecation")
- public EvictionPolicyConfig getEvictionPolicyConfig()
- {
- return null; //TODO: Autogenerated. Implement me properly
- }
-
- @Deprecated
- @Compat
- @SuppressWarnings("deprecation")
- public EvictionPolicy getEvictionPolicy()
- {
- return null; //TODO: Autogenerated. Implement me properly
- }
-
- @Deprecated
- @Compat
- public int nodeEventQueueSize()
- {
- BlockingQueue<?> q = getEvictionEventQueue();
- return q == null ? 0 : q.size();
- }
-
- @Compat
- @Deprecated
- @SuppressWarnings("deprecation")
- public EvictedEventNode takeLastEventNode()
- {
- try
- {
- EvictionEvent ee = getEvictionEventQueue().poll(0, TimeUnit.SECONDS);
- if (ee instanceof EvictedEventNode) return (EvictedEventNode) ee;
- else return new EvictedEventNode(ee);
- }
- catch (InterruptedException e)
- {
- log.debug("trace", e);
- }
- return null;
-
- }
-
- @Deprecated
- @Compat
- @SuppressWarnings("deprecation")
- public void putNodeEvent(EvictedEventNode event)
- {
- this.registerEvictionEvent(event);
- }
-
- @Deprecated
- @Compat
- public Region clone() throws CloneNotSupportedException
- {
- return (Region) super.clone();
- }
}
Modified: core/branches/flat/src/main/java/org/jboss/cache/RegionManager.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/RegionManager.java 2008-10-08 16:28:04 UTC (rev 6885)
+++ core/branches/flat/src/main/java/org/jboss/cache/RegionManager.java 2008-10-08 16:29:32 UTC (rev 6886)
@@ -22,9 +22,8 @@
package org.jboss.cache;
import org.jboss.cache.annotations.Compat;
-import org.jboss.cache.config.Configuration;
-import org.jboss.cache.config.EvictionConfig;
-import org.jboss.cache.eviction.EvictionTimerTask;
+import org.jboss.starobrno.config.Configuration;
+import org.jboss.starobrno.config.EvictionConfig;
import java.util.List;
@@ -198,7 +197,7 @@
/**
* @return the eviction timer task attached to the region manager
*/
- EvictionTimerTask getEvictionTimerTask();
+ org.jboss.starobrno.eviction.EvictionTimerTask getEvictionTimerTask();
/**
* @return the configuration
Modified: core/branches/flat/src/main/java/org/jboss/cache/RegionManagerImpl.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/RegionManagerImpl.java 2008-10-08 16:28:04 UTC (rev 6885)
+++ core/branches/flat/src/main/java/org/jboss/cache/RegionManagerImpl.java 2008-10-08 16:29:32 UTC (rev 6886)
@@ -27,18 +27,18 @@
import static org.jboss.cache.Region.Type.*;
import org.jboss.cache.buddyreplication.BuddyFqnTransformer;
import org.jboss.cache.buddyreplication.BuddyManager;
-import org.jboss.cache.config.Configuration;
-import org.jboss.cache.config.ConfigurationException;
-import org.jboss.cache.config.EvictionConfig;
-import org.jboss.cache.config.EvictionRegionConfig;
-import org.jboss.cache.eviction.EvictionTimerTask;
-import org.jboss.cache.factories.annotations.Destroy;
-import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.factories.annotations.Start;
-import org.jboss.cache.factories.annotations.Stop;
import org.jboss.cache.lock.LockManager;
import org.jboss.cache.util.concurrent.locks.LockContainer;
import org.jboss.cache.util.concurrent.locks.ReentrantLockContainer;
+import org.jboss.starobrno.CacheException;
+import org.jboss.starobrno.config.Configuration;
+import org.jboss.starobrno.config.ConfigurationException;
+import org.jboss.starobrno.config.EvictionConfig;
+import org.jboss.starobrno.config.EvictionRegionConfig;
+import org.jboss.starobrno.factories.annotations.Destroy;
+import org.jboss.starobrno.factories.annotations.Inject;
+import org.jboss.starobrno.factories.annotations.Start;
+import org.jboss.starobrno.factories.annotations.Stop;
import org.jgroups.Address;
import java.util.ArrayList;
@@ -69,7 +69,7 @@
CacheSPI<?, ?> cache;
private boolean usingEvictions;
private EvictionConfig evictionConfig;
- private final EvictionTimerTask evictionTimerTask = new EvictionTimerTask();
+ private final org.jboss.starobrno.eviction.EvictionTimerTask evictionTimerTask = new org.jboss.starobrno.eviction.EvictionTimerTask();
private final LockContainer<Fqn> regionLocks = new ReentrantLockContainer<Fqn>(4);
protected Configuration configuration;
@@ -295,7 +295,7 @@
return true;
}
- public EvictionTimerTask getEvictionTimerTask()
+ public org.jboss.starobrno.eviction.EvictionTimerTask getEvictionTimerTask()
{
return evictionTimerTask;
}
Modified: core/branches/flat/src/main/java/org/jboss/cache/RegionNotEmptyException.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/RegionNotEmptyException.java 2008-10-08 16:28:04 UTC (rev 6885)
+++ core/branches/flat/src/main/java/org/jboss/cache/RegionNotEmptyException.java 2008-10-08 16:29:32 UTC (rev 6886)
@@ -21,6 +21,8 @@
*/
package org.jboss.cache;
+import org.jboss.starobrno.CacheException;
+
/**
* Thrown when an attempt is made to {@link RegionManager#activate(Fqn)} activate a subtree}
* root in Fqn that already has an existing node in the cache.
Modified: core/branches/flat/src/main/java/org/jboss/cache/RegionRegistry.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/RegionRegistry.java 2008-10-08 16:28:04 UTC (rev 6885)
+++ core/branches/flat/src/main/java/org/jboss/cache/RegionRegistry.java 2008-10-08 16:29:32 UTC (rev 6886)
@@ -21,7 +21,7 @@
*/
package org.jboss.cache;
-import org.jboss.cache.factories.annotations.NonVolatile;
+import org.jboss.starobrno.factories.annotations.NonVolatile;
import java.util.concurrent.ConcurrentHashMap;
Modified: core/branches/flat/src/main/java/org/jboss/cache/ReplicationException.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/ReplicationException.java 2008-10-08 16:28:04 UTC (rev 6885)
+++ core/branches/flat/src/main/java/org/jboss/cache/ReplicationException.java 2008-10-08 16:29:32 UTC (rev 6886)
@@ -21,6 +21,8 @@
*/
package org.jboss.cache;
+import org.jboss.starobrno.CacheException;
+
/**
* Thrown when a replication problem occurred
*/
Modified: core/branches/flat/src/main/java/org/jboss/cache/SuspectException.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/SuspectException.java 2008-10-08 16:28:04 UTC (rev 6885)
+++ core/branches/flat/src/main/java/org/jboss/cache/SuspectException.java 2008-10-08 16:29:32 UTC (rev 6886)
@@ -21,6 +21,8 @@
*/
package org.jboss.cache;
+import org.jboss.starobrno.CacheException;
+
/**
* Thrown when a member is suspected during remote method invocation
*
Modified: core/branches/flat/src/main/java/org/jboss/cache/UnversionedNode.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/UnversionedNode.java 2008-10-08 16:28:04 UTC (rev 6885)
+++ core/branches/flat/src/main/java/org/jboss/cache/UnversionedNode.java 2008-10-08 16:29:32 UTC (rev 6886)
@@ -28,6 +28,7 @@
import org.jboss.cache.util.FastCopyHashMap;
import org.jboss.cache.util.Immutables;
import org.jboss.cache.util.concurrent.SelfInitializingConcurrentHashMap;
+import org.jboss.starobrno.CacheException;
import java.util.Collections;
import java.util.HashMap;
@@ -332,11 +333,6 @@
sb.append("[ ").append(fqn);
}
- if (this instanceof VersionedNode)
- {
- sb.append(" version=").append(this.getVersion());
- }
-
if (data != null)
{
if (trace)
@@ -461,7 +457,7 @@
{
// replace key!
Entry<? extends K, ? extends V> e = data.entrySet().iterator().next();
- this.data = Collections.singletonMap((K)e.getKey(), (V)e.getValue());
+ this.data = Collections.singletonMap((K) e.getKey(), (V) e.getValue());
}
else
{
Deleted: core/branches/flat/src/main/java/org/jboss/cache/VersionedNode.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/VersionedNode.java 2008-10-08 16:28:04 UTC (rev 6885)
+++ core/branches/flat/src/main/java/org/jboss/cache/VersionedNode.java 2008-10-08 16:29:32 UTC (rev 6886)
@@ -1,136 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2000 - 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.cache;
-
-import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.lock.IdentityLock;
-import org.jboss.cache.optimistic.DataVersion;
-import org.jboss.cache.optimistic.DefaultDataVersion;
-
-import java.util.Map;
-
-/**
- * VersionedNode extends the {@link org.jboss.cache.UnversionedNode} by adding a {@link org.jboss.cache.optimistic.DataVersion} property.
- * <p/>
- * Unlike {@link org.jboss.cache.UnversionedNode}, this node supports {@link #getVersion} and {@link #setVersion(org.jboss.cache.optimistic.DataVersion)}
- * defined in {@link org.jboss.cache.NodeSPI}
- * <p/>
- * Typically used when the cache mode configured is {@link org.jboss.cache.config.Configuration.NodeLockingScheme#OPTIMISTIC}
- *
- * @author <a href="mailto:manik at jboss.org">Manik Surtani (manik at jboss.org)</a>
- * @since 2.0.0
- * @deprecated will be removed along with optimistic and pessimistic locking.
- */
- at Deprecated
-public class VersionedNode<K, V> extends PessimisticUnversionedNode<K, V>
-{
- private static final String DATA_VERSION_INTERNAL_KEY = "_JBOSS_INTERNAL_OPTIMISTIC_DATA_VERSION";
- private DataVersion version; // make sure this is NOT initialized to anything, even a null! Since the UnversionedNode constructor may set this value based on a data version passed along in the data map.
-
- static
- {
- log = LogFactory.getLog(VersionedNode.class);
- }
-
- /**
- * Although this object has a reference to the CacheImpl, the optimistic
- * node is actually disconnected from the CacheImpl itself.
- * The parent could be looked up from the TransactionWorkspace.
- */
- private NodeSPI<K, V> parent;
-
- public VersionedNode(Fqn fqn, NodeSPI<K, V> parent, Map<K, V> data, CacheSPI<K, V> cache)
- {
- super(fqn.getLastElement(), fqn, data, cache);
- if (parent == null && !fqn.isRoot()) throw new NullPointerException("parent");
- if (version == null) version = DefaultDataVersion.ZERO;
- this.parent = parent;
- }
-
- /**
- * Returns the version id of this node.
- *
- * @return the version
- */
- @Override
- public DataVersion getVersion()
- {
- return version;
- }
-
- /**
- * Returns the parent.
- */
- @Override
- public NodeSPI<K, V> getParent()
- {
- return parent;
- }
-
- /**
- * Sets the version id of this node.
- *
- * @param version
- */
- @Override
- public void setVersion(DataVersion version)
- {
- this.version = version;
- }
-
- /**
- * Optimistically locked nodes (VersionedNodes) will always use repeatable read.
- */
- @Override
- protected synchronized void initLock()
- {
- if (lock == null) lock = new IdentityLock(lockStrategyFactory, delegate);
- }
-
- @Override
- public Map getInternalState(boolean onlyInternalState)
- {
- Map state = super.getInternalState(onlyInternalState);
- state.put(DATA_VERSION_INTERNAL_KEY, version);
- return state;
- }
-
- @Override
- public void setInternalState(Map state)
- {
- if (state != null)
- {
- DataVersion dv = (DataVersion) state.remove(DATA_VERSION_INTERNAL_KEY);
- if (dv != null) version = dv;
- }
- super.setInternalState(state);
- }
-
- @Override
- public VersionedNode copy()
- {
- VersionedNode n = new VersionedNode(fqn, getParent(), data, cache);
- copyInternals(n);
- n.version = version;
- return n;
- }
-}
More information about the jbosscache-commits
mailing list