Author: manik.surtani(a)jboss.com
Date: 2008-10-10 11:25:26 -0400 (Fri, 10 Oct 2008)
New Revision: 6903
Added:
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/IncorrectCacheListenerException.java
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/annotation/
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/annotation/BuddyGroupChanged.java
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/annotation/CacheEntryActivated.java
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/annotation/CacheEntryCreated.java
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/annotation/CacheEntryEvicted.java
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/annotation/CacheEntryInvalidated.java
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/annotation/CacheEntryLoaded.java
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/annotation/CacheEntryModified.java
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/annotation/CacheEntryPassivated.java
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/annotation/CacheEntryRemoved.java
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/annotation/CacheEntryVisited.java
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/annotation/CacheListener.java
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/annotation/CacheStarted.java
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/annotation/CacheStopped.java
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/annotation/TransactionCompleted.java
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/annotation/TransactionRegistered.java
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/annotation/ViewChanged.java
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/event/BuddyGroupChangedEvent.java
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/event/CacheEntryActivatedEvent.java
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/event/CacheEntryCreatedEvent.java
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/event/CacheEntryEvent.java
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/event/CacheEntryEvictedEvent.java
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/event/CacheEntryInvalidatedEvent.java
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/event/CacheEntryLoadedEvent.java
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/event/CacheEntryModifiedEvent.java
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/event/CacheEntryPassivatedEvent.java
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/event/CacheEntryRemovedEvent.java
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/event/CacheEntryVisitedEvent.java
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/event/CacheStartedEvent.java
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/event/CacheStoppedEvent.java
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/event/Event.java
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/event/EventImpl.java
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/event/TransactionCompletedEvent.java
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/event/TransactionRegisteredEvent.java
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/event/TransactionalEvent.java
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/event/ViewChangedEvent.java
core/branches/flat/src/test/java/org/jboss/starobrno/notifications/
Removed:
core/branches/flat/src/main/java/org/jboss/cache/ConsoleListener.java
core/branches/flat/src/main/java/org/jboss/cache/notifications/
Modified:
core/branches/flat/src/main/java/org/jboss/cache/CacheSPI_Legacy.java
core/branches/flat/src/main/java/org/jboss/cache/RPCManagerImpl.java
core/branches/flat/src/main/java/org/jboss/cache/buddyreplication/BuddyManager.java
core/branches/flat/src/main/java/org/jboss/cache/commands/CommandsFactoryImpl.java
core/branches/flat/src/main/java/org/jboss/cache/commands/read/GetKeyValueCommand.java
core/branches/flat/src/main/java/org/jboss/cache/commands/write/AbstractVersionedDataCommand.java
core/branches/flat/src/main/java/org/jboss/cache/commands/write/ClearDataCommand.java
core/branches/flat/src/main/java/org/jboss/cache/commands/write/EvictCommand.java
core/branches/flat/src/main/java/org/jboss/cache/commands/write/InvalidateCommand.java
core/branches/flat/src/main/java/org/jboss/cache/commands/write/MoveCommand.java
core/branches/flat/src/main/java/org/jboss/cache/commands/write/PutDataMapCommand.java
core/branches/flat/src/main/java/org/jboss/cache/commands/write/PutKeyValueCommand.java
core/branches/flat/src/main/java/org/jboss/cache/commands/write/RemoveKeyCommand.java
core/branches/flat/src/main/java/org/jboss/cache/commands/write/RemoveNodeCommand.java
core/branches/flat/src/main/java/org/jboss/cache/interceptors/ActivationInterceptor.java
core/branches/flat/src/main/java/org/jboss/cache/interceptors/CacheLoaderInterceptor.java
core/branches/flat/src/main/java/org/jboss/cache/interceptors/PassivationInterceptor.java
core/branches/flat/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java
core/branches/flat/src/main/java/org/jboss/cache/jmx/CacheNotificationBroadcaster.java
core/branches/flat/src/main/java/org/jboss/cache/jmx/CacheNotificationListener.java
core/branches/flat/src/main/java/org/jboss/cache/loader/SingletonStoreCacheLoader.java
core/branches/flat/src/main/java/org/jboss/cache/statetransfer/DefaultStateTransferIntegrator.java
core/branches/flat/src/main/java/org/jboss/starobrno/commands/CommandsFactoryImpl.java
core/branches/flat/src/main/java/org/jboss/starobrno/commands/ReplicableCommand.java
core/branches/flat/src/main/java/org/jboss/starobrno/commands/read/GetKeyValueCommand.java
core/branches/flat/src/main/java/org/jboss/starobrno/commands/read/GravitateDataCommand.java
core/branches/flat/src/main/java/org/jboss/starobrno/commands/read/SizeCommand.java
core/branches/flat/src/main/java/org/jboss/starobrno/commands/remote/AnnounceBuddyPoolNameCommand.java
core/branches/flat/src/main/java/org/jboss/starobrno/commands/remote/AssignToBuddyGroupCommand.java
core/branches/flat/src/main/java/org/jboss/starobrno/commands/remote/ClusteredGetCommand.java
core/branches/flat/src/main/java/org/jboss/starobrno/commands/remote/DataGravitationCleanupCommand.java
core/branches/flat/src/main/java/org/jboss/starobrno/commands/remote/RemoveFromBuddyGroupCommand.java
core/branches/flat/src/main/java/org/jboss/starobrno/commands/remote/ReplicateCommand.java
core/branches/flat/src/main/java/org/jboss/starobrno/commands/tx/CommitCommand.java
core/branches/flat/src/main/java/org/jboss/starobrno/commands/tx/PrepareCommand.java
core/branches/flat/src/main/java/org/jboss/starobrno/commands/tx/RollbackCommand.java
core/branches/flat/src/main/java/org/jboss/starobrno/commands/write/ClearCommand.java
core/branches/flat/src/main/java/org/jboss/starobrno/commands/write/EvictCommand.java
core/branches/flat/src/main/java/org/jboss/starobrno/commands/write/PutKeyValueCommand.java
core/branches/flat/src/main/java/org/jboss/starobrno/commands/write/PutMapCommand.java
core/branches/flat/src/main/java/org/jboss/starobrno/commands/write/RemoveCommand.java
core/branches/flat/src/main/java/org/jboss/starobrno/commands/write/ReplaceCommand.java
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/Notifier.java
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/NotifierImpl.java
core/branches/flat/src/main/java/org/jboss/starobrno/remoting/RPCManagerImpl.java
core/branches/flat/src/test/java/org/jboss/starobrno/util/internals/ViewChangeListener.java
Log:
Part complete notifier code + tests
Modified: core/branches/flat/src/main/java/org/jboss/cache/CacheSPI_Legacy.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/CacheSPI_Legacy.java 2008-10-10
12:52:50 UTC (rev 6902)
+++ core/branches/flat/src/main/java/org/jboss/cache/CacheSPI_Legacy.java 2008-10-10
15:25:26 UTC (rev 6903)
@@ -28,11 +28,11 @@
import org.jboss.cache.loader.CacheLoader;
import org.jboss.cache.loader.CacheLoaderManager;
import org.jboss.cache.marshall.Marshaller;
-import org.jboss.cache.notifications.Notifier;
import org.jboss.cache.statetransfer.StateTransferManager;
import org.jboss.cache.transaction.GlobalTransaction;
import org.jboss.cache.transaction.TransactionTable;
import org.jboss.starobrno.factories.ComponentRegistry;
+import org.jboss.starobrno.notifications.Notifier;
import javax.transaction.Transaction;
import javax.transaction.TransactionManager;
Deleted: core/branches/flat/src/main/java/org/jboss/cache/ConsoleListener.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/ConsoleListener.java 2008-10-10
12:52:50 UTC (rev 6902)
+++ core/branches/flat/src/main/java/org/jboss/cache/ConsoleListener.java 2008-10-10
15:25:26 UTC (rev 6903)
@@ -1,252 +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.notifications.annotation.CacheListener;
-import org.jboss.cache.notifications.annotation.CacheStarted;
-import org.jboss.cache.notifications.annotation.CacheStopped;
-import org.jboss.cache.notifications.annotation.NodeActivated;
-import org.jboss.cache.notifications.annotation.NodeCreated;
-import org.jboss.cache.notifications.annotation.NodeEvicted;
-import org.jboss.cache.notifications.annotation.NodeLoaded;
-import org.jboss.cache.notifications.annotation.NodeModified;
-import org.jboss.cache.notifications.annotation.NodeMoved;
-import org.jboss.cache.notifications.annotation.NodePassivated;
-import org.jboss.cache.notifications.annotation.NodeRemoved;
-import org.jboss.cache.notifications.annotation.NodeVisited;
-import org.jboss.cache.notifications.annotation.ViewChanged;
-import org.jboss.cache.notifications.event.Event;
-import org.jboss.cache.notifications.event.NodeEvent;
-import org.jboss.cache.notifications.event.ViewChangedEvent;
-
-/**
- * This class provides a non-graphical view of <em>JBossCache</em>
replication
- * events for a replicated cache.
- * <p/>
- * It can be utilized as a standalone application or as a component in other
- * applications.
- * <p/>
- * <strong>WARNING</strong>: take care when using this class in conjunction
with
- * transactionally replicated cache's as it can cause deadlock situations due to
- * the reading of values for nodes in the cache.
- *
- * @author Jimmy Wilson 12-2004
- */
-@CacheListener
-public class ConsoleListener
-{
- private CacheSPI_Legacy cache;
- private boolean startCache;
-
- /**
- * Constructor.
- * <p/>
- * When using this constructor, this class with attempt to start and stop
- * the specified cache.
- *
- * @param cache the cache to monitor for replication events.
- */
- public ConsoleListener(CacheSPI_Legacy cache)
- throws Exception
- {
- this(cache, true, true);
- }
-
- /**
- * Constructor.
- *
- * @param cache the cache to monitor for replication events.
- * @param startCache indicates whether or not the cache should be started by
- * this class.
- * @param stopCache indicates whether or not the cache should be stopped by
- * this class.
- */
- public ConsoleListener(CacheSPI_Legacy cache,
- boolean startCache, boolean stopCache)
- throws Exception
- {
- this.cache = cache;
- this.startCache = startCache;
-
- if (stopCache)
- {
- new ListenerShutdownHook().register();
- }
- }
-
- /**
- * Instructs this class to listen for cache replication events.
- * <p/>
- * This method waits indefinately. Use the notify method of this class
- * (using traditional Java thread notification semantics) to cause this
- * method to return.
- */
- public void listen()
- throws Exception
- {
- listen(true);
- }
-
- /**
- * Instructs this class to listen for cache replication events.
- *
- * @param wait whether or not this method should wait indefinately.
- * <p/>
- * If this parameter is set to <code>true</code>, using the
- * notify method of this class (using traditional Java thread
- * notification semantics) will cause this method to return.
- */
- public void listen(boolean wait)
- throws Exception
- {
- cache.getNotifier().addCacheListener(this);
-
- if (startCache)
- {
- cache.start();
- }
-
- synchronized (this)
- {
- while (wait)
- {
- wait();
- }
- }
- }
-
-
- @CacheStarted
- @CacheStopped
- public void printDetails(Event e)
- {
- printEvent("Cache started.");
- }
-
-
- @NodeCreated
- @NodeLoaded
- @NodeModified
- @NodeRemoved
- @NodeVisited
- @NodeMoved
- @NodeEvicted
- @NodeActivated
- @NodePassivated
- public void printDetailsWithFqn(NodeEvent e)
- {
- if (e.isPre())
- {
- printEvent("Event " + e.getType() + " on node [" +
e.getFqn() + "] about to be invoked");
- }
- else
- {
- printEvent("Event " + e.getType() + " on node [" +
e.getFqn() + "] invoked");
- }
- }
-
- @ViewChanged
- public void printNewView(ViewChangedEvent e)
- {
- printEvent("View change: " + e.getNewView());
- }
-
- /**
- * Prints an event message.
- *
- * @param eventSuffix the suffix of the event message.
- */
- private void printEvent(String eventSuffix)
- {
- System.out.print("EVENT");
- System.out.print(' ');
-
- System.out.println(eventSuffix);
- }
-
- /**
- * This class provides a shutdown hook for shutting down the cache.
- */
- private class ListenerShutdownHook extends Thread
- {
- /**
- * Registers this hook for invocation during shutdown.
- */
- public void register()
- {
- Runtime.getRuntime().addShutdownHook(this);
- }
-
- /*
- * Thread overrides.
- */
-
- @Override
- public void run()
- {
- cache.stop();
- }
- }
-
- /**
- * The main method.
- *
- * @param args command line arguments dictated by convention.
- * <p/>
- * The first command line argument is the name of the
- * <code>JBossCache</code> configuration file to be utilized
- * for configuration of the cache. Only the name of the
- * configuration file is necessary as it is read off of the
- * classpath.
- * <p/>
- * If a configuration file is not specified on the command line,
- * <code>jboss-cache.xml</code> will be the assumed file
name.
- * <p/>
- * All command line arguments after the first are ignored.
- */
- public static void main(String[] args)
- {
- final String DEFAULT_CONFIG_FILE_NAME = "jboss-cache.xml";
-
- try
- {
- String configFileName = DEFAULT_CONFIG_FILE_NAME;
-
- if (args.length >= 1)
- {
- configFileName = args[0];
- }
- else
- {
- System.out.print("No xml config file argument is supplied. Will use
jboss-cache.xml from classpath");
- }
-
- CacheSPI_Legacy cache = (CacheSPI_Legacy) new DefaultCacheFactory<Object,
Object>().createCache(configFileName);
- ConsoleListener listener = new ConsoleListener(cache);
- listener.listen();
- }
- catch (Throwable throwable)
- {
- throwable.printStackTrace();
- }
- }
-}
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-10
12:52:50 UTC (rev 6902)
+++ core/branches/flat/src/main/java/org/jboss/cache/RPCManagerImpl.java 2008-10-10
15:25:26 UTC (rev 6903)
@@ -702,9 +702,6 @@
{
flushBlockGate.close();
if (log.isDebugEnabled()) log.debug("Block received at " +
getLocalAddress());
- notifier.notifyCacheBlocked(true);
- notifier.notifyCacheBlocked(false);
-
if (log.isDebugEnabled()) log.debug("Block processed at " +
getLocalAddress());
}
@@ -714,10 +711,6 @@
public void unblock()
{
if (log.isDebugEnabled()) log.debug("UnBlock received at " +
getLocalAddress());
-
- notifier.notifyCacheUnblocked(true);
- notifier.notifyCacheUnblocked(false);
-
if (log.isDebugEnabled()) log.debug("UnBlock processed at " +
getLocalAddress());
flushBlockGate.open();
}
Modified:
core/branches/flat/src/main/java/org/jboss/cache/buddyreplication/BuddyManager.java
===================================================================
---
core/branches/flat/src/main/java/org/jboss/cache/buddyreplication/BuddyManager.java 2008-10-10
12:52:50 UTC (rev 6902)
+++
core/branches/flat/src/main/java/org/jboss/cache/buddyreplication/BuddyManager.java 2008-10-10
15:25:26 UTC (rev 6903)
@@ -41,10 +41,6 @@
import org.jboss.cache.commands.remote.ReplicateCommand;
import org.jboss.cache.io.ExposedByteArrayOutputStream;
import org.jboss.cache.lock.TimeoutException;
-import org.jboss.cache.notifications.Notifier;
-import org.jboss.cache.notifications.annotation.CacheListener;
-import org.jboss.cache.notifications.annotation.ViewChanged;
-import org.jboss.cache.notifications.event.ViewChangedEvent;
import org.jboss.cache.statetransfer.StateTransferManager;
import org.jboss.cache.util.concurrent.ConcurrentHashSet;
import org.jboss.cache.util.reflect.ReflectionUtil;
@@ -56,6 +52,10 @@
import org.jboss.starobrno.factories.annotations.Inject;
import org.jboss.starobrno.factories.annotations.Start;
import org.jboss.starobrno.factories.annotations.Stop;
+import org.jboss.starobrno.notifications.Notifier;
+import org.jboss.starobrno.notifications.annotation.CacheListener;
+import org.jboss.starobrno.notifications.annotation.ViewChanged;
+import org.jboss.starobrno.notifications.event.ViewChangedEvent;
import org.jboss.util.stream.MarshalledValueInputStream;
import org.jboss.util.stream.MarshalledValueOutputStream;
import org.jgroups.Address;
Modified:
core/branches/flat/src/main/java/org/jboss/cache/commands/CommandsFactoryImpl.java
===================================================================
---
core/branches/flat/src/main/java/org/jboss/cache/commands/CommandsFactoryImpl.java 2008-10-10
12:52:50 UTC (rev 6902)
+++
core/branches/flat/src/main/java/org/jboss/cache/commands/CommandsFactoryImpl.java 2008-10-10
15:25:26 UTC (rev 6903)
@@ -54,12 +54,12 @@
import org.jboss.cache.commands.write.RemoveKeyCommand;
import org.jboss.cache.commands.write.RemoveNodeCommand;
import org.jboss.cache.interceptors.InterceptorChain;
-import org.jboss.cache.notifications.Notifier;
import org.jboss.cache.transaction.GlobalTransaction;
import org.jboss.cache.transaction.TransactionTable;
import org.jboss.starobrno.CacheException;
import org.jboss.starobrno.config.Configuration;
import org.jboss.starobrno.factories.annotations.Inject;
+import org.jboss.starobrno.notifications.Notifier;
import org.jgroups.Address;
import javax.transaction.TransactionManager;
Modified:
core/branches/flat/src/main/java/org/jboss/cache/commands/read/GetKeyValueCommand.java
===================================================================
---
core/branches/flat/src/main/java/org/jboss/cache/commands/read/GetKeyValueCommand.java 2008-10-10
12:52:50 UTC (rev 6902)
+++
core/branches/flat/src/main/java/org/jboss/cache/commands/read/GetKeyValueCommand.java 2008-10-10
15:25:26 UTC (rev 6903)
@@ -28,7 +28,7 @@
import org.jboss.cache.InvocationContext;
import org.jboss.cache.NodeSPI;
import org.jboss.cache.commands.Visitor;
-import org.jboss.cache.notifications.Notifier;
+import org.jboss.starobrno.notifications.Notifier;
/**
* Implements functionality defined by {@link org.jboss.cache.Cache_Legacy#get(String,
Object)}
@@ -84,10 +84,10 @@
if (trace) log.trace("Node has been deleted and is of type " +
n.getClass().getSimpleName());
return null;
}
- if (sendNodeEvent) notifier.notifyNodeVisited(fqn, true, ctx);
+// if (sendNodeEvent) notifier.notifyNodeVisited(fqn, true, ctx);
Object result = n.getDirect(key);
if (trace) log.trace("Found value " + result);
- if (sendNodeEvent) notifier.notifyNodeVisited(fqn, false, ctx);
+// if (sendNodeEvent) notifier.notifyNodeVisited(fqn, false, ctx);
return result;
}
Modified:
core/branches/flat/src/main/java/org/jboss/cache/commands/write/AbstractVersionedDataCommand.java
===================================================================
---
core/branches/flat/src/main/java/org/jboss/cache/commands/write/AbstractVersionedDataCommand.java 2008-10-10
12:52:50 UTC (rev 6902)
+++
core/branches/flat/src/main/java/org/jboss/cache/commands/write/AbstractVersionedDataCommand.java 2008-10-10
15:25:26 UTC (rev 6903)
@@ -27,8 +27,8 @@
import org.jboss.cache.NodeSPI;
import org.jboss.cache.commands.VersionedDataCommand;
import org.jboss.cache.commands.read.AbstractDataCommand;
-import org.jboss.cache.notifications.Notifier;
import org.jboss.cache.transaction.GlobalTransaction;
+import org.jboss.starobrno.notifications.Notifier;
/**
* Base version of {@link org.jboss.cache.commands.DataCommand} which handles common
behaviour
Modified:
core/branches/flat/src/main/java/org/jboss/cache/commands/write/ClearDataCommand.java
===================================================================
---
core/branches/flat/src/main/java/org/jboss/cache/commands/write/ClearDataCommand.java 2008-10-10
12:52:50 UTC (rev 6902)
+++
core/branches/flat/src/main/java/org/jboss/cache/commands/write/ClearDataCommand.java 2008-10-10
15:25:26 UTC (rev 6903)
@@ -27,7 +27,6 @@
import org.jboss.cache.InvocationContext;
import org.jboss.cache.NodeSPI;
import org.jboss.cache.commands.Visitor;
-import org.jboss.cache.notifications.event.NodeModifiedEvent;
import org.jboss.cache.transaction.GlobalTransaction;
import java.util.Map;
@@ -74,9 +73,9 @@
}
Map data = targetNode.getDataDirect();
- notifier.notifyNodeModified(fqn, true,
NodeModifiedEvent.ModificationType.REMOVE_DATA, data, ctx);
+// notifier.notifyNodeModified(fqn, true,
NodeModifiedEvent.ModificationType.REMOVE_DATA, data, ctx);
targetNode.clearDataDirect();
- notifier.notifyNodeModified(fqn, false,
NodeModifiedEvent.ModificationType.REMOVE_DATA, data, ctx);
+// notifier.notifyNodeModified(fqn, false,
NodeModifiedEvent.ModificationType.REMOVE_DATA, data, ctx);
return null;
}
Modified:
core/branches/flat/src/main/java/org/jboss/cache/commands/write/EvictCommand.java
===================================================================
---
core/branches/flat/src/main/java/org/jboss/cache/commands/write/EvictCommand.java 2008-10-10
12:52:50 UTC (rev 6902)
+++
core/branches/flat/src/main/java/org/jboss/cache/commands/write/EvictCommand.java 2008-10-10
15:25:26 UTC (rev 6903)
@@ -30,7 +30,7 @@
import org.jboss.cache.NodeSPI;
import org.jboss.cache.commands.Visitor;
import org.jboss.cache.commands.read.AbstractDataCommand;
-import org.jboss.cache.notifications.Notifier;
+import org.jboss.starobrno.notifications.Notifier;
import java.util.Collection;
import java.util.Collections;
@@ -122,7 +122,7 @@
protected boolean evictNode(Fqn fqn, InvocationContext ctx, NodeSPI node)
{
- notifier.notifyNodeEvicted(fqn, true, ctx);
+// notifier.notifyNodeEvicted(fqn, true, ctx);
try
{
if (node == null) return true;
@@ -152,7 +152,7 @@
}
finally
{
- notifier.notifyNodeEvicted(fqn, false, ctx);
+// notifier.notifyNodeEvicted(fqn, false, ctx);
}
}
Modified:
core/branches/flat/src/main/java/org/jboss/cache/commands/write/InvalidateCommand.java
===================================================================
---
core/branches/flat/src/main/java/org/jboss/cache/commands/write/InvalidateCommand.java 2008-10-10
12:52:50 UTC (rev 6902)
+++
core/branches/flat/src/main/java/org/jboss/cache/commands/write/InvalidateCommand.java 2008-10-10
15:25:26 UTC (rev 6903)
@@ -30,7 +30,7 @@
import org.jboss.cache.NodeSPI;
import org.jboss.cache.commands.Visitor;
import org.jboss.cache.commands.read.AbstractDataCommand;
-import org.jboss.cache.notifications.Notifier;
+import org.jboss.starobrno.notifications.Notifier;
/**
* Removes a node's content from memory - never removes the node.
@@ -86,14 +86,14 @@
boolean evictNode(Fqn fqn, InvocationContext ctx)
{
- notifier.notifyNodeInvalidated(fqn, true, ctx);
+// notifier.notifyNodeInvalidated(fqn, true, ctx);
try
{
return dataContainer.evict(fqn);
}
finally
{
- notifier.notifyNodeInvalidated(fqn, false, ctx);
+// notifier.notifyNodeInvalidated(fqn, false, ctx);
}
}
Modified:
core/branches/flat/src/main/java/org/jboss/cache/commands/write/MoveCommand.java
===================================================================
---
core/branches/flat/src/main/java/org/jboss/cache/commands/write/MoveCommand.java 2008-10-10
12:52:50 UTC (rev 6902)
+++
core/branches/flat/src/main/java/org/jboss/cache/commands/write/MoveCommand.java 2008-10-10
15:25:26 UTC (rev 6903)
@@ -31,8 +31,8 @@
import org.jboss.cache.commands.Visitor;
import org.jboss.cache.commands.WriteCommand;
import org.jboss.cache.commands.read.AbstractDataCommand;
-import org.jboss.cache.notifications.Notifier;
import org.jboss.cache.transaction.GlobalTransaction;
+import org.jboss.starobrno.notifications.Notifier;
import java.util.Map;
@@ -111,9 +111,9 @@
// at this stage all child node objects we need have been created and are available
in the ctx.
// we just need to mark old ones as deleted, new ones as created, and move data
across.
- notifier.notifyNodeMoved(fqn, newNodeFqn, true, ctx);
+// notifier.notifyNodeMoved(fqn, newNodeFqn, true, ctx);
moveRecursively(node, newNode, ctx);
- notifier.notifyNodeMoved(fqn, newNodeFqn, false, ctx);
+// notifier.notifyNodeMoved(fqn, newNodeFqn, false, ctx);
return null;
}
Modified:
core/branches/flat/src/main/java/org/jboss/cache/commands/write/PutDataMapCommand.java
===================================================================
---
core/branches/flat/src/main/java/org/jboss/cache/commands/write/PutDataMapCommand.java 2008-10-10
12:52:50 UTC (rev 6902)
+++
core/branches/flat/src/main/java/org/jboss/cache/commands/write/PutDataMapCommand.java 2008-10-10
15:25:26 UTC (rev 6903)
@@ -28,10 +28,8 @@
import org.jboss.cache.NodeNotExistsException;
import org.jboss.cache.NodeSPI;
import org.jboss.cache.commands.Visitor;
-import org.jboss.cache.notifications.event.NodeModifiedEvent;
import org.jboss.cache.transaction.GlobalTransaction;
-import java.util.Collections;
import java.util.Map;
/**
@@ -78,16 +76,16 @@
if (nodeSPI == null) throw new NodeNotExistsException("Node " + fqn +
" does not exist!");
Map existingData = nodeSPI.getDataDirect();
- if (notifier.shouldNotifyOnNodeModified())
- {
- notifier.notifyNodeModified(fqn, true,
NodeModifiedEvent.ModificationType.PUT_MAP, existingData == null ? Collections.emptyMap()
: existingData, ctx);
- }
-
+// if (notifier.shouldNotifyOnNodeModified())
+// {
+// notifier.notifyNodeModified(fqn, true,
NodeModifiedEvent.ModificationType.PUT_MAP, existingData == null ? Collections.emptyMap()
: existingData, ctx);
+// }
+//
nodeSPI.putAllDirect(data);
- if (notifier.shouldNotifyOnNodeModified())
- {
- notifier.notifyNodeModified(fqn, false,
NodeModifiedEvent.ModificationType.PUT_MAP, nodeSPI.getDataDirect(), ctx);
- }
+// if (notifier.shouldNotifyOnNodeModified())
+// {
+// notifier.notifyNodeModified(fqn, false,
NodeModifiedEvent.ModificationType.PUT_MAP, nodeSPI.getDataDirect(), ctx);
+// }
return null;
}
Modified:
core/branches/flat/src/main/java/org/jboss/cache/commands/write/PutKeyValueCommand.java
===================================================================
---
core/branches/flat/src/main/java/org/jboss/cache/commands/write/PutKeyValueCommand.java 2008-10-10
12:52:50 UTC (rev 6902)
+++
core/branches/flat/src/main/java/org/jboss/cache/commands/write/PutKeyValueCommand.java 2008-10-10
15:25:26 UTC (rev 6903)
@@ -28,7 +28,6 @@
import org.jboss.cache.NodeNotExistsException;
import org.jboss.cache.NodeSPI;
import org.jboss.cache.commands.Visitor;
-import org.jboss.cache.notifications.event.NodeModifiedEvent;
import org.jboss.cache.transaction.GlobalTransaction;
import java.util.Collections;
@@ -80,7 +79,7 @@
if (notifier.shouldNotifyOnNodeModified())
{
- notifier.notifyNodeModified(fqn, true,
NodeModifiedEvent.ModificationType.PUT_DATA, n.getDataDirect(), ctx);
+// notifier.notifyNodeModified(fqn, true,
NodeModifiedEvent.ModificationType.PUT_DATA, n.getDataDirect(), ctx);
}
Object oldValue = n.putDirect(key, value);
@@ -89,7 +88,7 @@
if (notifier.shouldNotifyOnNodeModified())
{
Map newData = Collections.singletonMap(key, value);
- notifier.notifyNodeModified(fqn, false,
NodeModifiedEvent.ModificationType.PUT_DATA, newData, ctx);
+// notifier.notifyNodeModified(fqn, false,
NodeModifiedEvent.ModificationType.PUT_DATA, newData, ctx);
}
return oldValue;
}
Modified:
core/branches/flat/src/main/java/org/jboss/cache/commands/write/RemoveKeyCommand.java
===================================================================
---
core/branches/flat/src/main/java/org/jboss/cache/commands/write/RemoveKeyCommand.java 2008-10-10
12:52:50 UTC (rev 6902)
+++
core/branches/flat/src/main/java/org/jboss/cache/commands/write/RemoveKeyCommand.java 2008-10-10
15:25:26 UTC (rev 6903)
@@ -27,7 +27,6 @@
import org.jboss.cache.InvocationContext;
import org.jboss.cache.NodeSPI;
import org.jboss.cache.commands.Visitor;
-import org.jboss.cache.notifications.event.NodeModifiedEvent;
import org.jboss.cache.transaction.GlobalTransaction;
import java.util.Collections;
@@ -79,13 +78,13 @@
}
if (notifier.shouldNotifyOnNodeModified())
{
- notifier.notifyNodeModified(fqn, true,
NodeModifiedEvent.ModificationType.REMOVE_DATA, n.getDataDirect(), ctx);
+// notifier.notifyNodeModified(fqn, true,
NodeModifiedEvent.ModificationType.REMOVE_DATA, n.getDataDirect(), ctx);
}
Object oldValue = n.removeDirect(key);
if (notifier.shouldNotifyOnNodeModified())
{
Map removedData = Collections.singletonMap(key, oldValue);
- notifier.notifyNodeModified(fqn, false,
NodeModifiedEvent.ModificationType.REMOVE_DATA, removedData, ctx);
+// notifier.notifyNodeModified(fqn, false,
NodeModifiedEvent.ModificationType.REMOVE_DATA, removedData, ctx);
}
return oldValue;
}
Modified:
core/branches/flat/src/main/java/org/jboss/cache/commands/write/RemoveNodeCommand.java
===================================================================
---
core/branches/flat/src/main/java/org/jboss/cache/commands/write/RemoveNodeCommand.java 2008-10-10
12:52:50 UTC (rev 6902)
+++
core/branches/flat/src/main/java/org/jboss/cache/commands/write/RemoveNodeCommand.java 2008-10-10
15:25:26 UTC (rev 6903)
@@ -107,7 +107,7 @@
{
if (!skipSendingNodeEvents)
{
- notifier.notifyNodeRemoved(fqn, true, n.getDataDirect(), ctx);
+// notifier.notifyNodeRemoved(fqn, true, n.getDataDirect(), ctx);
}
}
@@ -115,7 +115,7 @@
{
if (!skipSendingNodeEvents)
{
- notifier.notifyNodeRemoved(fqn, false, null, ctx);
+// notifier.notifyNodeRemoved(fqn, false, null, ctx);
}
}
Modified:
core/branches/flat/src/main/java/org/jboss/cache/interceptors/ActivationInterceptor.java
===================================================================
---
core/branches/flat/src/main/java/org/jboss/cache/interceptors/ActivationInterceptor.java 2008-10-10
12:52:50 UTC (rev 6902)
+++
core/branches/flat/src/main/java/org/jboss/cache/interceptors/ActivationInterceptor.java 2008-10-10
15:25:26 UTC (rev 6903)
@@ -374,7 +374,7 @@
{
Modification mod = new Modification(Modification.ModificationType.REMOVE_NODE,
fqn);
l.add(mod);
- notifier.notifyNodeActivated(fqn, false, data, ctx);
+// notifier.notifyNodeActivated(fqn, false, data, ctx);
}
public List<Modification> getCacheLoaderModifications()
Modified:
core/branches/flat/src/main/java/org/jboss/cache/interceptors/CacheLoaderInterceptor.java
===================================================================
---
core/branches/flat/src/main/java/org/jboss/cache/interceptors/CacheLoaderInterceptor.java 2008-10-10
12:52:50 UTC (rev 6902)
+++
core/branches/flat/src/main/java/org/jboss/cache/interceptors/CacheLoaderInterceptor.java 2008-10-10
15:25:26 UTC (rev 6903)
@@ -44,14 +44,13 @@
import org.jboss.cache.jmx.annotations.ManagedOperation;
import org.jboss.cache.loader.CacheLoader;
import org.jboss.cache.loader.CacheLoaderManager;
-import org.jboss.cache.notifications.Notifier;
import org.jboss.cache.transaction.TransactionTable;
import org.jboss.starobrno.CacheException;
import org.jboss.starobrno.config.Configuration;
import org.jboss.starobrno.factories.annotations.Inject;
import org.jboss.starobrno.factories.annotations.Start;
+import org.jboss.starobrno.notifications.Notifier;
-import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.ListIterator;
@@ -422,11 +421,11 @@
{
if (trace) log.trace("Node data is not null, loading");
- notifier.notifyNodeLoaded(fqn, true, Collections.emptyMap(), ctx);
- if (isActivation)
- {
- notifier.notifyNodeActivated(fqn, true, Collections.emptyMap(), ctx);
- }
+// notifier.notifyNodeLoaded(fqn, true, Collections.emptyMap(), ctx);
+// if (isActivation)
+// {
+// notifier.notifyNodeActivated(fqn, true, Collections.emptyMap(), ctx);
+// }
n.setInternalState(nodeData);
@@ -434,11 +433,11 @@
// if (usingVersionedInvalidation) n.setValid(true, false);
n.setValid(true, false);
- notifier.notifyNodeLoaded(fqn, false, nodeData, ctx);
- if (isActivation)
- {
- notifier.notifyNodeActivated(fqn, false, nodeData, ctx);
- }
+// notifier.notifyNodeLoaded(fqn, false, nodeData, ctx);
+// if (isActivation)
+// {
+// notifier.notifyNodeActivated(fqn, false, nodeData, ctx);
+// }
}
if (n != null && !n.isDataLoaded())
{
Modified:
core/branches/flat/src/main/java/org/jboss/cache/interceptors/PassivationInterceptor.java
===================================================================
---
core/branches/flat/src/main/java/org/jboss/cache/interceptors/PassivationInterceptor.java 2008-10-10
12:52:50 UTC (rev 6902)
+++
core/branches/flat/src/main/java/org/jboss/cache/interceptors/PassivationInterceptor.java 2008-10-10
15:25:26 UTC (rev 6903)
@@ -30,10 +30,9 @@
import org.jboss.cache.jmx.annotations.ManagedOperation;
import org.jboss.cache.loader.CacheLoader;
import org.jboss.cache.loader.CacheLoaderManager;
-import org.jboss.cache.notifications.Notifier;
import org.jboss.starobrno.factories.annotations.Inject;
+import org.jboss.starobrno.notifications.Notifier;
-import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.atomic.AtomicLong;
@@ -88,10 +87,10 @@
// to get them manually
Map attributes = getNodeAttributes(ctx, fqn);
// notify listeners that this node is about to be passivated
- notifier.notifyNodePassivated(fqn, true, attributes, ctx);
+// notifier.notifyNodePassivated(fqn, true, attributes, ctx);
if (trace) log.trace("Passivating " + fqn);
loader.put(fqn, attributes);
- notifier.notifyNodePassivated(fqn, false, Collections.emptyMap(), ctx);
+// notifier.notifyNodePassivated(fqn, false, Collections.emptyMap(), ctx);
if (getStatisticsEnabled()) passivations.getAndIncrement();
}
catch (NodeNotLoadedException e)
Modified:
core/branches/flat/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java
===================================================================
---
core/branches/flat/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java 2008-10-10
12:52:50 UTC (rev 6902)
+++
core/branches/flat/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java 2008-10-10
15:25:26 UTC (rev 6903)
@@ -54,7 +54,6 @@
import org.jboss.cache.interceptors.base.CommandInterceptor;
import org.jboss.cache.loader.CacheLoaderManager;
import org.jboss.cache.marshall.Marshaller;
-import org.jboss.cache.notifications.Notifier;
import org.jboss.cache.statetransfer.StateTransferManager;
import org.jboss.cache.transaction.GlobalTransaction;
import org.jboss.cache.transaction.TransactionTable;
@@ -67,6 +66,7 @@
import org.jboss.starobrno.factories.ComponentRegistry;
import org.jboss.starobrno.factories.annotations.Inject;
import org.jboss.starobrno.factories.annotations.NonVolatile;
+import org.jboss.starobrno.notifications.Notifier;
import org.jgroups.Address;
import javax.transaction.Transaction;
Modified:
core/branches/flat/src/main/java/org/jboss/cache/jmx/CacheNotificationBroadcaster.java
===================================================================
---
core/branches/flat/src/main/java/org/jboss/cache/jmx/CacheNotificationBroadcaster.java 2008-10-10
12:52:50 UTC (rev 6902)
+++
core/branches/flat/src/main/java/org/jboss/cache/jmx/CacheNotificationBroadcaster.java 2008-10-10
15:25:26 UTC (rev 6903)
@@ -30,15 +30,14 @@
String
NOTIF_CACHE_STARTED = "org.jboss.cache.CacheStarted",
NOTIF_CACHE_STOPPED = "org.jboss.cache.CacheStopped",
- NOTIF_NODE_CREATED = "org.jboss.cache.NodeCreated",
- NOTIF_NODE_MODIFIED = "org.jboss.cache.NodeModified",
- NOTIF_NODE_REMOVED = "org.jboss.cache.NodeRemoved",
- NOTIF_NODE_MOVED = "org.jboss.cache.NodeMoved",
- NOTIF_NODE_VISITED = "org.jboss.cache.NodeVisited",
- NOTIF_NODE_EVICTED = "org.jboss.cache.NodeEvicted",
- NOTIF_NODE_LOADED = "org.jboss.cache.NodeLoaded",
- NOTIF_NODE_ACTIVATED = "org.jboss.cache.NodeActivated",
- NOTIF_NODE_PASSIVATED = "org.jboss.cache.NodePassivated",
+ NOTIF_CACHE_ENTRY_CREATED = "org.jboss.cache.NodeCreated",
+ NOTIF_CACHE_ENTRY_MODIFIED = "org.jboss.cache.NodeModified",
+ NOTIF_CACHE_ENTRY_REMOVED = "org.jboss.cache.NodeRemoved",
+ NOTIF_CACHE_ENTRY_VISITED = "org.jboss.cache.NodeVisited",
+ NOTIF_CACHE_ENTRY_EVICTED = "org.jboss.cache.NodeEvicted",
+ NOTIF_CACHE_ENTRY_LOADED = "org.jboss.cache.NodeLoaded",
+ NOTIF_CACHE_ENTRY_ACTIVATED = "org.jboss.cache.NodeActivated",
+ NOTIF_CACHE_ENTRY_PASSIVATED = "org.jboss.cache.NodePassivated",
NOTIF_VIEW_CHANGED = "org.jboss.cache.ViewChanged";
/**
Modified:
core/branches/flat/src/main/java/org/jboss/cache/jmx/CacheNotificationListener.java
===================================================================
---
core/branches/flat/src/main/java/org/jboss/cache/jmx/CacheNotificationListener.java 2008-10-10
12:52:50 UTC (rev 6902)
+++
core/branches/flat/src/main/java/org/jboss/cache/jmx/CacheNotificationListener.java 2008-10-10
15:25:26 UTC (rev 6903)
@@ -21,23 +21,21 @@
*/
package org.jboss.cache.jmx;
-import org.jboss.cache.notifications.annotation.CacheListener;
-import org.jboss.cache.notifications.annotation.CacheStarted;
-import org.jboss.cache.notifications.annotation.CacheStopped;
-import org.jboss.cache.notifications.annotation.NodeActivated;
-import org.jboss.cache.notifications.annotation.NodeCreated;
-import org.jboss.cache.notifications.annotation.NodeEvicted;
-import org.jboss.cache.notifications.annotation.NodeLoaded;
-import org.jboss.cache.notifications.annotation.NodeModified;
-import org.jboss.cache.notifications.annotation.NodeMoved;
-import org.jboss.cache.notifications.annotation.NodePassivated;
-import org.jboss.cache.notifications.annotation.NodeRemoved;
-import org.jboss.cache.notifications.annotation.NodeVisited;
-import org.jboss.cache.notifications.annotation.ViewChanged;
-import org.jboss.cache.notifications.event.Event;
-import org.jboss.cache.notifications.event.NodeEvent;
-import org.jboss.cache.notifications.event.NodeMovedEvent;
-import org.jboss.cache.notifications.event.ViewChangedEvent;
+import org.jboss.starobrno.notifications.annotation.CacheEntryActivated;
+import org.jboss.starobrno.notifications.annotation.CacheEntryCreated;
+import org.jboss.starobrno.notifications.annotation.CacheEntryEvicted;
+import org.jboss.starobrno.notifications.annotation.CacheEntryLoaded;
+import org.jboss.starobrno.notifications.annotation.CacheEntryModified;
+import org.jboss.starobrno.notifications.annotation.CacheEntryPassivated;
+import org.jboss.starobrno.notifications.annotation.CacheEntryRemoved;
+import org.jboss.starobrno.notifications.annotation.CacheEntryVisited;
+import org.jboss.starobrno.notifications.annotation.CacheListener;
+import org.jboss.starobrno.notifications.annotation.CacheStarted;
+import org.jboss.starobrno.notifications.annotation.CacheStopped;
+import org.jboss.starobrno.notifications.annotation.ViewChanged;
+import org.jboss.starobrno.notifications.event.CacheEntryEvent;
+import org.jboss.starobrno.notifications.event.Event;
+import org.jboss.starobrno.notifications.event.ViewChangedEvent;
import javax.management.MBeanNotificationInfo;
import javax.management.Notification;
@@ -55,15 +53,14 @@
// Notification Messages
private static final String MSG_CACHE_STARTED = "Cache has been started.";
private static final String MSG_CACHE_STOPPED = "Cache has been stopped.";
- private static final String MSG_NODE_CREATED = "Node has been created.";
- private static final String MSG_NODE_MODIFIED = "Node has been modifed.";
- private static final String MSG_NODE_REMOVED = "Node has been removed.";
- private static final String MSG_NODE_MOVED = "Node has been moved.";
- private static final String MSG_NODE_VISITED = "Node has been visited.";
- private static final String MSG_NODE_EVICTED = "Node has been evicted.";
- private static final String MSG_NODE_LOADED = "Node has been loaded.";
- private static final String MSG_NODE_ACTIVATED = "Node has been
activated.";
- private static final String MSG_NODE_PASSIVATED = "Node has been
passivated.";
+ private static final String MSG_CACHE_ENTRY_CREATED = "Node has been
created.";
+ private static final String MSG_CACHE_ENTRY_MODIFIED = "Node has been
modifed.";
+ private static final String MSG_CACHE_ENTRY_REMOVED = "Node has been
removed.";
+ private static final String MSG_CACHE_ENTRY_VISITED = "Node has been
visited.";
+ private static final String MSG_CACHE_ENTRY_EVICTED = "Node has been
evicted.";
+ private static final String MSG_CACHE_ENTRY_LOADED = "Node has been
loaded.";
+ private static final String MSG_CACHE_ENTRY_ACTIVATED = "Node has been
activated.";
+ private static final String MSG_CACHE_ENTRY_PASSIVATED = "Node has been
passivated.";
private static final String MSG_VIEW_CHANGED = "Cache cluster view has
changed.";
// Notification Info
@@ -98,14 +95,14 @@
{
CacheNotificationBroadcaster.NOTIF_CACHE_STARTED,
CacheNotificationBroadcaster.NOTIF_CACHE_STOPPED,
- CacheNotificationBroadcaster.NOTIF_NODE_CREATED,
- CacheNotificationBroadcaster.NOTIF_NODE_EVICTED,
- CacheNotificationBroadcaster.NOTIF_NODE_LOADED,
- CacheNotificationBroadcaster.NOTIF_NODE_MODIFIED,
- CacheNotificationBroadcaster.NOTIF_NODE_ACTIVATED,
- CacheNotificationBroadcaster.NOTIF_NODE_PASSIVATED,
- CacheNotificationBroadcaster.NOTIF_NODE_REMOVED,
- CacheNotificationBroadcaster.NOTIF_NODE_VISITED,
+ CacheNotificationBroadcaster.NOTIF_CACHE_ENTRY_CREATED,
+ CacheNotificationBroadcaster.NOTIF_CACHE_ENTRY_EVICTED,
+ CacheNotificationBroadcaster.NOTIF_CACHE_ENTRY_LOADED,
+ CacheNotificationBroadcaster.NOTIF_CACHE_ENTRY_MODIFIED,
+ CacheNotificationBroadcaster.NOTIF_CACHE_ENTRY_ACTIVATED,
+ CacheNotificationBroadcaster.NOTIF_CACHE_ENTRY_PASSIVATED,
+ CacheNotificationBroadcaster.NOTIF_CACHE_ENTRY_REMOVED,
+ CacheNotificationBroadcaster.NOTIF_CACHE_ENTRY_VISITED,
CacheNotificationBroadcaster.NOTIF_VIEW_CHANGED,
};
@@ -117,19 +114,18 @@
@CacheStarted
@CacheStopped
- @NodeCreated
- @NodeEvicted
- @NodeLoaded
- @NodeModified
- @NodeRemoved
- @NodeMoved
- @NodeVisited
- @NodeActivated
- @NodePassivated
+ @CacheEntryCreated
+ @CacheEntryEvicted
+ @CacheEntryLoaded
+ @CacheEntryModified
+ @CacheEntryRemoved
+ @CacheEntryVisited
+ @CacheEntryActivated
+ @CacheEntryPassivated
@ViewChanged
public void broadcast(Event e)
{
- NodeEvent ne;
+ CacheEntryEvent ne;
Notification n = null;
switch (e.getType())
{
@@ -141,51 +137,46 @@
n = new Notification(CacheNotificationBroadcaster.NOTIF_CACHE_STOPPED,
broadcaster, seq(), MSG_CACHE_STOPPED);
n.setUserData(serviceName);
break;
- case NODE_CREATED:
- n = new Notification(CacheNotificationBroadcaster.NOTIF_NODE_CREATED,
broadcaster, seq(), MSG_NODE_CREATED);
- ne = (NodeEvent) e;
- n.setUserData(new Object[]{ne.getFqn().toString(), e.isPre(),
ne.isOriginLocal()});
+ case CACHE_ENTRY_CREATED:
+ n = new Notification(CacheNotificationBroadcaster.NOTIF_CACHE_ENTRY_CREATED,
broadcaster, seq(), MSG_CACHE_ENTRY_CREATED);
+ ne = (CacheEntryEvent) e;
+ n.setUserData(new Object[]{ne.getKey().toString(), e.isPre(),
ne.isOriginLocal()});
break;
- case NODE_EVICTED:
- n = new Notification(CacheNotificationBroadcaster.NOTIF_NODE_EVICTED,
broadcaster, seq(), MSG_NODE_EVICTED);
- ne = (NodeEvent) e;
- n.setUserData(new Object[]{ne.getFqn().toString(), e.isPre(),
ne.isOriginLocal()});
+ case CACHE_ENTRY_EVICTED:
+ n = new Notification(CacheNotificationBroadcaster.NOTIF_CACHE_ENTRY_EVICTED,
broadcaster, seq(), MSG_CACHE_ENTRY_EVICTED);
+ ne = (CacheEntryEvent) e;
+ n.setUserData(new Object[]{ne.getKey().toString(), e.isPre(),
ne.isOriginLocal()});
break;
- case NODE_LOADED:
- n = new Notification(CacheNotificationBroadcaster.NOTIF_NODE_LOADED,
broadcaster, seq(), MSG_NODE_LOADED);
- ne = (NodeEvent) e;
- n.setUserData(new Object[]{ne.getFqn().toString(), e.isPre()});
+ case CACHE_ENTRY_LOADED:
+ n = new Notification(CacheNotificationBroadcaster.NOTIF_CACHE_ENTRY_LOADED,
broadcaster, seq(), MSG_CACHE_ENTRY_LOADED);
+ ne = (CacheEntryEvent) e;
+ n.setUserData(new Object[]{ne.getKey().toString(), e.isPre()});
break;
- case NODE_MODIFIED:
- n = new Notification(CacheNotificationBroadcaster.NOTIF_NODE_MODIFIED,
broadcaster, seq(), MSG_NODE_MODIFIED);
- ne = (NodeEvent) e;
- n.setUserData(new Object[]{ne.getFqn().toString(), e.isPre(),
ne.isOriginLocal()});
+ case CACHE_ENTRY_MODIFIED:
+ n = new Notification(CacheNotificationBroadcaster.NOTIF_CACHE_ENTRY_MODIFIED,
broadcaster, seq(), MSG_CACHE_ENTRY_MODIFIED);
+ ne = (CacheEntryEvent) e;
+ n.setUserData(new Object[]{ne.getKey().toString(), e.isPre(),
ne.isOriginLocal()});
break;
- case NODE_REMOVED:
- n = new Notification(CacheNotificationBroadcaster.NOTIF_NODE_REMOVED,
broadcaster, seq(), MSG_NODE_REMOVED);
- ne = (NodeEvent) e;
- n.setUserData(new Object[]{ne.getFqn().toString(), e.isPre(),
ne.isOriginLocal()});
+ case CACHE_ENTRY_REMOVED:
+ n = new Notification(CacheNotificationBroadcaster.NOTIF_CACHE_ENTRY_REMOVED,
broadcaster, seq(), MSG_CACHE_ENTRY_REMOVED);
+ ne = (CacheEntryEvent) e;
+ n.setUserData(new Object[]{ne.getKey().toString(), e.isPre(),
ne.isOriginLocal()});
break;
- case NODE_MOVED:
- n = new Notification(CacheNotificationBroadcaster.NOTIF_NODE_MOVED,
broadcaster, seq(), MSG_NODE_MOVED);
- NodeMovedEvent nme = (NodeMovedEvent) e;
- n.setUserData(new Object[]{nme.getFqn().toString(),
nme.getTargetFqn().toString(), e.isPre()});
+ case CACHE_ENTRY_VISITED:
+ n = new Notification(CacheNotificationBroadcaster.NOTIF_CACHE_ENTRY_VISITED,
broadcaster, seq(), MSG_CACHE_ENTRY_VISITED);
+ ne = (CacheEntryEvent) e;
+ n.setUserData(new Object[]{ne.getKey().toString(), e.isPre()});
break;
- case NODE_VISITED:
- n = new Notification(CacheNotificationBroadcaster.NOTIF_NODE_VISITED,
broadcaster, seq(), MSG_NODE_VISITED);
- ne = (NodeEvent) e;
- n.setUserData(new Object[]{ne.getFqn().toString(), e.isPre()});
+ case CACHE_ENTRY_ACTIVATED:
+ n = new
Notification(CacheNotificationBroadcaster.NOTIF_CACHE_ENTRY_ACTIVATED, broadcaster, seq(),
MSG_CACHE_ENTRY_ACTIVATED);
+ ne = (CacheEntryEvent) e;
+ n.setUserData(new Object[]{ne.getKey().toString(), e.isPre()});
break;
- case NODE_ACTIVATED:
- n = new Notification(CacheNotificationBroadcaster.NOTIF_NODE_ACTIVATED,
broadcaster, seq(), MSG_NODE_ACTIVATED);
- ne = (NodeEvent) e;
- n.setUserData(new Object[]{ne.getFqn().toString(), e.isPre()});
+ case CACHE_ENTRY_PASSIVATED:
+ n = new
Notification(CacheNotificationBroadcaster.NOTIF_CACHE_ENTRY_PASSIVATED, broadcaster,
seq(), MSG_CACHE_ENTRY_PASSIVATED);
+ ne = (CacheEntryEvent) e;
+ n.setUserData(new Object[]{ne.getKey().toString(), e.isPre()});
break;
- case NODE_PASSIVATED:
- n = new Notification(CacheNotificationBroadcaster.NOTIF_NODE_PASSIVATED,
broadcaster, seq(), MSG_NODE_PASSIVATED);
- ne = (NodeEvent) e;
- n.setUserData(new Object[]{ne.getFqn().toString(), e.isPre()});
- break;
case VIEW_CHANGED:
n = new Notification(CacheNotificationBroadcaster.NOTIF_VIEW_CHANGED,
broadcaster, seq(), MSG_VIEW_CHANGED);
n.setUserData(((ViewChangedEvent) e).getNewView().toString());
Modified:
core/branches/flat/src/main/java/org/jboss/cache/loader/SingletonStoreCacheLoader.java
===================================================================
---
core/branches/flat/src/main/java/org/jboss/cache/loader/SingletonStoreCacheLoader.java 2008-10-10
12:52:50 UTC (rev 6902)
+++
core/branches/flat/src/main/java/org/jboss/cache/loader/SingletonStoreCacheLoader.java 2008-10-10
15:25:26 UTC (rev 6903)
@@ -27,14 +27,14 @@
import org.jboss.cache.Fqn;
import org.jboss.cache.Modification;
import org.jboss.cache.NodeSPI;
-import org.jboss.cache.notifications.annotation.CacheListener;
-import org.jboss.cache.notifications.annotation.CacheStarted;
-import org.jboss.cache.notifications.annotation.CacheStopped;
-import org.jboss.cache.notifications.annotation.ViewChanged;
-import org.jboss.cache.notifications.event.Event;
-import org.jboss.cache.notifications.event.ViewChangedEvent;
import org.jboss.starobrno.config.CacheLoaderConfig;
import
org.jboss.starobrno.config.CacheLoaderConfig.IndividualCacheLoaderConfig.SingletonStoreConfig;
+import org.jboss.starobrno.notifications.annotation.CacheListener;
+import org.jboss.starobrno.notifications.annotation.CacheStarted;
+import org.jboss.starobrno.notifications.annotation.CacheStopped;
+import org.jboss.starobrno.notifications.annotation.ViewChanged;
+import org.jboss.starobrno.notifications.event.Event;
+import org.jboss.starobrno.notifications.event.ViewChangedEvent;
import org.jgroups.Address;
import org.jgroups.View;
Modified:
core/branches/flat/src/main/java/org/jboss/cache/statetransfer/DefaultStateTransferIntegrator.java
===================================================================
---
core/branches/flat/src/main/java/org/jboss/cache/statetransfer/DefaultStateTransferIntegrator.java 2008-10-10
12:52:50 UTC (rev 6902)
+++
core/branches/flat/src/main/java/org/jboss/cache/statetransfer/DefaultStateTransferIntegrator.java 2008-10-10
15:25:26 UTC (rev 6903)
@@ -35,7 +35,6 @@
import org.jboss.cache.marshall.NodeData;
import org.jboss.cache.marshall.NodeDataExceptionMarker;
import org.jboss.cache.marshall.NodeDataMarker;
-import org.jboss.cache.notifications.event.NodeModifiedEvent;
import org.jboss.starobrno.CacheException;
import org.jboss.starobrno.config.Configuration;
import org.jboss.starobrno.factories.annotations.Inject;
@@ -43,7 +42,6 @@
import java.io.IOException;
import java.io.ObjectInputStream;
-import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
@@ -192,13 +190,13 @@
{
if (curr == null) return;
ctx.setOriginLocal(false);
- cache.getNotifier().notifyNodeCreated(curr.getFqn(), true, ctx);
- cache.getNotifier().notifyNodeCreated(curr.getFqn(), false, ctx);
+// cache.getNotifier().notifyNodeCreated(curr.getFqn(), true, ctx);
+// cache.getNotifier().notifyNodeCreated(curr.getFqn(), false, ctx);
// AND notify that they have been modified!!
if (!curr.getKeys().isEmpty())
{
- cache.getNotifier().notifyNodeModified(curr.getFqn(), true,
NodeModifiedEvent.ModificationType.PUT_MAP, Collections.emptyMap(), ctx);
- cache.getNotifier().notifyNodeModified(curr.getFqn(), false,
NodeModifiedEvent.ModificationType.PUT_MAP, curr.getData(), ctx);
+// cache.getNotifier().notifyNodeModified(curr.getFqn(), true,
NodeModifiedEvent.ModificationType.PUT_MAP, Collections.emptyMap(), ctx);
+// cache.getNotifier().notifyNodeModified(curr.getFqn(), false,
NodeModifiedEvent.ModificationType.PUT_MAP, curr.getData(), ctx);
}
ctx.setOriginLocal(true);
Modified:
core/branches/flat/src/main/java/org/jboss/starobrno/commands/CommandsFactoryImpl.java
===================================================================
---
core/branches/flat/src/main/java/org/jboss/starobrno/commands/CommandsFactoryImpl.java 2008-10-10
12:52:50 UTC (rev 6902)
+++
core/branches/flat/src/main/java/org/jboss/starobrno/commands/CommandsFactoryImpl.java 2008-10-10
15:25:26 UTC (rev 6903)
@@ -59,7 +59,7 @@
public PutKeyValueCommand buildPutKeyValueCommand(Object key, Object value)
{
- return new PutKeyValueCommand(key, value, false);
+ return new PutKeyValueCommand(key, value, false, notifier);
}
public RemoveCommand buildRemoveCommand(Object key, Object value)
@@ -84,7 +84,7 @@
public PutMapCommand buildPutMapCommand(Map map)
{
- return new PutMapCommand(map);
+ return new PutMapCommand(map, notifier);
}
public ClearCommand buildClearCommand()
@@ -120,9 +120,17 @@
case PutKeyValueCommand.METHOD_ID:
{
PutKeyValueCommand c = new PutKeyValueCommand();
+ c.init(notifier);
command = c;
break;
}
+ case PutMapCommand.METHOD_ID:
+ {
+ PutMapCommand c = new PutMapCommand();
+ c.init(notifier);
+ command = c;
+ break;
+ }
case RemoveCommand.METHOD_ID:
{
RemoveCommand c = new RemoveCommand();
Modified:
core/branches/flat/src/main/java/org/jboss/starobrno/commands/ReplicableCommand.java
===================================================================
---
core/branches/flat/src/main/java/org/jboss/starobrno/commands/ReplicableCommand.java 2008-10-10
12:52:50 UTC (rev 6902)
+++
core/branches/flat/src/main/java/org/jboss/starobrno/commands/ReplicableCommand.java 2008-10-10
15:25:26 UTC (rev 6903)
@@ -50,7 +50,7 @@
*
* @return the method id of this command. This is compatible with pre-2.2.0
MethodCall ids.
*/
- int getCommandId();
+ byte getCommandId();
/**
* Used by marshallers to stream this command across a network
Modified:
core/branches/flat/src/main/java/org/jboss/starobrno/commands/read/GetKeyValueCommand.java
===================================================================
---
core/branches/flat/src/main/java/org/jboss/starobrno/commands/read/GetKeyValueCommand.java 2008-10-10
12:52:50 UTC (rev 6902)
+++
core/branches/flat/src/main/java/org/jboss/starobrno/commands/read/GetKeyValueCommand.java 2008-10-10
15:25:26 UTC (rev 6903)
@@ -36,7 +36,7 @@
*/
public class GetKeyValueCommand extends AbstractDataCommand
{
- public static final int METHOD_ID = 26;
+ public static final byte METHOD_ID = 26;
private static final Log log = LogFactory.getLog(GetKeyValueCommand.class);
private static final boolean trace = log.isTraceEnabled();
private Notifier notifier;
@@ -77,7 +77,7 @@
return result;
}
- public int getCommandId()
+ public byte getCommandId()
{
return METHOD_ID;
}
Modified:
core/branches/flat/src/main/java/org/jboss/starobrno/commands/read/GravitateDataCommand.java
===================================================================
---
core/branches/flat/src/main/java/org/jboss/starobrno/commands/read/GravitateDataCommand.java 2008-10-10
12:52:50 UTC (rev 6902)
+++
core/branches/flat/src/main/java/org/jboss/starobrno/commands/read/GravitateDataCommand.java 2008-10-10
15:25:26 UTC (rev 6903)
@@ -41,7 +41,7 @@
*/
public class GravitateDataCommand extends AbstractDataCommand
{
- public static final int METHOD_ID = 35;
+ public static final byte METHOD_ID = 35;
/* dependencies */
private CacheSPI spi;
@@ -202,7 +202,7 @@
return visitor.visitGravitateDataCommand(ctx, this);
}
- public int getCommandId()
+ public byte getCommandId()
{
return METHOD_ID;
}
Modified:
core/branches/flat/src/main/java/org/jboss/starobrno/commands/read/SizeCommand.java
===================================================================
---
core/branches/flat/src/main/java/org/jboss/starobrno/commands/read/SizeCommand.java 2008-10-10
12:52:50 UTC (rev 6902)
+++
core/branches/flat/src/main/java/org/jboss/starobrno/commands/read/SizeCommand.java 2008-10-10
15:25:26 UTC (rev 6903)
@@ -51,7 +51,7 @@
return container.size();
}
- public int getCommandId()
+ public byte getCommandId()
{
return 0; // no-op
}
Modified:
core/branches/flat/src/main/java/org/jboss/starobrno/commands/remote/AnnounceBuddyPoolNameCommand.java
===================================================================
---
core/branches/flat/src/main/java/org/jboss/starobrno/commands/remote/AnnounceBuddyPoolNameCommand.java 2008-10-10
12:52:50 UTC (rev 6902)
+++
core/branches/flat/src/main/java/org/jboss/starobrno/commands/remote/AnnounceBuddyPoolNameCommand.java 2008-10-10
15:25:26 UTC (rev 6903)
@@ -38,7 +38,7 @@
*/
public class AnnounceBuddyPoolNameCommand implements ReplicableCommand
{
- public static final int METHOD_ID = 28;
+ public static final byte METHOD_ID = 28;
private static final Log log = LogFactory.getLog(AnnounceBuddyPoolNameCommand.class);
/* dependencies*/
@@ -79,7 +79,7 @@
return null;
}
- public int getCommandId()
+ public byte getCommandId()
{
return METHOD_ID;
}
Modified:
core/branches/flat/src/main/java/org/jboss/starobrno/commands/remote/AssignToBuddyGroupCommand.java
===================================================================
---
core/branches/flat/src/main/java/org/jboss/starobrno/commands/remote/AssignToBuddyGroupCommand.java 2008-10-10
12:52:50 UTC (rev 6902)
+++
core/branches/flat/src/main/java/org/jboss/starobrno/commands/remote/AssignToBuddyGroupCommand.java 2008-10-10
15:25:26 UTC (rev 6903)
@@ -40,7 +40,7 @@
*/
public class AssignToBuddyGroupCommand implements ReplicableCommand
{
- public static final int METHOD_ID = 29;
+ public static final byte METHOD_ID = 29;
/* dependencies */
private BuddyManager buddyManager;
@@ -78,7 +78,7 @@
return null;
}
- public int getCommandId()
+ public byte getCommandId()
{
return METHOD_ID;
}
Modified:
core/branches/flat/src/main/java/org/jboss/starobrno/commands/remote/ClusteredGetCommand.java
===================================================================
---
core/branches/flat/src/main/java/org/jboss/starobrno/commands/remote/ClusteredGetCommand.java 2008-10-10
12:52:50 UTC (rev 6902)
+++
core/branches/flat/src/main/java/org/jboss/starobrno/commands/remote/ClusteredGetCommand.java 2008-10-10
15:25:26 UTC (rev 6903)
@@ -43,7 +43,7 @@
*/
public class ClusteredGetCommand implements ReplicableCommand
{
- public static final int METHOD_ID = 22;
+ public static final byte METHOD_ID = 22;
private DataCommand dataCommand;
private boolean searchBackupSubtrees;
@@ -110,7 +110,7 @@
return results;
}
- public int getCommandId()
+ public byte getCommandId()
{
return METHOD_ID;
}
Modified:
core/branches/flat/src/main/java/org/jboss/starobrno/commands/remote/DataGravitationCleanupCommand.java
===================================================================
---
core/branches/flat/src/main/java/org/jboss/starobrno/commands/remote/DataGravitationCleanupCommand.java 2008-10-10
12:52:50 UTC (rev 6902)
+++
core/branches/flat/src/main/java/org/jboss/starobrno/commands/remote/DataGravitationCleanupCommand.java 2008-10-10
15:25:26 UTC (rev 6903)
@@ -45,7 +45,7 @@
*/
public class DataGravitationCleanupCommand implements ReplicableCommand
{
- public static final int METHOD_ID = 34;
+ public static final byte METHOD_ID = 34;
private static final Log log =
LogFactory.getLog(DataGravitationCleanupCommand.class);
private static final boolean trace = log.isTraceEnabled();
@@ -173,7 +173,7 @@
// }
// }
- public int getCommandId()
+ public byte getCommandId()
{
return METHOD_ID;
}
Modified:
core/branches/flat/src/main/java/org/jboss/starobrno/commands/remote/RemoveFromBuddyGroupCommand.java
===================================================================
---
core/branches/flat/src/main/java/org/jboss/starobrno/commands/remote/RemoveFromBuddyGroupCommand.java 2008-10-10
12:52:50 UTC (rev 6902)
+++
core/branches/flat/src/main/java/org/jboss/starobrno/commands/remote/RemoveFromBuddyGroupCommand.java 2008-10-10
15:25:26 UTC (rev 6903)
@@ -35,7 +35,7 @@
*/
public class RemoveFromBuddyGroupCommand implements ReplicableCommand
{
- public static final int METHOD_ID = 30;
+ public static final byte METHOD_ID = 30;
private BuddyManager buddyManager;
@@ -68,7 +68,7 @@
return null;
}
- public int getCommandId()
+ public byte getCommandId()
{
return METHOD_ID;
}
Modified:
core/branches/flat/src/main/java/org/jboss/starobrno/commands/remote/ReplicateCommand.java
===================================================================
---
core/branches/flat/src/main/java/org/jboss/starobrno/commands/remote/ReplicateCommand.java 2008-10-10
12:52:50 UTC (rev 6902)
+++
core/branches/flat/src/main/java/org/jboss/starobrno/commands/remote/ReplicateCommand.java 2008-10-10
15:25:26 UTC (rev 6903)
@@ -45,8 +45,8 @@
*/
public class ReplicateCommand implements ReplicableCommand
{
- public static final int SINGLE_METHOD_ID = 13;
- public static final int MULTIPLE_METHOD_ID = 14;
+ public static final byte SINGLE_METHOD_ID = 13;
+ public static final byte MULTIPLE_METHOD_ID = 14;
private InterceptorChain invoker;
@@ -172,7 +172,7 @@
return cacheCommand instanceof GravitateDataCommand || cacheCommand instanceof
ClusteredGetCommand;
}
- public int getCommandId()
+ public byte getCommandId()
{
return isSingleCommand() ? SINGLE_METHOD_ID : MULTIPLE_METHOD_ID;
}
Modified:
core/branches/flat/src/main/java/org/jboss/starobrno/commands/tx/CommitCommand.java
===================================================================
---
core/branches/flat/src/main/java/org/jboss/starobrno/commands/tx/CommitCommand.java 2008-10-10
12:52:50 UTC (rev 6902)
+++
core/branches/flat/src/main/java/org/jboss/starobrno/commands/tx/CommitCommand.java 2008-10-10
15:25:26 UTC (rev 6903)
@@ -33,7 +33,7 @@
*/
public class CommitCommand extends AbstractTransactionBoundaryCommand
{
- public static final int METHOD_ID = 11;
+ public static final byte METHOD_ID = 11;
public CommitCommand(GlobalTransaction gtx)
{
@@ -49,7 +49,7 @@
return visitor.visitCommitCommand(ctx, this);
}
- public int getCommandId()
+ public byte getCommandId()
{
return METHOD_ID;
}
Modified:
core/branches/flat/src/main/java/org/jboss/starobrno/commands/tx/PrepareCommand.java
===================================================================
---
core/branches/flat/src/main/java/org/jboss/starobrno/commands/tx/PrepareCommand.java 2008-10-10
12:52:50 UTC (rev 6902)
+++
core/branches/flat/src/main/java/org/jboss/starobrno/commands/tx/PrepareCommand.java 2008-10-10
15:25:26 UTC (rev 6903)
@@ -40,7 +40,7 @@
*/
public class PrepareCommand extends AbstractTransactionBoundaryCommand
{
- public static final int METHOD_ID = 10;
+ public static final byte METHOD_ID = 10;
protected List<DataCommand> modifications;
protected Address localAddress;
@@ -93,7 +93,7 @@
return modifications != null ? modifications.size() : 0;
}
- public int getCommandId()
+ public byte getCommandId()
{
return METHOD_ID;
}
Modified:
core/branches/flat/src/main/java/org/jboss/starobrno/commands/tx/RollbackCommand.java
===================================================================
---
core/branches/flat/src/main/java/org/jboss/starobrno/commands/tx/RollbackCommand.java 2008-10-10
12:52:50 UTC (rev 6902)
+++
core/branches/flat/src/main/java/org/jboss/starobrno/commands/tx/RollbackCommand.java 2008-10-10
15:25:26 UTC (rev 6903)
@@ -33,7 +33,7 @@
*/
public class RollbackCommand extends AbstractTransactionBoundaryCommand
{
- public static final int METHOD_ID = 12;
+ public static final byte METHOD_ID = 12;
public RollbackCommand(GlobalTransaction globalTransaction)
{
@@ -49,7 +49,7 @@
return visitor.visitRollbackCommand(ctx, this);
}
- public int getCommandId()
+ public byte getCommandId()
{
return METHOD_ID;
}
Modified:
core/branches/flat/src/main/java/org/jboss/starobrno/commands/write/ClearCommand.java
===================================================================
---
core/branches/flat/src/main/java/org/jboss/starobrno/commands/write/ClearCommand.java 2008-10-10
12:52:50 UTC (rev 6902)
+++
core/branches/flat/src/main/java/org/jboss/starobrno/commands/write/ClearCommand.java 2008-10-10
15:25:26 UTC (rev 6903)
@@ -32,7 +32,7 @@
public class ClearCommand implements VisitableCommand
{
private static final Object[] params = new Object[0];
- public static final int METHOD_ID = 17;
+ public static final byte METHOD_ID = 17;
public Object acceptVisitor(InvocationContext ctx, Visitor visitor) throws Throwable
{
@@ -54,7 +54,7 @@
return params;
}
- public int getCommandId()
+ public byte getCommandId()
{
return METHOD_ID;
}
Modified:
core/branches/flat/src/main/java/org/jboss/starobrno/commands/write/EvictCommand.java
===================================================================
---
core/branches/flat/src/main/java/org/jboss/starobrno/commands/write/EvictCommand.java 2008-10-10
12:52:50 UTC (rev 6902)
+++
core/branches/flat/src/main/java/org/jboss/starobrno/commands/write/EvictCommand.java 2008-10-10
15:25:26 UTC (rev 6903)
@@ -31,7 +31,7 @@
*/
public class EvictCommand extends AbstractDataCommand
{
- public static final int METHOD_ID = 3000;
+ public static final byte METHOD_ID = 120;
public EvictCommand(Object key)
{
@@ -58,7 +58,7 @@
return null;
}
- public int getCommandId()
+ public byte getCommandId()
{
return METHOD_ID;
}
Modified:
core/branches/flat/src/main/java/org/jboss/starobrno/commands/write/PutKeyValueCommand.java
===================================================================
---
core/branches/flat/src/main/java/org/jboss/starobrno/commands/write/PutKeyValueCommand.java 2008-10-10
12:52:50 UTC (rev 6902)
+++
core/branches/flat/src/main/java/org/jboss/starobrno/commands/write/PutKeyValueCommand.java 2008-10-10
15:25:26 UTC (rev 6903)
@@ -25,6 +25,7 @@
import org.jboss.starobrno.commands.read.AbstractDataCommand;
import org.jboss.starobrno.container.MVCCEntry;
import org.jboss.starobrno.context.InvocationContext;
+import org.jboss.starobrno.notifications.Notifier;
/**
* Implements functionality defined by {@link Cache#put(org.jboss.cache.Fqn, Object,
Object)}.
@@ -34,18 +35,25 @@
*/
public class PutKeyValueCommand extends AbstractDataCommand
{
- public static final int METHOD_ID = 3;
+ public static final byte METHOD_ID = 3;
protected Object value;
protected boolean putIfAbsent;
+ private Notifier notifier;
- public PutKeyValueCommand(Object key, Object value, boolean putIfAbsent)
+ public PutKeyValueCommand(Object key, Object value, boolean putIfAbsent, Notifier
notifier)
{
super(key);
this.value = value;
this.putIfAbsent = putIfAbsent;
+ this.notifier = notifier;
}
+ public void init(Notifier notifier)
+ {
+ this.notifier = notifier;
+ }
+
public PutKeyValueCommand()
{
}
@@ -67,11 +75,14 @@
public Object perform(InvocationContext ctx) throws Throwable
{
+ notifier.notifyCacheEntryModified(key, true, ctx);
MVCCEntry e = ctx.lookupEntry(key);
- return e.setValue(value);
+ Object o = e.setValue(value);
+ notifier.notifyCacheEntryModified(key, false, ctx);
+ return o;
}
- public int getCommandId()
+ public byte getCommandId()
{
return METHOD_ID;
}
Modified:
core/branches/flat/src/main/java/org/jboss/starobrno/commands/write/PutMapCommand.java
===================================================================
---
core/branches/flat/src/main/java/org/jboss/starobrno/commands/write/PutMapCommand.java 2008-10-10
12:52:50 UTC (rev 6902)
+++
core/branches/flat/src/main/java/org/jboss/starobrno/commands/write/PutMapCommand.java 2008-10-10
15:25:26 UTC (rev 6903)
@@ -25,6 +25,7 @@
import org.jboss.starobrno.commands.Visitor;
import org.jboss.starobrno.container.MVCCEntry;
import org.jboss.starobrno.context.InvocationContext;
+import org.jboss.starobrno.notifications.Notifier;
import java.util.Map;
import java.util.Map.Entry;
@@ -34,15 +35,22 @@
*/
public class PutMapCommand implements VisitableCommand
{
- public static final int METHOD_ID = 2000;
+ public static final byte METHOD_ID = 121;
private Map<Object, Object> map;
+ private Notifier notifier;
- public PutMapCommand(Map map)
+ public PutMapCommand(Map map, Notifier notifier)
{
this.map = map;
+ this.notifier = notifier;
}
+ public void init(Notifier notifier)
+ {
+ this.notifier = notifier;
+ }
+
public PutMapCommand()
{
}
@@ -56,8 +64,11 @@
{
for (Entry<Object, Object> e : map.entrySet())
{
- MVCCEntry me = ctx.lookupEntry(e.getKey());
+ Object key = e.getKey();
+ MVCCEntry me = ctx.lookupEntry(key);
+ notifier.notifyCacheEntryModified(key, true, ctx);
if (me != null) me.setValue(e.getValue());
+ notifier.notifyCacheEntryModified(key, false, ctx);
}
return null;
}
@@ -72,7 +83,7 @@
this.map = map;
}
- public int getCommandId()
+ public byte getCommandId()
{
return METHOD_ID;
}
Modified:
core/branches/flat/src/main/java/org/jboss/starobrno/commands/write/RemoveCommand.java
===================================================================
---
core/branches/flat/src/main/java/org/jboss/starobrno/commands/write/RemoveCommand.java 2008-10-10
12:52:50 UTC (rev 6902)
+++
core/branches/flat/src/main/java/org/jboss/starobrno/commands/write/RemoveCommand.java 2008-10-10
15:25:26 UTC (rev 6903)
@@ -32,7 +32,7 @@
*/
public class RemoveCommand extends AbstractDataCommand
{
- public static final int METHOD_ID = 6;
+ public static final byte METHOD_ID = 6;
protected Object value;
@@ -60,7 +60,7 @@
return e.getValue();
}
- public int getCommandId()
+ public byte getCommandId()
{
return METHOD_ID;
}
Modified:
core/branches/flat/src/main/java/org/jboss/starobrno/commands/write/ReplaceCommand.java
===================================================================
---
core/branches/flat/src/main/java/org/jboss/starobrno/commands/write/ReplaceCommand.java 2008-10-10
12:52:50 UTC (rev 6902)
+++
core/branches/flat/src/main/java/org/jboss/starobrno/commands/write/ReplaceCommand.java 2008-10-10
15:25:26 UTC (rev 6903)
@@ -32,7 +32,7 @@
*/
public class ReplaceCommand extends AbstractDataCommand
{
- public static final int METHOD_ID = 99;
+ public static final byte METHOD_ID = 122;
protected Object oldValue;
protected Object newValue;
@@ -65,7 +65,7 @@
return false;
}
- public int getCommandId()
+ public byte getCommandId()
{
return METHOD_ID;
}
Added:
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/IncorrectCacheListenerException.java
===================================================================
---
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/IncorrectCacheListenerException.java
(rev 0)
+++
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/IncorrectCacheListenerException.java 2008-10-10
15:25:26 UTC (rev 6903)
@@ -0,0 +1,41 @@
+/*
+ * 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.starobrno.notifications;
+
+import org.jboss.starobrno.CacheException;
+
+/**
+ * Thrown when an incorrectly annotated class is added as a cache listener using the
{@link org.jboss.cache.Cache_Legacy#addCacheListener(Object)} API.
+ *
+ * @author <a href="mailto:manik@jboss.org">Manik Surtani</a>
+ * @since 2.0.0
+ */
+public class IncorrectCacheListenerException extends CacheException
+{
+
+ private static final long serialVersionUID = 3847404572671886703L;
+
+ public IncorrectCacheListenerException(String s)
+ {
+ super(s);
+ }
+}
Modified:
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/Notifier.java
===================================================================
---
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/Notifier.java 2008-10-10
12:52:50 UTC (rev 6902)
+++
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/Notifier.java 2008-10-10
15:25:26 UTC (rev 6903)
@@ -23,11 +23,9 @@
import org.jboss.cache.buddyreplication.BuddyGroup;
import org.jboss.starobrno.context.InvocationContext;
-import org.jboss.starobrno.notifications.event.NodeModifiedEvent;
import org.jgroups.View;
import javax.transaction.Transaction;
-import java.util.Map;
import java.util.Set;
/**
@@ -41,12 +39,12 @@
/**
* Notifies all registered listeners of a nodeCreated event.
*/
- void notifyNodeCreated(Object key, boolean pre, InvocationContext ctx);
+ void notifyCacheEntryCreated(Object key, boolean pre, InvocationContext ctx);
/**
* Notifies all registered listeners of a nodeModified event.
*/
- void notifyNodeModified(Object key, boolean pre, NodeModifiedEvent.ModificationType
modificationType, Map data, InvocationContext ctx);
+ void notifyCacheEntryModified(Object key, boolean pre, InvocationContext ctx);
/**
* When notifying about node modifications, in many scenarios there is a need of
building a new Map object. If no
@@ -58,37 +56,37 @@
/**
* Notifies all registered listeners of a nodeRemoved event.
*/
- void notifyNodeRemoved(Object key, boolean pre, Map data, InvocationContext ctx);
+ void notifyCacheEntryRemoved(Object key, boolean pre, InvocationContext ctx);
/**
* Notifies all registered listeners of a nodeVisited event.
*/
- void notifyNodeVisited(Object key, boolean pre, InvocationContext ctx);
+ void notifyCacheEntryVisited(Object key, boolean pre, InvocationContext ctx);
/**
* Notifies all registered listeners of a nodeEvicted event.
*/
- void notifyNodeEvicted(Object key, boolean pre, InvocationContext ctx);
+ void notifyCacheEntryEvicted(Object key, boolean pre, InvocationContext ctx);
/**
* Notifies all registered listeners of a nodeInvalidated event.
*/
- void notifyNodeInvalidated(Object key, boolean pre, InvocationContext ctx);
+ void notifyCacheEntryInvalidated(Object key, boolean pre, InvocationContext ctx);
/**
* Notifies all registered listeners of a nodeLoaded event.
*/
- void notifyNodeLoaded(Object key, boolean pre, Map data, InvocationContext ctx);
+ void notifyCacheEntryLoaded(Object key, boolean pre, InvocationContext ctx);
/**
* Notifies all registered listeners of a nodeActivated event.
*/
- void notifyNodeActivated(Object key, boolean pre, Map data, InvocationContext ctx);
+ void notifyCacheEntryActivated(Object key, boolean pre, InvocationContext ctx);
/**
* Notifies all registered listeners of a nodePassivated event.
*/
- void notifyNodePassivated(Object key, boolean pre, Map data, InvocationContext ctx);
+ void notifyCacheEntryPassivated(Object key, boolean pre, InvocationContext ctx);
/**
* Notifies all registered listeners of a viewChange event. Note that viewChange
notifications are ALWAYS sent
@@ -120,10 +118,6 @@
*/
void notifyTransactionRegistered(Transaction transaction, InvocationContext ctx);
- void notifyCacheBlocked(boolean pre);
-
- void notifyCacheUnblocked(boolean pre);
-
/**
* Adds a cache listener to the list of cache listeners registered.
*
Modified:
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/NotifierImpl.java
===================================================================
---
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/NotifierImpl.java 2008-10-10
12:52:50 UTC (rev 6902)
+++
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/NotifierImpl.java 2008-10-10
15:25:26 UTC (rev 6903)
@@ -23,13 +23,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.Fqn;
import org.jboss.cache.buddyreplication.BuddyGroup;
-import org.jboss.cache.notifications.IncorrectCacheListenerException;
-import org.jboss.cache.notifications.annotation.*;
-import org.jboss.cache.notifications.event.*;
-import static org.jboss.cache.notifications.event.Event.Type.*;
-import org.jboss.cache.util.Immutables;
import org.jboss.cache.util.concurrent.WithinThreadExecutor;
import org.jboss.starobrno.Cache;
import org.jboss.starobrno.CacheException;
@@ -41,8 +35,9 @@
import org.jboss.starobrno.factories.annotations.NonVolatile;
import org.jboss.starobrno.factories.annotations.Start;
import org.jboss.starobrno.factories.annotations.Stop;
-import org.jboss.starobrno.marshall.MarshalledValueMap;
-import org.jboss.starobrno.notifications.event.NodeModifiedEvent;
+import org.jboss.starobrno.notifications.annotation.*;
+import org.jboss.starobrno.notifications.event.*;
+import static org.jboss.starobrno.notifications.event.Event.Type.*;
import org.jgroups.View;
import javax.transaction.Transaction;
@@ -77,27 +72,24 @@
private static final Class singletonMap = Collections.singletonMap(null,
null).getClass();
private static final Class[] allowedMethodAnnotations =
{
- CacheStarted.class, CacheStopped.class, CacheBlocked.class,
CacheUnblocked.class, NodeCreated.class, NodeRemoved.class, NodeVisited.class,
NodeModified.class, NodeMoved.class,
- NodeActivated.class, NodePassivated.class, NodeLoaded.class,
NodeEvicted.class, TransactionRegistered.class, TransactionCompleted.class,
ViewChanged.class, BuddyGroupChanged.class,
- NodeInvalidated.class
+ CacheStarted.class, CacheStopped.class, CacheEntryCreated.class,
CacheEntryRemoved.class, CacheEntryVisited.class, CacheEntryModified.class,
+ CacheEntryActivated.class, CacheEntryPassivated.class,
CacheEntryLoaded.class, CacheEntryEvicted.class, TransactionRegistered.class,
TransactionCompleted.class, ViewChanged.class, BuddyGroupChanged.class,
+ CacheEntryInvalidated.class
};
private static final Class[] parameterTypes =
{
- CacheStartedEvent.class, CacheStoppedEvent.class, CacheBlockedEvent.class,
CacheUnblockedEvent.class, NodeCreatedEvent.class, NodeRemovedEvent.class,
NodeVisitedEvent.class, NodeModifiedEvent.class, NodeMovedEvent.class,
- NodeActivatedEvent.class, NodePassivatedEvent.class,
NodeLoadedEvent.class, NodeEvictedEvent.class, TransactionRegisteredEvent.class,
TransactionCompletedEvent.class, ViewChangedEvent.class, BuddyGroupChangedEvent.class,
- NodeInvalidatedEvent.class
+ CacheStartedEvent.class, CacheStoppedEvent.class,
CacheEntryCreatedEvent.class, CacheEntryRemovedEvent.class, CacheEntryVisitedEvent.class,
CacheEntryModifiedEvent.class,
+ CacheEntryActivatedEvent.class, CacheEntryPassivatedEvent.class,
CacheEntryLoadedEvent.class, CacheEntryEvictedEvent.class,
TransactionRegisteredEvent.class, TransactionCompletedEvent.class, ViewChangedEvent.class,
BuddyGroupChangedEvent.class,
+ CacheEntryInvalidatedEvent.class
};
- final Map<Class<? extends Annotation>, List<ListenerInvocation>>
listenersMap = new HashMap<Class<? extends Annotation>,
List<ListenerInvocation>>(32);
+ final Map<Class<? extends Annotation>, List<ListenerInvocation>>
listenersMap = new HashMap<Class<? extends Annotation>,
List<ListenerInvocation>>(16, 0.99f);
final List<ListenerInvocation> cacheStartedListeners = new
CopyOnWriteArrayList<ListenerInvocation>();
final List<ListenerInvocation> cacheStoppedListeners = new
CopyOnWriteArrayList<ListenerInvocation>();
- final List<ListenerInvocation> cacheBlockedListeners = new
CopyOnWriteArrayList<ListenerInvocation>();
- final List<ListenerInvocation> cacheUnblockedListeners = new
CopyOnWriteArrayList<ListenerInvocation>();
final List<ListenerInvocation> nodeCreatedListeners = new
CopyOnWriteArrayList<ListenerInvocation>();
final List<ListenerInvocation> nodeRemovedListeners = new
CopyOnWriteArrayList<ListenerInvocation>();
final List<ListenerInvocation> nodeVisitedListeners = new
CopyOnWriteArrayList<ListenerInvocation>();
final List<ListenerInvocation> nodeModifiedListeners = new
CopyOnWriteArrayList<ListenerInvocation>();
- final List<ListenerInvocation> nodeMovedListeners = new
CopyOnWriteArrayList<ListenerInvocation>();
final List<ListenerInvocation> nodeActivatedListeners = new
CopyOnWriteArrayList<ListenerInvocation>();
final List<ListenerInvocation> nodePassivatedListeners = new
CopyOnWriteArrayList<ListenerInvocation>();
final List<ListenerInvocation> nodeLoadedListeners = new
CopyOnWriteArrayList<ListenerInvocation>();
@@ -121,22 +113,19 @@
{
listenersMap.put(CacheStarted.class, cacheStartedListeners);
listenersMap.put(CacheStopped.class, cacheStoppedListeners);
- listenersMap.put(CacheBlocked.class, cacheBlockedListeners);
- listenersMap.put(CacheUnblocked.class, cacheUnblockedListeners);
- listenersMap.put(NodeCreated.class, nodeCreatedListeners);
- listenersMap.put(NodeRemoved.class, nodeRemovedListeners);
- listenersMap.put(NodeVisited.class, nodeVisitedListeners);
- listenersMap.put(NodeModified.class, nodeModifiedListeners);
- listenersMap.put(NodeMoved.class, nodeMovedListeners);
- listenersMap.put(NodeActivated.class, nodeActivatedListeners);
- listenersMap.put(NodePassivated.class, nodePassivatedListeners);
- listenersMap.put(NodeLoaded.class, nodeLoadedListeners);
- listenersMap.put(NodeEvicted.class, nodeEvictedListeners);
+ listenersMap.put(CacheEntryCreated.class, nodeCreatedListeners);
+ listenersMap.put(CacheEntryRemoved.class, nodeRemovedListeners);
+ listenersMap.put(CacheEntryVisited.class, nodeVisitedListeners);
+ listenersMap.put(CacheEntryModified.class, nodeModifiedListeners);
+ listenersMap.put(CacheEntryActivated.class, nodeActivatedListeners);
+ listenersMap.put(CacheEntryPassivated.class, nodePassivatedListeners);
+ listenersMap.put(CacheEntryLoaded.class, nodeLoadedListeners);
+ listenersMap.put(CacheEntryEvicted.class, nodeEvictedListeners);
listenersMap.put(TransactionRegistered.class, transactionRegisteredListeners);
listenersMap.put(TransactionCompleted.class, transactionCompletedListeners);
listenersMap.put(ViewChanged.class, viewChangedListeners);
listenersMap.put(BuddyGroupChanged.class, buddyGroupChangedListeners);
- listenersMap.put(NodeInvalidated.class, nodeInvalidatedListeners);
+ listenersMap.put(CacheEntryInvalidated.class, nodeInvalidatedListeners);
}
@Inject
@@ -280,13 +269,10 @@
{
cacheStartedListeners.clear();
cacheStoppedListeners.clear();
- cacheBlockedListeners.clear();
- cacheUnblockedListeners.clear();
nodeCreatedListeners.clear();
nodeRemovedListeners.clear();
nodeVisitedListeners.clear();
nodeModifiedListeners.clear();
- nodeMovedListeners.clear();
nodeActivatedListeners.clear();
nodePassivatedListeners.clear();
nodeLoadedListeners.clear();
@@ -307,7 +293,7 @@
return Collections.unmodifiableSet(result);
}
- public void notifyNodeCreated(Object key, boolean pre, InvocationContext ctx)
+ public void notifyCacheEntryCreated(Object key, boolean pre, InvocationContext ctx)
{
if (!nodeCreatedListeners.isEmpty())
{
@@ -318,31 +304,28 @@
e.setCache(cache);
e.setOriginLocal(originLocal);
e.setPre(pre);
-// e.setFqn(fqn); // TODO - attach key
+ e.setKey(key);
e.setTransaction(tx);
- e.setType(NODE_CREATED);
+ e.setType(CACHE_ENTRY_CREATED);
for (ListenerInvocation listener : nodeCreatedListeners) listener.invoke(e);
restoreInvocationContext(backup);
}
}
- public void notifyNodeModified(Object key, boolean pre,
NodeModifiedEvent.ModificationType modificationType, Map data, InvocationContext ctx)
+ public void notifyCacheEntryModified(Object key, boolean pre, InvocationContext ctx)
{
if (!nodeModifiedListeners.isEmpty())
{
boolean originLocal = ctx.isOriginLocal();
- Map dataCopy = copy(data, useMarshalledValueMaps);
Transaction tx = ctx.getTransaction();
InvocationContext backup = resetInvocationContext(ctx);
EventImpl e = new EventImpl();
e.setCache(cache);
e.setOriginLocal(originLocal);
e.setPre(pre);
-// e.setFqn(fqn); // TODO - attach key
+ e.setKey(key);
e.setTransaction(tx);
-// e.setModificationType(modificationType); // TODO fix types
- e.setData(dataCopy);
- e.setType(NODE_MODIFIED);
+ e.setType(CACHE_ENTRY_MODIFIED);
for (ListenerInvocation listener : nodeModifiedListeners) listener.invoke(e);
restoreInvocationContext(backup);
}
@@ -353,28 +336,26 @@
return !nodeModifiedListeners.isEmpty();
}
- public void notifyNodeRemoved(Object key, boolean pre, Map data, InvocationContext
ctx)
+ public void notifyCacheEntryRemoved(Object key, boolean pre, InvocationContext ctx)
{
if (!nodeRemovedListeners.isEmpty())
{
boolean originLocal = ctx.isOriginLocal();
- Map dataCopy = copy(data, useMarshalledValueMaps);
Transaction tx = ctx.getTransaction();
InvocationContext backup = resetInvocationContext(ctx);
EventImpl e = new EventImpl();
e.setCache(cache);
e.setOriginLocal(originLocal);
e.setPre(pre);
-// e.setFqn(fqn); // TODO - attach key
+ e.setKey(key);
e.setTransaction(tx);
- e.setData(dataCopy);
- e.setType(NODE_REMOVED);
+ e.setType(CACHE_ENTRY_REMOVED);
for (ListenerInvocation listener : nodeRemovedListeners) listener.invoke(e);
restoreInvocationContext(backup);
}
}
- public void notifyNodeVisited(Object key, boolean pre, InvocationContext ctx)
+ public void notifyCacheEntryVisited(Object key, boolean pre, InvocationContext ctx)
{
if (!nodeVisitedListeners.isEmpty())
{
@@ -383,36 +364,16 @@
EventImpl e = new EventImpl();
e.setCache(cache);
e.setPre(pre);
-// e.setFqn(fqn); // TODO - attach key
+ e.setKey(key);
e.setTransaction(tx);
- e.setType(NODE_VISITED);
+ e.setType(CACHE_ENTRY_VISITED);
for (ListenerInvocation listener : nodeVisitedListeners) listener.invoke(e);
restoreInvocationContext(backup);
}
}
- public void notifyNodeMoved(Fqn originalFqn, Fqn newFqn, boolean pre,
InvocationContext ctx)
+ public void notifyCacheEntryEvicted(final Object key, final boolean pre,
InvocationContext ctx)
{
- if (!nodeMovedListeners.isEmpty())
- {
- boolean originLocal = ctx.isOriginLocal();
- Transaction tx = ctx.getTransaction();
- InvocationContext backup = resetInvocationContext(ctx);
- EventImpl e = new EventImpl();
- e.setCache(cache);
- e.setOriginLocal(originLocal);
- e.setPre(pre);
- e.setFqn(originalFqn);
- e.setTargetFqn(newFqn);
- e.setTransaction(tx);
- e.setType(NODE_MOVED);
- for (ListenerInvocation listener : nodeMovedListeners) listener.invoke(e);
- restoreInvocationContext(backup);
- }
- }
-
- public void notifyNodeEvicted(final Object key, final boolean pre, InvocationContext
ctx)
- {
if (!nodeEvictedListeners.isEmpty())
{
final boolean originLocal = ctx.isOriginLocal();
@@ -422,15 +383,15 @@
e.setCache(cache);
e.setOriginLocal(originLocal);
e.setPre(pre);
-// e.setFqn(fqn); // TODO - attach key
+ e.setKey(key);
e.setTransaction(tx);
- e.setType(NODE_EVICTED);
+ e.setType(CACHE_ENTRY_EVICTED);
for (ListenerInvocation listener : nodeEvictedListeners) listener.invoke(e);
restoreInvocationContext(backup);
}
}
- public void notifyNodeInvalidated(final Object key, final boolean pre,
InvocationContext ctx)
+ public void notifyCacheEntryInvalidated(final Object key, final boolean pre,
InvocationContext ctx)
{
if (!nodeInvalidatedListeners.isEmpty())
{
@@ -441,70 +402,64 @@
e.setCache(cache);
e.setOriginLocal(originLocal);
e.setPre(pre);
-// e.setFqn(fqn); // TODO - attach key
+ e.setKey(key);
e.setTransaction(tx);
- e.setType(NODE_INVALIDATED);
+ e.setType(CACHE_ENTRY_INVALIDATED);
for (ListenerInvocation listener : nodeInvalidatedListeners)
listener.invoke(e);
restoreInvocationContext(backup);
}
}
- public void notifyNodeLoaded(Object key, boolean pre, Map data, InvocationContext
ctx)
+ public void notifyCacheEntryLoaded(Object key, boolean pre, InvocationContext ctx)
{
if (!nodeLoadedListeners.isEmpty())
{
boolean originLocal = ctx.isOriginLocal();
- Map dataCopy = copy(data, useMarshalledValueMaps);
Transaction tx = ctx.getTransaction();
InvocationContext backup = resetInvocationContext(ctx);
EventImpl e = new EventImpl();
e.setCache(cache);
e.setOriginLocal(originLocal);
e.setPre(pre);
-// e.setFqn(fqn); // TODO - attach key
+ e.setKey(key);
e.setTransaction(tx);
- e.setData(dataCopy);
- e.setType(NODE_LOADED);
+ e.setType(CACHE_ENTRY_LOADED);
for (ListenerInvocation listener : nodeLoadedListeners) listener.invoke(e);
restoreInvocationContext(backup);
}
}
- public void notifyNodeActivated(Object key, boolean pre, Map data, InvocationContext
ctx)
+ public void notifyCacheEntryActivated(Object key, boolean pre, InvocationContext ctx)
{
if (!nodeActivatedListeners.isEmpty())
{
boolean originLocal = ctx.isOriginLocal();
- Map dataCopy = copy(data, useMarshalledValueMaps);
Transaction tx = ctx.getTransaction();
InvocationContext backup = resetInvocationContext(ctx);
EventImpl e = new EventImpl();
e.setCache(cache);
e.setOriginLocal(originLocal);
e.setPre(pre);
-// e.setFqn(fqn); // TODO - attach key
+ e.setKey(key);
e.setTransaction(tx);
- e.setData(dataCopy);
- e.setType(NODE_ACTIVATED);
+ e.setType(CACHE_ENTRY_ACTIVATED);
for (ListenerInvocation listener : nodeActivatedListeners) listener.invoke(e);
restoreInvocationContext(backup);
}
}
- public void notifyNodePassivated(Object key, boolean pre, Map data, InvocationContext
ctx)
+ public void notifyCacheEntryPassivated(Object key, boolean pre, InvocationContext
ctx)
{
if (!nodePassivatedListeners.isEmpty())
{
- Map dataCopy = copy(data, useMarshalledValueMaps);
Transaction tx = ctx.getTransaction();
InvocationContext backup = resetInvocationContext(ctx);
EventImpl e = new EventImpl();
e.setCache(cache);
e.setPre(pre);
-// e.setFqn(fqn); // TODO - attach key
+ e.setKey(key);
e.setTransaction(tx);
- e.setData(dataCopy);
- e.setType(NODE_PASSIVATED);
+ e.setType(CACHE_ENTRY_PASSIVATED);
for (ListenerInvocation listener : nodePassivatedListeners) listener.invoke(e);
restoreInvocationContext(backup);
}
@@ -600,39 +555,6 @@
}
}
- public void notifyCacheBlocked(boolean pre)
- {
- if (!cacheBlockedListeners.isEmpty())
- {
- EventImpl e = new EventImpl();
- e.setCache(this.cache);
- e.setPre(pre);
- e.setType(CACHE_BLOCKED);
- for (ListenerInvocation listener : cacheBlockedListeners) listener.invoke(e);
- }
- }
-
- public void notifyCacheUnblocked(boolean pre)
- {
- if (!cacheUnblockedListeners.isEmpty())
- {
- EventImpl e = new EventImpl();
- e.setCache(this.cache);
- e.setPre(pre);
- e.setType(CACHE_UNBLOCKED);
- for (ListenerInvocation listener : cacheUnblockedListeners) listener.invoke(e);
- }
- }
-
- private static Map copy(Map data, boolean useMarshalledValueMaps)
- {
- if (data == null) return null;
- if (data.isEmpty()) return Collections.emptyMap();
- if (safe(data)) return useMarshalledValueMaps ? new MarshalledValueMap(data) :
data;
- Map defensivelyCopiedData = Immutables.immutableMapCopy(data);
- return useMarshalledValueMaps ? new MarshalledValueMap(defensivelyCopiedData) :
defensivelyCopiedData;
- }
-
private void restoreInvocationContext(InvocationContext backup)
{
InvocationContext currentIC = cache.getInvocationContext();
@@ -659,23 +581,6 @@
}
/**
- * A map is deemed 'safe' to be passed as-is to a listener, if either of the
following are true:
- * <ul>
- * <li>It is null</li>
- * <li>It is an instance of {@link org.jboss.cache.util.ImmutableMapCopy}, which
is immutable</li>
- * <li>It is an instance of {@link java.util.Collections#emptyMap()}, which is
also immutable</li>
- * <li>It is an instance of {@link
java.util.Collections#singletonMap(Object,Object)}, which is also immutable</li>
- * </ul>
- *
- * @param map
- * @return
- */
- private static boolean safe(Map map)
- {
- return map == null || Immutables.isImmutable(map) ||
map.getClass().equals(emptyMap) || map.getClass().equals(singletonMap);
- }
-
- /**
* Class that encapsulates a valid invocation for a given registered listener -
containing a reference to the
* method to be invoked as well as the target object.
*/
Added:
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/annotation/BuddyGroupChanged.java
===================================================================
---
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/annotation/BuddyGroupChanged.java
(rev 0)
+++
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/annotation/BuddyGroupChanged.java 2008-10-10
15:25:26 UTC (rev 6903)
@@ -0,0 +1,49 @@
+/*
+ * 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.starobrno.notifications.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * This annotation should be used on methods that need to be notified when a buddy group
changes.
+ * <p/>
+ * Methods annotated with this annotation should be public and take in a single
parameter, a {@link org.jboss.cache.notifications.event.BuddyGroupChangedEvent}
+ * otherwise an {@link org.jboss.cache.notifications.IncorrectCacheListenerException}
will be thrown when registering
+ * your cache listener.
+ * <p/>
+ * This call back only occurs when a buddy group structure is changed. In a cache setup
where buddy replication is not
+ * enabled, this call back would never occur.
+ * <p/>
+ *
+ * @author <a href="mailto:manik@jboss.org">Manik Surtani</a>
+ * @see CacheListener
+ * @see org.jboss.cache.notifications.event.CacheBlockedEvent
+ * @since 2.1.0
+ */
+(a)Retention(RetentionPolicy.RUNTIME)
+(a)Target(ElementType.METHOD)
+public @interface BuddyGroupChanged
+{
+}
Added:
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/annotation/CacheEntryActivated.java
===================================================================
---
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/annotation/CacheEntryActivated.java
(rev 0)
+++
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/annotation/CacheEntryActivated.java 2008-10-10
15:25:26 UTC (rev 6903)
@@ -0,0 +1,45 @@
+/*
+ * 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.starobrno.notifications.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * This annotation should be used on methods that need to be notified when a node is
activated.
+ * <p/>
+ * Methods annotated with this annotation should be public and take in a single
parameter, a {@link org.jboss.cache.notifications.event.NodeActivatedEvent}
+ * otherwise an {@link org.jboss.cache.notifications.IncorrectCacheListenerException}
will be thrown when registering
+ * your cache listener.
+ *
+ * @author <a href="mailto:manik@jboss.org">Manik Surtani</a>
+ * @see CacheListener
+ * @see org.jboss.cache.notifications.annotation.NodePassivated
+ * @since 2.0.0
+ */
+(a)Retention(RetentionPolicy.RUNTIME)
+(a)Target(ElementType.METHOD)
+public @interface CacheEntryActivated
+{
+}
Added:
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/annotation/CacheEntryCreated.java
===================================================================
---
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/annotation/CacheEntryCreated.java
(rev 0)
+++
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/annotation/CacheEntryCreated.java 2008-10-10
15:25:26 UTC (rev 6903)
@@ -0,0 +1,44 @@
+/*
+ * 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.starobrno.notifications.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * This annotation should be used on methods that need to be notified when a node is
created.
+ * <p/>
+ * Methods annotated with this annotation should be public and take in a single
parameter, a {@link org.jboss.cache.notifications.event.NodeCreatedEvent}
+ * otherwise an {@link org.jboss.cache.notifications.IncorrectCacheListenerException}
will be thrown when registering
+ * your cache listener.
+ *
+ * @author <a href="mailto:manik@jboss.org">Manik Surtani</a>
+ * @see CacheListener
+ * @since 2.0.0
+ */
+(a)Retention(RetentionPolicy.RUNTIME)
+(a)Target(ElementType.METHOD)
+public @interface CacheEntryCreated
+{
+}
Added:
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/annotation/CacheEntryEvicted.java
===================================================================
---
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/annotation/CacheEntryEvicted.java
(rev 0)
+++
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/annotation/CacheEntryEvicted.java 2008-10-10
15:25:26 UTC (rev 6903)
@@ -0,0 +1,45 @@
+/*
+ * 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.starobrno.notifications.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * This annotation should be used on methods that need to be notified when a node is
evicted.
+ * <p/>
+ * Methods annotated with this annotation should be public and take in a single
parameter, a {@link org.jboss.cache.notifications.event.NodeEvictedEvent}
+ * otherwise an {@link org.jboss.cache.notifications.IncorrectCacheListenerException}
will be thrown when registering
+ * your cache listener.
+ *
+ * @author <a href="mailto:manik@jboss.org">Manik Surtani</a>
+ * @see CacheListener
+ * @see org.jboss.cache.notifications.annotation.NodeLoaded
+ * @since 2.0.0
+ */
+(a)Retention(RetentionPolicy.RUNTIME)
+(a)Target(ElementType.METHOD)
+public @interface CacheEntryEvicted
+{
+}
Added:
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/annotation/CacheEntryInvalidated.java
===================================================================
---
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/annotation/CacheEntryInvalidated.java
(rev 0)
+++
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/annotation/CacheEntryInvalidated.java 2008-10-10
15:25:26 UTC (rev 6903)
@@ -0,0 +1,44 @@
+/*
+ * 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.starobrno.notifications.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * This annotation should be used on methods that need to be notified when a node is
invalidated.
+ * <p/>
+ * Methods annotated with this annotation should be public and take in a single
parameter, a {@link org.jboss.cache.notifications.event.NodeInvalidatedEvent}
+ * otherwise an {@link org.jboss.cache.notifications.IncorrectCacheListenerException}
will be thrown when registering
+ * your cache listener.
+ *
+ * @author <a href="mailto:manik@jboss.org">Manik Surtani</a>
+ * @see org.jboss.cache.notifications.annotation.CacheListener
+ * @since 3.0
+ */
+(a)Retention(RetentionPolicy.RUNTIME)
+(a)Target(ElementType.METHOD)
+public @interface CacheEntryInvalidated
+{
+}
\ No newline at end of file
Added:
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/annotation/CacheEntryLoaded.java
===================================================================
---
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/annotation/CacheEntryLoaded.java
(rev 0)
+++
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/annotation/CacheEntryLoaded.java 2008-10-10
15:25:26 UTC (rev 6903)
@@ -0,0 +1,44 @@
+/*
+ * 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.starobrno.notifications.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * This annotation should be used on methods that need to be notified when a node is
loaded from a {@link org.jboss.cache.loader.CacheLoader}.
+ * <p/>
+ * Methods annotated with this annotation should be public and take in a single
parameter, a {@link org.jboss.cache.notifications.event.NodeEvictedEvent}
+ * otherwise an {@link org.jboss.cache.notifications.IncorrectCacheListenerException}
will be thrown when registering
+ * your cache listener.
+ *
+ * @author <a href="mailto:manik@jboss.org">Manik Surtani</a>
+ * @see CacheListener
+ * @since 2.0.0
+ */
+(a)Retention(RetentionPolicy.RUNTIME)
+(a)Target(ElementType.METHOD)
+public @interface CacheEntryLoaded
+{
+}
Added:
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/annotation/CacheEntryModified.java
===================================================================
---
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/annotation/CacheEntryModified.java
(rev 0)
+++
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/annotation/CacheEntryModified.java 2008-10-10
15:25:26 UTC (rev 6903)
@@ -0,0 +1,45 @@
+/*
+ * 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.starobrno.notifications.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * This annotation should be used on methods that need to be notified when a node has
been modified.
+ * <p/>
+ * Methods annotated with this annotation should be public and take in a single
parameter, a {@link org.jboss.cache.notifications.event.NodeModifiedEvent}
+ * otherwise an {@link org.jboss.cache.notifications.IncorrectCacheListenerException}
will be thrown when registering
+ * your cache listener.
+ * <p/>
+ *
+ * @author <a href="mailto:manik@jboss.org">Manik Surtani</a>
+ * @see CacheListener
+ * @since 2.0.0
+ */
+(a)Retention(RetentionPolicy.RUNTIME)
+(a)Target(ElementType.METHOD)
+public @interface CacheEntryModified
+{
+}
Added:
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/annotation/CacheEntryPassivated.java
===================================================================
---
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/annotation/CacheEntryPassivated.java
(rev 0)
+++
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/annotation/CacheEntryPassivated.java 2008-10-10
15:25:26 UTC (rev 6903)
@@ -0,0 +1,46 @@
+/*
+ * 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.starobrno.notifications.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * This annotation should be used on methods that need to be notified when a node is
passivated.
+ * <p/>
+ * Methods annotated with this annotation should accept a single
+ * parameter, a {@link org.jboss.cache.notifications.event.NodePassivatedEvent} otherwise
a {@link org.jboss.cache.notifications.IncorrectCacheListenerException}
+ * will be thrown when registering your listener.
+ *
+ * @author <a href="mailto:manik@jboss.org">Manik Surtani</a>
+ * @see CacheListener
+ * @since 2.0.0
+ */
+// ensure this annotation is available at runtime.
+(a)Retention(RetentionPolicy.RUNTIME)
+// ensure that this annotation is applied to classes.
+(a)Target(ElementType.METHOD)
+public @interface CacheEntryPassivated
+{
+}
Added:
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/annotation/CacheEntryRemoved.java
===================================================================
---
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/annotation/CacheEntryRemoved.java
(rev 0)
+++
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/annotation/CacheEntryRemoved.java 2008-10-10
15:25:26 UTC (rev 6903)
@@ -0,0 +1,46 @@
+/*
+ * 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.starobrno.notifications.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * This annotation should be used on methods that need to be notified when a node is
removed from the cache.
+ * <p/>
+ * Methods annotated with this annotation should accept a single
+ * parameter, a {@link org.jboss.cache.notifications.event.TransactionRegisteredEvent}
otherwise a {@link org.jboss.cache.notifications.IncorrectCacheListenerException}
+ * will be thrown when registering your listener.
+ *
+ * @author <a href="mailto:manik@jboss.org">Manik Surtani</a>
+ * @see CacheListener
+ * @since 2.0.0
+ */
+// ensure this annotation is available at runtime.
+(a)Retention(RetentionPolicy.RUNTIME)
+// ensure that this annotation is applied to classes.
+(a)Target(ElementType.METHOD)
+public @interface CacheEntryRemoved
+{
+}
Added:
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/annotation/CacheEntryVisited.java
===================================================================
---
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/annotation/CacheEntryVisited.java
(rev 0)
+++
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/annotation/CacheEntryVisited.java 2008-10-10
15:25:26 UTC (rev 6903)
@@ -0,0 +1,46 @@
+/*
+ * 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.starobrno.notifications.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * This annotation should be used on methods that need to be notified when a node is
visited.
+ * <p/>
+ * Methods annotated with this annotation should accept a single
+ * parameter, a {@link org.jboss.cache.notifications.event.NodeVisitedEvent} otherwise a
{@link org.jboss.cache.notifications.IncorrectCacheListenerException}
+ * will be thrown when registering your listener.
+ *
+ * @author <a href="mailto:manik@jboss.org">Manik Surtani</a>
+ * @see CacheListener
+ * @since 2.0.0
+ */
+// ensure this annotation is available at runtime.
+(a)Retention(RetentionPolicy.RUNTIME)
+// ensure that this annotation is applied to classes.
+(a)Target(ElementType.METHOD)
+public @interface CacheEntryVisited
+{
+}
Added:
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/annotation/CacheListener.java
===================================================================
---
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/annotation/CacheListener.java
(rev 0)
+++
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/annotation/CacheListener.java 2008-10-10
15:25:26 UTC (rev 6903)
@@ -0,0 +1,333 @@
+/*
+ * 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.starobrno.notifications.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Class-level annotation used to annotate an object as being a valid cache listener.
Used with the
+ * {@link org.jboss.cache.Cache_Legacy#addCacheListener(Object)} and related APIs.
+ * <p/>
+ * Note that even if a class is annotated with this annotation, it still needs
method-level annotation (such as
+ * {@link org.jboss.cache.notifications.annotation.CacheStarted}) to actually receive
notifications.
+ * <p/>
+ * Objects annotated with this annotation - listeners - can be attached to a running
{@link org.jboss.cache.Cache_Legacy} so
+ * users can be notified of {@link org.jboss.cache.Cache_Legacy} events.
+ * <p/>
+ * <p/>
+ * There can be multiple methods that are annotated to receive the same event,
+ * and a method may receive multiple events by using a super type.
+ * </p>
+ * <p/>
+ * <h4>Delivery Semantics</h4>
+ * <p/>
+ * An event is delivered immediately after the
+ * respective operation, but before the underlying cache call returns. For this
+ * reason it is important to keep listener processing logic short-lived. If a
+ * long running task needs to be performed, it's recommended to use another
+ * thread.
+ * </p>
+ * <p/>
+ * <h4>Transactional Semantics</h4>
+ * <p/>
+ * Since the event is delivered during the actual cache call, the transactional
+ * outcome is not yet known. For this reason, <i>events are always delivered, even
+ * if the changes they represent are discarded by their containing
transaction</i>.
+ * For applications that must only process events that represent changes in a
+ * completed transaction, {@link
org.jboss.cache.notifications.event.TransactionalEvent#getTransaction()} can be used,
+ * along with {@link
org.jboss.cache.notifications.event.TransactionCompletedEvent#isSuccessful()} to record
events and
+ * later process them once the transaction has been successfully committed.
+ * Example 4 demonstrates this.
+ * </p>
+ * <p/>
+ * <h4>Threading Semantics</h4>
+ * <p/>
+ * A listener implementation must be capable of handling concurrent invocations. Local
+ * notifications reuse the calling thread; remote notifications reuse the network
thread.
+ * </p>
+ * <p/>
+ * Since notifications reuse the calling or network thread, it is important to realise
that
+ * if your listener implementation blocks or performs a long-running task, the original
caller which
+ * triggered the cache event may block until the listener callback completes. It is
therefore a good idea to use
+ * the listener to be notified of an event but to perform any
+ * long running tasks in a separate thread so as not to block the original caller.
+ * </p>
+ * <p/>
+ * In addition, any locks acquired for the operation being performed will still be held
for the callback. This needs to be kept in mind
+ * as locks may be held longer than necessary or intended to and may cause deadlocking in
certain situations. See above paragraph
+ * on long-running tasks that should be run in a separate thread.
+ * </p>
+ * <b>Note</b>: Since 3.0, a new parameter, <tt>sync</tt>, has
been introduced on this annotation. This defaults to <tt>true</tt>
+ * which provides the above semantics. Alternatively, if you set
<tt>sync</tt> to <tt>false</tt>, then invocations are made in a
+ * <i>separate</i> thread, which will not cause any blocking on the caller or
network thread. The separate thread is taken
+ * from a pool, which can be configured using {@link
org.jboss.cache.config.Configuration#setListenerAsyncPoolSize(int)}.
+ * <p/>
+ * <b>Summary of Notification Annotations</b>
+ * <table border="1" cellpadding="1" cellspacing="1"
summary="Summary of notification annotations">
+ * <tr>
+ * <th bgcolor="#CCCCFF" align="left">Annotation</th>
+ * <th bgcolor="#CCCCFF" align="left">Event</th>
+ * <th bgcolor="#CCCCFF" align="left">Description</th>
+ * </tr>
+ * <tr>
+ * <td valign="top">{@link CacheStarted}</td>
+ * <td valign="top">{@link
org.jboss.cache.notifications.event.CacheStartedEvent}</td>
+ * <td valign="top">A cache was started</td>
+ * </tr>
+ * <tr>
+ * <td valign="top">{@link CacheStopped}</td>
+ * <td valign="top">{@link
org.jboss.cache.notifications.event.CacheStoppedEvent}</td>
+ * <td valign="top">A cache was stopped</td>
+ * </tr>
+ * <tr>
+ * <td valign="top">{@link CacheEntryModified}</td>
+ * <td valign="top">{@link
org.jboss.cache.notifications.event.NodeModifiedEvent}</td>
+ * <td valign="top">A node was modified</td>
+ * </tr>
+ * <tr>
+ * <td valign="top">{@link NodeMoved}</td>
+ * <td valign="top">{@link
org.jboss.cache.notifications.event.NodeMovedEvent}</td>
+ * <td valign="top">A node was moved</td>
+ * </tr>
+ * <tr>
+ * <td valign="top">{@link CacheEntryCreated}</td>
+ * <td valign="top">{@link
org.jboss.cache.notifications.event.NodeCreatedEvent}</td>
+ * <td valign="top">A node was created</td>
+ * </tr>
+ * <tr>
+ * <td valign="top">{@link CacheEntryRemoved}</td>
+ * <td valign="top">{@link
org.jboss.cache.notifications.event.NodeRemovedEvent}</td>
+ * <td valign="top">A node was removed</td>
+ * </tr>
+ * <tr>
+ * <td valign="top">{@link CacheEntryVisited}</td>
+ * <td valign="top">{@link
org.jboss.cache.notifications.event.NodeVisitedEvent}</td>
+ * <td valign="top">A node was visited</td>
+ * </tr>
+ * <tr>
+ * <td valign="top">{@link CacheEntryLoaded}</td>
+ * <td valign="top">{@link
org.jboss.cache.notifications.event.NodeLoadedEvent}</td>
+ * <td valign="top">A node was loaded</td>
+ * </tr>
+ * <tr>
+ * <td valign="top">{@link
org.jboss.cache.notifications.annotation.NodeEvicted}</td>
+ * <td valign="top">{@link
org.jboss.cache.notifications.event.NodeEvictedEvent}</td>
+ * <td valign="top">A node was evicted</td>
+ * </tr>
+ * <tr>
+ * <td valign="top">{@link
org.jboss.cache.notifications.annotation.NodeActivated}</td>
+ * <td valign="top">{@link
org.jboss.cache.notifications.event.NodeActivatedEvent}</td>
+ * <td valign="top">A node was activated</td>
+ * </tr>
+ * <tr>
+ * <td valign="top">{@link
org.jboss.cache.notifications.annotation.NodePassivated}</td>
+ * <td valign="top">{@link
org.jboss.cache.notifications.event.NodePassivatedEvent}</td>
+ * <td valign="top">A node was passivated</td>
+ * </tr>
+ * <tr>
+ * <td valign="top">{@link
org.jboss.cache.notifications.annotation.ViewChanged}</td>
+ * <td valign="top">{@link
org.jboss.cache.notifications.event.ViewChangedEvent}</td>
+ * <td valign="top">A view change event was detected</td>
+ * </tr>
+ * <tr>
+ * <td valign="top">{@link
org.jboss.cache.notifications.annotation.CacheBlocked}</td>
+ * <td valign="top">{@link
org.jboss.cache.notifications.event.CacheBlockedEvent}</td>
+ * <td valign="top">A cache block event was detected</td>
+ * </tr>
+ * <tr>
+ * <td valign="top">{@link CacheUnblocked}</td>
+ * <td valign="top">{@link
org.jboss.cache.notifications.event.CacheUnblockedEvent}</td>
+ * <td valign="top">A cache unblock event was detected</td>
+ * </tr>
+ * <tr>
+ * <td valign="top">{@link TransactionRegistered}</td>
+ * <td valign@="top">{@link
org.jboss.cache.notifications.event.TransactionRegisteredEvent}</td>
+ * <td valign="top">The cache has started to participate in a
transaction</td>
+ * </tr>
+ * <tr>
+ * <td valign="top">{@link TransactionCompleted}</td>
+ * <td valign=@"top">{@link
org.jboss.cache.notifications.event.TransactionCompletedEvent}</td>
+ * <td valign="top">The cache has completed its participation in a
transaction</td>
+ * </tr>
+ * <tr>
+ * <td valign="top">{@link BuddyGroupChanged}</td>
+ * <td valign=@"top">{@link
org.jboss.cache.notifications.event.BuddyGroupChangedEvent}</td>
+ * <td valign="top">Buddy replication is enabled and one of the buddy
groups that the instance is a member of has changed its membership.</td>
+ * </tr>
+ * <tr>
+ * <td valign="top">{@link CacheEntryInvalidated}</td>
+ * <td valign=@"top">{@link
org.jboss.cache.notifications.event.NodeInvalidatedEvent}</td>
+ * <td valign="top">A node was invalidated by a remote cache. Only if
cache mode is INVALIDATION_SYNC or INVALIDATION_ASYNC.</td>
+ * </tr>
+ * <p/>
+ * </table>
+ * <p/>
+ * <h4>Example 1 - Method receiving a single event</h4>
+ * <pre>
+ * @CacheListener
+ * public class SingleEventListener
+ * {
+ * @CacheStarted
+ * public void doSomething(Event event)
+ * {
+ * System.out.println("Cache started. Details = " + event);
+ * }
+ * }
+ * </pre>
+ * <p/>
+ * <h4>Example 2 - Method receiving multiple events</h4>
+ * <pre>
+ * @CacheListener
+ * public class MultipleEventListener
+ * {
+ * @CacheStarted
+ * @CacheStopped
+ * public void doSomething(Event event)
+ * {
+ * if (event.getType() == Event.Type.CACHE_STARTED)
+ * System.out.println("Cache started. Details = " +
event);
+ * else if (event.getType() == Event.Type.CACHE_STOPPED)
+ * System.out.println("Cache stopped. Details = " +
event);
+ * }
+ * }
+ * </pre>
+ * <p/>
+ * <h4>Example 3 - Multiple methods receiving the same event</h4>
+ * <pre>
+ * @CAcheListener
+ * public class SingleEventListener
+ * {
+ * @CacheStarted
+ * public void handleStart(Event event)
+ * {
+ * System.out.println("Cache started");
+ * }
+ * <p/>
+ * @CacheStarted
+ * @CacheStopped
+ * @CacheBlocked
+ * @CacheUnblocked
+ * @ViewChanged
+ * public void logEvent(Event event)
+ * {
+ * logSystem.logEvent(event.getType());
+ * }
+ * }
+ * </pre>
+ * <p/>
+ * <p/>
+ * <b>Example 4 - Processing only events with a committed transaction.</b>
+ * <p/>
+ * <pre>
+ * @CacheListener
+ * public class TxGuaranteedListener
+ * {
+ * private class TxEventQueue
+ * {
+ * private ConcurrentMap<Transaction, Queue<Event>>
map = new ConcurrentHashMap<Transaction, Queue<Event>>();
+ * <p/>
+ * public void offer(Event event)
+ * {
+ * Queue<Event> queue =
getQueue(event.getContext().getTransaction());
+ * queue.offer(event);
+ * }
+ * <p/>
+ * private Queue<Event> getQueue(Transaction transaction)
+ * {
+ * Queue<Event> queue = map.get(transaction);
+ * if (queue == null)
+ * {
+ * queue = new ConcurrentLinkedQueue<Event>();
+ * map.putIfAbsent(transaction, queue);
+ * }
+ * <p/>
+ * return queue;
+ * }
+ * <p/>
+ * public Queue<Event> takeAll(Transaction transaction)
+ * {
+ * return map.remove(transaction);
+ * }
+ * }
+ * <p/>
+ * private TxEventQueue events = new TxEventQueue();
+ * <p/>
+ * @NodeModified
+ * @NodeMoved
+ * @NodeCreated
+ * @NodeRemoved
+ * public void handle(Event event)
+ * {
+ * events.offer(event);
+ * }
+ * <p/>
+ * @TransactionCompleted
+ * public void handleTx(TransactionCompletedEvent event)
+ * {
+ * Queue<Event> completed =
events.takeAll(event.getTransaction());
+ * if (completed != null && event.isSuccessful())
+ * System.out.println("Comitted events = " + completed);
+ * }
+ * }
+ * </pre>
+ *
+ * @author <a href="mailto:manik@jboss.org">Manik Surtani</a>
+ * @author Jason T. Greene
+ * @see CacheStarted
+ * @see CacheStopped
+ * @see CacheEntryModified
+ * @see NodeMoved
+ * @see CacheEntryCreated
+ * @see CacheEntryRemoved
+ * @see CacheEntryVisited
+ * @see CacheEntryLoaded
+ * @see CacheEntryEvicted
+ * @see CacheEntryActivated
+ * @see CacheEntryPassivated
+ * @see ViewChanged
+ * @see CacheBlocked
+ * @see CacheUnblocked
+ * @see TransactionCompleted
+ * @see TransactionRegistered
+ * @see BuddyGroupChanged
+ * @see CacheEntryInvalidated
+ * @see org.jboss.cache.Cache_Legacy#addCacheListener(Object)
+ * @see org.jboss.cache.Cache_Legacy#removeCacheListener(Object)
+ * @see org.jboss.cache.Cache_Legacy#getCacheListeners()
+ * @since 2.0.0
+ */
+(a)Retention(RetentionPolicy.RUNTIME)
+(a)Target(ElementType.TYPE)
+public @interface CacheListener
+{
+ /**
+ * Specifies whether callbacks on any class annotated with this annotation happens
synchronously (in the caller's thread)
+ * or asynchronously (using a separate thread). Defaults to
<tt>true</tt>.
+ *
+ * @return true if the expectation is that callbacks are called using the caller's
thread; false if they are to be made in a separate thread.
+ * @since 3.0
+ */
+ boolean sync() default true;
+}
Added:
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/annotation/CacheStarted.java
===================================================================
---
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/annotation/CacheStarted.java
(rev 0)
+++
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/annotation/CacheStarted.java 2008-10-10
15:25:26 UTC (rev 6903)
@@ -0,0 +1,44 @@
+/*
+ * 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.starobrno.notifications.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * This annotation should be used on methods that need to be notified when a cache is
started.
+ * <p/>
+ * Methods annotated with this annotation should accept a single
+ * parameter, a {@link org.jboss.cache.notifications.event.CacheStartedEvent} otherwise a
{@link org.jboss.cache.notifications.IncorrectCacheListenerException}
+ * will be thrown when registering your listener.
+ *
+ * @author <a href="mailto:manik@jboss.org">Manik Surtani</a>
+ * @see CacheListener
+ * @since 2.0.0
+ */
+(a)Retention(RetentionPolicy.RUNTIME)
+(a)Target(ElementType.METHOD)
+public @interface CacheStarted
+{
+}
Added:
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/annotation/CacheStopped.java
===================================================================
---
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/annotation/CacheStopped.java
(rev 0)
+++
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/annotation/CacheStopped.java 2008-10-10
15:25:26 UTC (rev 6903)
@@ -0,0 +1,44 @@
+/*
+ * 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.starobrno.notifications.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * This annotation should be used on methods that need to be notified when a cache is
stopped.
+ * <p/>
+ * Methods annotated with this annotation should accept a single
+ * parameter, a {@link org.jboss.cache.notifications.event.CacheStoppedEvent} otherwise a
{@link org.jboss.cache.notifications.IncorrectCacheListenerException}
+ * will be thrown when registering your listener.
+ *
+ * @author <a href="mailto:manik@jboss.org">Manik Surtani</a>
+ * @see CacheListener
+ * @since 2.0.0
+ */
+(a)Retention(RetentionPolicy.RUNTIME)
+(a)Target(ElementType.METHOD)
+public @interface CacheStopped
+{
+}
Added:
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/annotation/TransactionCompleted.java
===================================================================
---
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/annotation/TransactionCompleted.java
(rev 0)
+++
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/annotation/TransactionCompleted.java 2008-10-10
15:25:26 UTC (rev 6903)
@@ -0,0 +1,50 @@
+/*
+ * 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.starobrno.notifications.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * This annotation should be used on methods that need to be notified when the cache is
called to participate in a transaction and
+ * the transaction completes, either with a commit or a rollback.
+ * <p/>
+ * Methods annotated with this annotation should accept a single
+ * parameter, a {@link org.jboss.cache.notifications.event.TransactionCompletedEvent}
otherwise a {@link org.jboss.cache.notifications.IncorrectCacheListenerException}
+ * will be thrown when registering your listener.
+ * <p/>
+ * Note that methods marked with this annotation will only be fired <i>after the
fact</i>, i.e., your method will never be
+ * called with {@link org.jboss.cache.notifications.event.Event#isPre()} being set to
<tt>true</tt>.
+ *
+ * @author <a href="mailto:manik@jboss.org">Manik Surtani</a>
+ * @see CacheListener
+ * @since 2.0.0
+ */
+// ensure this annotation is available at runtime.
+(a)Retention(RetentionPolicy.RUNTIME)
+// ensure that this annotation is applied to classes.
+(a)Target(ElementType.METHOD)
+public @interface TransactionCompleted
+{
+}
Added:
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/annotation/TransactionRegistered.java
===================================================================
---
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/annotation/TransactionRegistered.java
(rev 0)
+++
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/annotation/TransactionRegistered.java 2008-10-10
15:25:26 UTC (rev 6903)
@@ -0,0 +1,50 @@
+/*
+ * 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.starobrno.notifications.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * This annotation should be used on methods that need to be notified when the cache is
called to participate in a transaction and
+ * registers a {@link javax.transaction.Synchronization} with a registered {@link
javax.transaction.TransactionManager}.
+ * <p/>
+ * Methods annotated with this annotation should accept a single
+ * parameter, a {@link org.jboss.cache.notifications.event.TransactionRegisteredEvent}
otherwise a {@link org.jboss.cache.notifications.IncorrectCacheListenerException}
+ * will be thrown when registering your listener.
+ * <p/>
+ * Note that methods marked with this annotation will only be fired <i>after the
fact</i>, i.e., your method will never be
+ * called with {@link org.jboss.cache.notifications.event.Event#isPre()} being set to
<tt>true</tt>.
+ *
+ * @author <a href="mailto:manik@jboss.org">Manik Surtani</a>
+ * @see CacheListener
+ * @since 2.0.0
+ */
+// ensure this annotation is available at runtime.
+(a)Retention(RetentionPolicy.RUNTIME)
+// ensure that this annotation is applied to classes.
+(a)Target(ElementType.METHOD)
+public @interface TransactionRegistered
+{
+}
Added:
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/annotation/ViewChanged.java
===================================================================
---
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/annotation/ViewChanged.java
(rev 0)
+++
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/annotation/ViewChanged.java 2008-10-10
15:25:26 UTC (rev 6903)
@@ -0,0 +1,47 @@
+/*
+ * 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.starobrno.notifications.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * This annotation should be used on methods that need to be notified when the cache is
used in a cluster and the cluster topology
+ * changes (i.e., a member joins or leaves the cluster).
+ * <p/>
+ * Methods annotated with this annotation should accept a single parameter,
+ * a {@link org.jboss.cache.notifications.event.ViewChangedEvent} otherwise a {@link
org.jboss.cache.notifications.IncorrectCacheListenerException}
+ * will be thrown when registering your listener.
+ *
+ * @author <a href="mailto:manik@jboss.org">Manik Surtani</a>
+ * @see CacheListener
+ * @since 2.0.0
+ */
+// ensure this annotation is available at runtime.
+(a)Retention(RetentionPolicy.RUNTIME)
+// ensure that this annotation is applied to classes.
+(a)Target(ElementType.METHOD)
+public @interface ViewChanged
+{
+}
Added:
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/event/BuddyGroupChangedEvent.java
===================================================================
---
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/event/BuddyGroupChangedEvent.java
(rev 0)
+++
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/event/BuddyGroupChangedEvent.java 2008-10-10
15:25:26 UTC (rev 6903)
@@ -0,0 +1,39 @@
+/*
+ * 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.starobrno.notifications.event;
+
+import org.jboss.cache.buddyreplication.BuddyGroup;
+
+/**
+ * This event is passed in to any method annotated with {@link
org.jboss.cache.notifications.annotation.BuddyGroupChanged}.
+ *
+ * @author <a href="mailto:manik@jboss.org">Manik Surtani</a>
+ * @since 2.1.0
+ */
+public interface BuddyGroupChangedEvent extends Event
+{
+ /**
+ * @return the new buddy group
+ * @since 2.1.0
+ */
+ BuddyGroup getBuddyGroup();
+}
\ No newline at end of file
Added:
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/event/CacheEntryActivatedEvent.java
===================================================================
---
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/event/CacheEntryActivatedEvent.java
(rev 0)
+++
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/event/CacheEntryActivatedEvent.java 2008-10-10
15:25:26 UTC (rev 6903)
@@ -0,0 +1,32 @@
+/*
+ * 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.starobrno.notifications.event;
+
+/**
+ * This event is passed in to any method annotated with {@link
org.jboss.cache.notifications.annotation.NodeActivated}.
+ *
+ * @author <a href="mailto:manik@jboss.org">Manik Surtani</a>
+ * @since 2.0.0
+ */
+public interface CacheEntryActivatedEvent extends CacheEntryEvent
+{
+}
Added:
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/event/CacheEntryCreatedEvent.java
===================================================================
---
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/event/CacheEntryCreatedEvent.java
(rev 0)
+++
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/event/CacheEntryCreatedEvent.java 2008-10-10
15:25:26 UTC (rev 6903)
@@ -0,0 +1,32 @@
+/*
+ * 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.starobrno.notifications.event;
+
+/**
+ * This event is passed in to any method annotated with {@link
org.jboss.cache.notifications.annotation.NodeCreated}.
+ *
+ * @author <a href="mailto:manik@jboss.org">Manik Surtani</a>
+ * @since 2.0.0
+ */
+public interface CacheEntryCreatedEvent extends CacheEntryEvent
+{
+}
Added:
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/event/CacheEntryEvent.java
===================================================================
---
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/event/CacheEntryEvent.java
(rev 0)
+++
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/event/CacheEntryEvent.java 2008-10-10
15:25:26 UTC (rev 6903)
@@ -0,0 +1,36 @@
+/*
+ * 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.starobrno.notifications.event;
+
+/**
+ * Transactional events that additionally expose an Fqn as such events pertain to a
specific node.
+ *
+ * @author <a href="mailto:manik@jboss.org">Manik Surtani</a>
+ * @since 2.0.0
+ */
+public interface CacheEntryEvent extends TransactionalEvent
+{
+ /**
+ * @return the Fqn pointing to the node that is affected.
+ */
+ Object getKey();
+}
Added:
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/event/CacheEntryEvictedEvent.java
===================================================================
---
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/event/CacheEntryEvictedEvent.java
(rev 0)
+++
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/event/CacheEntryEvictedEvent.java 2008-10-10
15:25:26 UTC (rev 6903)
@@ -0,0 +1,32 @@
+/*
+ * 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.starobrno.notifications.event;
+
+/**
+ * This event is passed in to any method annotated with {@link
org.jboss.cache.notifications.annotation.NodeEvicted}.
+ *
+ * @author <a href="mailto:manik@jboss.org">Manik Surtani</a>
+ * @since 2.0.0
+ */
+public interface CacheEntryEvictedEvent extends CacheEntryEvent
+{
+}
Added:
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/event/CacheEntryInvalidatedEvent.java
===================================================================
---
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/event/CacheEntryInvalidatedEvent.java
(rev 0)
+++
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/event/CacheEntryInvalidatedEvent.java 2008-10-10
15:25:26 UTC (rev 6903)
@@ -0,0 +1,32 @@
+/*
+ * 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.starobrno.notifications.event;
+
+/**
+ * Notifies a listener of an invalidation event
+ *
+ * @author Manik Surtani (<a
href="mailto:manik@jboss.org">manik@jboss.org</a>)
+ * @since 3.0
+ */
+public interface CacheEntryInvalidatedEvent extends CacheEntryEvent
+{
+}
Added:
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/event/CacheEntryLoadedEvent.java
===================================================================
---
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/event/CacheEntryLoadedEvent.java
(rev 0)
+++
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/event/CacheEntryLoadedEvent.java 2008-10-10
15:25:26 UTC (rev 6903)
@@ -0,0 +1,32 @@
+/*
+ * 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.starobrno.notifications.event;
+
+/**
+ * This event is passed in to any method annotated with {@link
org.jboss.cache.notifications.annotation.NodeLoaded}.
+ *
+ * @author <a href="mailto:manik@jboss.org">Manik Surtani</a>
+ * @since 2.0.0
+ */
+public interface CacheEntryLoadedEvent extends CacheEntryEvent
+{
+}
Copied:
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/event/CacheEntryModifiedEvent.java
(from rev 6899,
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/event/NodeModifiedEvent.java)
===================================================================
---
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/event/CacheEntryModifiedEvent.java
(rev 0)
+++
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/event/CacheEntryModifiedEvent.java 2008-10-10
15:25:26 UTC (rev 6903)
@@ -0,0 +1,32 @@
+/*
+ * 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.starobrno.notifications.event;
+
+/**
+ * This event is passed in to any method annotated with {@link
org.jboss.cache.notifications.annotation.NodeModified}
+ *
+ * @author <a href="mailto:manik@jboss.org">Manik Surtani</a>
+ * @since 2.0.0
+ */
+public interface CacheEntryModifiedEvent extends CacheEntryEvent
+{
+}
Property changes on:
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/event/CacheEntryModifiedEvent.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Added:
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/event/CacheEntryPassivatedEvent.java
===================================================================
---
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/event/CacheEntryPassivatedEvent.java
(rev 0)
+++
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/event/CacheEntryPassivatedEvent.java 2008-10-10
15:25:26 UTC (rev 6903)
@@ -0,0 +1,32 @@
+/*
+ * 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.starobrno.notifications.event;
+
+/**
+ * This event is passed in to any method annotated with {@link
org.jboss.cache.notifications.annotation.NodePassivated}.
+ *
+ * @author <a href="mailto:manik@jboss.org">Manik Surtani</a>
+ * @since 2.0.0
+ */
+public interface CacheEntryPassivatedEvent extends CacheEntryEvent
+{
+}
Added:
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/event/CacheEntryRemovedEvent.java
===================================================================
---
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/event/CacheEntryRemovedEvent.java
(rev 0)
+++
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/event/CacheEntryRemovedEvent.java 2008-10-10
15:25:26 UTC (rev 6903)
@@ -0,0 +1,32 @@
+/*
+ * 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.starobrno.notifications.event;
+
+/**
+ * This event is passed in to any method annotated with {@link
org.jboss.cache.notifications.annotation.NodeRemoved}.
+ *
+ * @author <a href="mailto:manik@jboss.org">Manik Surtani</a>
+ * @since 2.0.0
+ */
+public interface CacheEntryRemovedEvent extends CacheEntryEvent
+{
+}
Added:
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/event/CacheEntryVisitedEvent.java
===================================================================
---
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/event/CacheEntryVisitedEvent.java
(rev 0)
+++
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/event/CacheEntryVisitedEvent.java 2008-10-10
15:25:26 UTC (rev 6903)
@@ -0,0 +1,32 @@
+/*
+ * 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.starobrno.notifications.event;
+
+/**
+ * This event is passed in to any method annotated with {@link
org.jboss.cache.notifications.annotation.NodeVisited}.
+ *
+ * @author <a href="mailto:manik@jboss.org">Manik Surtani</a>
+ * @since 2.0.0
+ */
+public interface CacheEntryVisitedEvent extends CacheEntryEvent
+{
+}
Added:
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/event/CacheStartedEvent.java
===================================================================
---
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/event/CacheStartedEvent.java
(rev 0)
+++
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/event/CacheStartedEvent.java 2008-10-10
15:25:26 UTC (rev 6903)
@@ -0,0 +1,32 @@
+/*
+ * 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.starobrno.notifications.event;
+
+/**
+ * This event is passed in to any method annotated with {@link
org.jboss.cache.notifications.annotation.CacheStarted}.
+ *
+ * @author <a href="mailto:manik@jboss.org">Manik Surtani</a>
+ * @since 2.0.0
+ */
+public interface CacheStartedEvent extends Event
+{
+}
Added:
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/event/CacheStoppedEvent.java
===================================================================
---
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/event/CacheStoppedEvent.java
(rev 0)
+++
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/event/CacheStoppedEvent.java 2008-10-10
15:25:26 UTC (rev 6903)
@@ -0,0 +1,32 @@
+/*
+ * 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.starobrno.notifications.event;
+
+/**
+ * This event is passed in to any method annotated with {@link
org.jboss.cache.notifications.annotation.CacheStopped}.
+ *
+ * @author <a href="mailto:manik@jboss.org">Manik Surtani</a>
+ * @since 2.0.0
+ */
+public interface CacheStoppedEvent extends Event
+{
+}
Added:
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/event/Event.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/starobrno/notifications/event/Event.java
(rev 0)
+++
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/event/Event.java 2008-10-10
15:25:26 UTC (rev 6903)
@@ -0,0 +1,55 @@
+/*
+ * 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.starobrno.notifications.event;
+
+import org.jboss.starobrno.Cache;
+
+/**
+ * An interface that defines common characteristics of events
+ *
+ * @author <a href="mailto:manik@jboss.org">Manik Surtani</a>
+ * @since 2.0.0
+ */
+public interface Event
+{
+ static enum Type
+ {
+ CACHE_STARTED, CACHE_STOPPED, CACHE_ENTRY_ACTIVATED, CACHE_ENTRY_PASSIVATED,
CACHE_ENTRY_VISITED,
+ CACHE_ENTRY_LOADED, CACHE_ENTRY_EVICTED, CACHE_ENTRY_CREATED, CACHE_ENTRY_REMOVED,
CACHE_ENTRY_MODIFIED,
+ TRANSACTION_COMPLETED, TRANSACTION_REGISTERED, VIEW_CHANGED, BUDDY_GROUP_CHANGED,
CACHE_ENTRY_INVALIDATED
+ }
+
+ /**
+ * @return the type of event represented by this instance.
+ */
+ Type getType();
+
+ /**
+ * @return true if the notification is before the event has occured, false if after
the event has occured.
+ */
+ boolean isPre();
+
+ /**
+ * @return a handle to the cache instance that generated this notification.
+ */
+ Cache getCache();
+}
Added:
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/event/EventImpl.java
===================================================================
---
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/event/EventImpl.java
(rev 0)
+++
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/event/EventImpl.java 2008-10-10
15:25:26 UTC (rev 6903)
@@ -0,0 +1,229 @@
+/*
+ * 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.starobrno.notifications.event;
+
+import org.jboss.cache.Fqn;
+import org.jboss.cache.buddyreplication.BuddyGroup;
+import org.jboss.starobrno.Cache;
+import org.jgroups.View;
+
+import javax.transaction.Transaction;
+
+/**
+ * Basic implementation of an event that covers all event types.
+ *
+ * @author <a href="mailto:manik@jboss.org">Manik Surtani</a>
+ * @since 2.0.0
+ */
+public class EventImpl implements CacheStartedEvent, CacheStoppedEvent,
+ CacheEntryActivatedEvent, CacheEntryCreatedEvent, CacheEntryEvictedEvent,
CacheEntryLoadedEvent, CacheEntryModifiedEvent,
+ CacheEntryPassivatedEvent, CacheEntryRemovedEvent, CacheEntryVisitedEvent,
TransactionCompletedEvent, TransactionRegisteredEvent,
+ ViewChangedEvent, BuddyGroupChangedEvent, CacheEntryInvalidatedEvent
+{
+ private boolean pre = false; // by default events are after the fact
+ private Cache cache;
+ private Object key;
+ private Transaction transaction;
+ private boolean originLocal = true; // by default events all originate locally
+ private Fqn targetFqn;
+ private boolean successful;
+ private View newView;
+ private Type type;
+ private BuddyGroup buddyGroup;
+
+
+ public EventImpl(boolean pre, Cache cache, Object key, Transaction transaction,
boolean originLocal, Fqn targetFqn, boolean successful, View newView, Type type)
+ {
+ this.pre = pre;
+ this.cache = cache;
+ this.key = key;
+ this.transaction = transaction;
+ this.originLocal = originLocal;
+ this.targetFqn = targetFqn;
+ this.successful = successful;
+ this.newView = newView;
+ this.type = type;
+ }
+
+ public EventImpl()
+ {
+ }
+
+ public Type getType()
+ {
+ return type;
+ }
+
+ public boolean isPre()
+ {
+ return pre;
+ }
+
+ public Cache getCache()
+ {
+ return cache;
+ }
+
+ public Object getKey()
+ {
+ return key;
+ }
+
+ public Transaction getTransaction()
+ {
+ return transaction;
+ }
+
+ public boolean isOriginLocal()
+ {
+ return originLocal;
+ }
+
+ public Fqn getTargetFqn()
+ {
+ return targetFqn;
+ }
+
+ public boolean isSuccessful()
+ {
+ return successful;
+ }
+
+ public View getNewView()
+ {
+ return newView;
+ }
+
+ // ------------------------------ setters -----------------------------
+
+ public void setPre(boolean pre)
+ {
+ this.pre = pre;
+ }
+
+ public void setCache(Cache cache)
+ {
+ this.cache = cache;
+ }
+
+ public void setKey(Object key)
+ {
+ this.key = key;
+ }
+
+ public void setTransaction(Transaction transaction)
+ {
+ this.transaction = transaction;
+ }
+
+ public void setOriginLocal(boolean originLocal)
+ {
+ this.originLocal = originLocal;
+ }
+
+ public void setTargetFqn(Fqn targetFqn)
+ {
+ this.targetFqn = targetFqn;
+ }
+
+ public void setSuccessful(boolean successful)
+ {
+ this.successful = successful;
+ }
+
+ public void setNewView(View newView)
+ {
+ this.newView = newView;
+ }
+
+ public void setType(Type type)
+ {
+ this.type = type;
+ }
+
+ public void setBuddyGroup(BuddyGroup buddyGroup)
+ {
+ this.buddyGroup = buddyGroup;
+ }
+
+ @Override
+ public boolean equals(Object o)
+ {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ EventImpl event = (EventImpl) o;
+
+ if (originLocal != event.originLocal) return false;
+ if (pre != event.pre) return false;
+ if (successful != event.successful) return false;
+ if (cache != null ? !cache.equals(event.cache) : event.cache != null) return
false;
+ if (key != null ? !key.equals(event.key) : event.key != null) return false;
+ if (targetFqn != null ? !targetFqn.equals(event.targetFqn) : event.targetFqn !=
null) return false;
+ if (transaction != null ? !transaction.equals(event.transaction) :
event.transaction != null) return false;
+ if (newView != null ? !newView.equals(event.newView) : event.newView != null)
return false;
+ if (buddyGroup != null ? !buddyGroup.equals(event.buddyGroup) : event.buddyGroup !=
null) return false;
+ if (type != null ? !type.equals(event.type) : event.type != null) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ int result;
+ result = (pre ? 1 : 0);
+ result = 31 * result + (cache != null ? cache.hashCode() : 0);
+ result = 31 * result + (key != null ? key.hashCode() : 0);
+ result = 31 * result + (transaction != null ? transaction.hashCode() : 0);
+ result = 31 * result + (originLocal ? 1 : 0);
+ result = 31 * result + (targetFqn != null ? targetFqn.hashCode() : 0);
+ result = 31 * result + (successful ? 1 : 0);
+ result = 31 * result + (newView != null ? newView.hashCode() : 0);
+ result = 31 * result + (buddyGroup != null ? buddyGroup.hashCode() : 0);
+ result = 31 * result + (type != null ? type.hashCode() : 0);
+ return result;
+ }
+
+
+ @Override
+ public String toString()
+ {
+ return "EventImpl{" +
+ "type=" + type +
+ ",pre=" + pre +
+ ", cache=" + cache +
+ ", key=" + key +
+ ", transaction=" + transaction +
+ ", originLocal=" + originLocal +
+ ", targetFqn=" + targetFqn +
+ ", successful=" + successful +
+ ", newView=" + newView +
+ ", buddyGroup=" + buddyGroup +
+ '}';
+ }
+
+ public BuddyGroup getBuddyGroup()
+ {
+ return buddyGroup;
+ }
+}
Added:
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/event/TransactionCompletedEvent.java
===================================================================
---
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/event/TransactionCompletedEvent.java
(rev 0)
+++
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/event/TransactionCompletedEvent.java 2008-10-10
15:25:26 UTC (rev 6903)
@@ -0,0 +1,40 @@
+/*
+ * 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.starobrno.notifications.event;
+
+/**
+ * This event is passed in to any method annotated with {@link
org.jboss.cache.notifications.annotation.TransactionCompleted}.
+ * <p/>
+ * Note that this event is only delivered <i>after the fact</i>, i.e., you
will never see an instance of this event
+ * with {@link #isPre()} being set to <tt>true</tt>.
+ *
+ * @author <a href="mailto:manik@jboss.org">Manik Surtani</a>
+ * @since 2.0.0
+ */
+public interface TransactionCompletedEvent extends TransactionalEvent
+{
+ /**
+ * @return if <tt>true</tt>, the transaction completed by committing
successfully. If <tt>false</tt>, the transaction
+ * completed with a rollback.
+ */
+ boolean isSuccessful();
+}
Added:
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/event/TransactionRegisteredEvent.java
===================================================================
---
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/event/TransactionRegisteredEvent.java
(rev 0)
+++
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/event/TransactionRegisteredEvent.java 2008-10-10
15:25:26 UTC (rev 6903)
@@ -0,0 +1,35 @@
+/*
+ * 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.starobrno.notifications.event;
+
+/**
+ * This event is passed in to any method annotated with {@link
org.jboss.cache.notifications.annotation.TransactionRegistered}.
+ * <p/>
+ * Note that this event is only delivered <i>after the fact</i>, i.e., you
will never see an instance of this event
+ * with {@link #isPre()} being set to <tt>true</tt>.
+ *
+ * @author <a href="mailto:manik@jboss.org">Manik Surtani</a>
+ * @since 2.0.0
+ */
+public interface TransactionRegisteredEvent extends TransactionalEvent
+{
+}
Added:
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/event/TransactionalEvent.java
===================================================================
---
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/event/TransactionalEvent.java
(rev 0)
+++
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/event/TransactionalEvent.java 2008-10-10
15:25:26 UTC (rev 6903)
@@ -0,0 +1,45 @@
+/*
+ * 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.starobrno.notifications.event;
+
+import javax.transaction.Transaction;
+
+/**
+ * An event type that includes a transaction context - if one exists - as well as a
boolean as to whether the call
+ * originated locally or remotely.
+ *
+ * @author <a href="mailto:manik@jboss.org">Manik Surtani</a>
+ * @since 2.0.0
+ */
+public interface TransactionalEvent extends Event
+{
+ /**
+ * @return the Transaction associated with the current call. May be null if the
current call is outside the
+ * scope of a transaction.
+ */
+ Transaction getTransaction();
+
+ /**
+ * @return true if the call originated on the local cache instance; false if
originated from a remote one.
+ */
+ boolean isOriginLocal();
+}
Added:
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/event/ViewChangedEvent.java
===================================================================
---
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/event/ViewChangedEvent.java
(rev 0)
+++
core/branches/flat/src/main/java/org/jboss/starobrno/notifications/event/ViewChangedEvent.java 2008-10-10
15:25:26 UTC (rev 6903)
@@ -0,0 +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.
+ */
+package org.jboss.starobrno.notifications.event;
+
+import org.jgroups.View;
+
+/**
+ * This event is passed in to any method annotated with {@link
org.jboss.cache.notifications.annotation.ViewChanged}.
+ *
+ * @author <a href="mailto:manik@jboss.org">Manik Surtani</a>
+ * @since 2.0.0
+ */
+public interface ViewChangedEvent extends Event
+{
+ /**
+ * @return the new view associated with this view change.
+ */
+ View getNewView();
+}
Modified:
core/branches/flat/src/main/java/org/jboss/starobrno/remoting/RPCManagerImpl.java
===================================================================
---
core/branches/flat/src/main/java/org/jboss/starobrno/remoting/RPCManagerImpl.java 2008-10-10
12:52:50 UTC (rev 6902)
+++
core/branches/flat/src/main/java/org/jboss/starobrno/remoting/RPCManagerImpl.java 2008-10-10
15:25:26 UTC (rev 6903)
@@ -715,8 +715,6 @@
{
flushBlockGate.close();
if (log.isDebugEnabled()) log.debug("Block received at " +
getLocalAddress());
- notifier.notifyCacheBlocked(true);
- notifier.notifyCacheBlocked(false);
if (log.isDebugEnabled()) log.debug("Block processed at " +
getLocalAddress());
}
@@ -727,10 +725,6 @@
public void unblock()
{
if (log.isDebugEnabled()) log.debug("UnBlock received at " +
getLocalAddress());
-
- notifier.notifyCacheUnblocked(true);
- notifier.notifyCacheUnblocked(false);
-
if (log.isDebugEnabled()) log.debug("UnBlock processed at " +
getLocalAddress());
flushBlockGate.open();
}
Modified:
core/branches/flat/src/test/java/org/jboss/starobrno/util/internals/ViewChangeListener.java
===================================================================
---
core/branches/flat/src/test/java/org/jboss/starobrno/util/internals/ViewChangeListener.java 2008-10-10
12:52:50 UTC (rev 6902)
+++
core/branches/flat/src/test/java/org/jboss/starobrno/util/internals/ViewChangeListener.java 2008-10-10
15:25:26 UTC (rev 6903)
@@ -1,9 +1,9 @@
package org.jboss.starobrno.util.internals;
-import org.jboss.cache.notifications.annotation.CacheListener;
-import org.jboss.cache.notifications.annotation.ViewChanged;
-import org.jboss.cache.notifications.event.ViewChangedEvent;
import org.jboss.starobrno.Cache;
+import org.jboss.starobrno.notifications.annotation.CacheListener;
+import org.jboss.starobrno.notifications.annotation.ViewChanged;
+import org.jboss.starobrno.notifications.event.ViewChangedEvent;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;