[jboss-cvs] JBossCache/src/org/jboss/cache/notifications/annotation ...

Manik Surtani manik at jboss.org
Thu Jun 28 12:53:36 EDT 2007


  User: msurtani
  Date: 07/06/28 12:53:36

  Added:       src/org/jboss/cache/notifications/annotation                 
                        NodeActivated.java NodeLoaded.java
                        CacheStarted.java CacheListener.java
                        CacheUnblocked.java TransactionRegistered.java
                        NodeModified.java NodePassivated.java
                        ViewChanged.java NodeCreated.java NodeVisited.java
                        CacheStopped.java CacheBlocked.java NodeMoved.java
                        NodeEvicted.java TransactionCompleted.java
                        NodeRemoved.java
  Log:
  Notification changes
  
  Revision  Changes    Path
  1.1      date: 2007/06/28 16:53:36;  author: msurtani;  state: Exp;JBossCache/src/org/jboss/cache/notifications/annotation/NodeActivated.java
  
  Index: NodeActivated.java
  ===================================================================
  package org.jboss.cache.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 at jboss.org">Manik Surtani</a>
   * @see CacheListener
   * @see org.jboss.cache.notifications.annotation.NodePassivated
   * @since 2.0.0
   */
  @Retention(RetentionPolicy.RUNTIME)
  @Target(ElementType.METHOD)
  public @interface NodeActivated
  {
  }
  
  
  
  1.1      date: 2007/06/28 16:53:36;  author: msurtani;  state: Exp;JBossCache/src/org/jboss/cache/notifications/annotation/NodeLoaded.java
  
  Index: NodeLoaded.java
  ===================================================================
  package org.jboss.cache.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 at jboss.org">Manik Surtani</a>
   * @see CacheListener
   * @since 2.0.0
   */
  @Retention(RetentionPolicy.RUNTIME)
  @Target(ElementType.METHOD)
  public @interface NodeLoaded
  {
  }
  
  
  
  1.1      date: 2007/06/28 16:53:36;  author: msurtani;  state: Exp;JBossCache/src/org/jboss/cache/notifications/annotation/CacheStarted.java
  
  Index: CacheStarted.java
  ===================================================================
  package org.jboss.cache.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 at jboss.org">Manik Surtani</a>
   * @see CacheListener
   * @since 2.0.0
   */
  @Retention(RetentionPolicy.RUNTIME)
  @Target(ElementType.METHOD)
  public @interface CacheStarted
  {
  }
  
  
  
  1.1      date: 2007/06/28 16:53:36;  author: msurtani;  state: Exp;JBossCache/src/org/jboss/cache/notifications/annotation/CacheListener.java
  
  Index: CacheListener.java
  ===================================================================
  package org.jboss.cache.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#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} so users can be notified of {@link org.jboss.cache.Cache} events.
   * <p/>
   * It is important to note that notifications happen in the same process thread as the invocation to the cache.  This means 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/>
   * In addition, any locks acquired for the operation being performed will still be held for the callback.  This needs to be kep 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/>
   * Also important to note is that all data maps passed in to most listener methods as a part of the {@link org.jboss.cache.notifications.event.Event}
   * implementation are usually read-only defensive copies of the actual data stored in the cache.  Therefore it is safe to
   * assume that the collections are static snapshots.  If changes to the cache data are to be triggered by such events,
   * make calls on the cache directly rather than attempting to change the data maps.  See the javadocs on individual method-targeted
   * annotations for more details on what is passed in.
   * <p/>
   *
   * @author <a href="mailto:manik at jboss.org">Manik Surtani</a>
   * @see CacheStarted
   * @see CacheStopped
   * @see NodeModified
   * @see NodeMoved
   * @see NodeCreated
   * @see NodeRemoved
   * @see NodeVisited
   * @see NodeLoaded
   * @see NodeEvicted
   * @see NodeActivated
   * @see NodePassivated
   * @see ViewChanged
   * @see CacheBlocked
   * @see CacheUnblocked
   * @see TransactionCompleted
   * @see TransactionRegistered
   * @see org.jboss.cache.Cache#addCacheListener(Object)
   * @see org.jboss.cache.Cache#addCacheListener(org.jboss.cache.Fqn,Object)
   * @see org.jboss.cache.Cache#removeCacheListener(Object)
   * @see org.jboss.cache.Cache#removeCacheListener(org.jboss.cache.Fqn,Object)
   * @see org.jboss.cache.Cache#getCacheListeners()
   * @see org.jboss.cache.Cache#getCacheListeners(org.jboss.cache.Fqn)
   * @since 2.0.0
   */
  @Retention(RetentionPolicy.RUNTIME)
  @Target(ElementType.TYPE)
  public @interface CacheListener
  {
  }
  
  
  
  1.1      date: 2007/06/28 16:53:36;  author: msurtani;  state: Exp;JBossCache/src/org/jboss/cache/notifications/annotation/CacheUnblocked.java
  
  Index: CacheUnblocked.java
  ===================================================================
  package org.jboss.cache.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 JGroups UNBLOCK event occurs.
   * <p/>
   * Methods annotated with this annotation should be public and take in a single parameter, a {@link org.jboss.cache.notifications.event.CacheUnblockedEvent}
   * otherwise an {@link org.jboss.cache.notifications.IncorrectCacheListenerException} will be thrown when registering
   * your cache listener.
   *
   * @author <a href="mailto:manik at jboss.org">Manik Surtani</a>
   * @see CacheListener
   * @since 2.0.0
   */
  @Retention(RetentionPolicy.RUNTIME)
  @Target(ElementType.METHOD)
  public @interface CacheUnblocked
  {
  }
  
  
  
  1.1      date: 2007/06/28 16:53:36;  author: msurtani;  state: Exp;JBossCache/src/org/jboss/cache/notifications/annotation/TransactionRegistered.java
  
  Index: TransactionRegistered.java
  ===================================================================
  package org.jboss.cache.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 at jboss.org">Manik Surtani</a>
   * @see CacheListener
   * @since 2.0.0
   */
  // ensure this annotation is available at runtime.
  @Retention(RetentionPolicy.RUNTIME)
  // ensure that this annotation is applied to classes.
  @Target(ElementType.METHOD)
  public @interface TransactionRegistered
  {
  }
  
  
  
  1.1      date: 2007/06/28 16:53:36;  author: msurtani;  state: Exp;JBossCache/src/org/jboss/cache/notifications/annotation/NodeModified.java
  
  Index: NodeModified.java
  ===================================================================
  package org.jboss.cache.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 at jboss.org">Manik Surtani</a>
   * @see CacheListener
   * @since 2.0.0
   */
  @Retention(RetentionPolicy.RUNTIME)
  @Target(ElementType.METHOD)
  public @interface NodeModified
  {
  }
  
  
  
  1.1      date: 2007/06/28 16:53:36;  author: msurtani;  state: Exp;JBossCache/src/org/jboss/cache/notifications/annotation/NodePassivated.java
  
  Index: NodePassivated.java
  ===================================================================
  package org.jboss.cache.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 at jboss.org">Manik Surtani</a>
   * @see CacheListener
   * @since 2.0.0
   */
  // ensure this annotation is available at runtime.
  @Retention(RetentionPolicy.RUNTIME)
  // ensure that this annotation is applied to classes.
  @Target(ElementType.METHOD)
  public @interface NodePassivated
  {
  }
  
  
  
  1.1      date: 2007/06/28 16:53:36;  author: msurtani;  state: Exp;JBossCache/src/org/jboss/cache/notifications/annotation/ViewChanged.java
  
  Index: ViewChanged.java
  ===================================================================
  package org.jboss.cache.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 at jboss.org">Manik Surtani</a>
   * @see CacheListener
   * @since 2.0.0
   */
  // ensure this annotation is available at runtime.
  @Retention(RetentionPolicy.RUNTIME)
  // ensure that this annotation is applied to classes.
  @Target(ElementType.METHOD)
  public @interface ViewChanged
  {
  }
  
  
  
  1.1      date: 2007/06/28 16:53:36;  author: msurtani;  state: Exp;JBossCache/src/org/jboss/cache/notifications/annotation/NodeCreated.java
  
  Index: NodeCreated.java
  ===================================================================
  package org.jboss.cache.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 at jboss.org">Manik Surtani</a>
   * @see CacheListener
   * @since 2.0.0
   */
  @Retention(RetentionPolicy.RUNTIME)
  @Target(ElementType.METHOD)
  public @interface NodeCreated
  {
  }
  
  
  
  1.1      date: 2007/06/28 16:53:36;  author: msurtani;  state: Exp;JBossCache/src/org/jboss/cache/notifications/annotation/NodeVisited.java
  
  Index: NodeVisited.java
  ===================================================================
  package org.jboss.cache.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 at jboss.org">Manik Surtani</a>
   * @see CacheListener
   * @since 2.0.0
   */
  // ensure this annotation is available at runtime.
  @Retention(RetentionPolicy.RUNTIME)
  // ensure that this annotation is applied to classes.
  @Target(ElementType.METHOD)
  public @interface NodeVisited
  {
  }
  
  
  
  1.1      date: 2007/06/28 16:53:36;  author: msurtani;  state: Exp;JBossCache/src/org/jboss/cache/notifications/annotation/CacheStopped.java
  
  Index: CacheStopped.java
  ===================================================================
  package org.jboss.cache.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 at jboss.org">Manik Surtani</a>
   * @see CacheListener
   * @since 2.0.0
   */
  @Retention(RetentionPolicy.RUNTIME)
  @Target(ElementType.METHOD)
  public @interface CacheStopped
  {
  }
  
  
  
  1.1      date: 2007/06/28 16:53:36;  author: msurtani;  state: Exp;JBossCache/src/org/jboss/cache/notifications/annotation/CacheBlocked.java
  
  Index: CacheBlocked.java
  ===================================================================
  package org.jboss.cache.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 JGroups BLOCK event occurs.
   * <p/>
   * Methods annotated with this annotation should be public and take in a single parameter, a {@link org.jboss.cache.notifications.event.CacheBlockedEvent}
   * otherwise an {@link org.jboss.cache.notifications.IncorrectCacheListenerException} will be thrown when registering
   * your cache listener.
   *
   * @author <a href="mailto:manik at jboss.org">Manik Surtani</a>
   * @see CacheListener
   * @see org.jboss.cache.notifications.event.CacheBlockedEvent
   * @since 2.0.0
   */
  @Retention(RetentionPolicy.RUNTIME)
  @Target(ElementType.METHOD)
  public @interface CacheBlocked
  {
  }
  
  
  
  1.1      date: 2007/06/28 16:53:36;  author: msurtani;  state: Exp;JBossCache/src/org/jboss/cache/notifications/annotation/NodeMoved.java
  
  Index: NodeMoved.java
  ===================================================================
  package org.jboss.cache.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 moved using the {@link org.jboss.cache.Cache#move(org.jboss.cache.Fqn,org.jboss.cache.Fqn)}
   * API.
   * <p/>
   * Methods annotated with this annotation should accept a single
   * parameter, a {@link org.jboss.cache.notifications.event.NodeMovedEvent} otherwise a {@link org.jboss.cache.notifications.IncorrectCacheListenerException}
   * will be thrown when registering your listener.
   *
   * @author <a href="mailto:manik at jboss.org">Manik Surtani</a>
   * @see CacheListener
   * @since 2.0.0
   */
  // ensure this annotation is available at runtime.
  @Retention(RetentionPolicy.RUNTIME)
  // ensure that this annotation is applied to classes.
  @Target(ElementType.METHOD)
  public @interface NodeMoved
  {
  }
  
  
  
  1.1      date: 2007/06/28 16:53:36;  author: msurtani;  state: Exp;JBossCache/src/org/jboss/cache/notifications/annotation/NodeEvicted.java
  
  Index: NodeEvicted.java
  ===================================================================
  package org.jboss.cache.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 at jboss.org">Manik Surtani</a>
   * @see CacheListener
   * @see org.jboss.cache.notifications.annotation.NodeLoaded
   * @since 2.0.0
   */
  @Retention(RetentionPolicy.RUNTIME)
  @Target(ElementType.METHOD)
  public @interface NodeEvicted
  {
  }
  
  
  
  1.1      date: 2007/06/28 16:53:36;  author: msurtani;  state: Exp;JBossCache/src/org/jboss/cache/notifications/annotation/TransactionCompleted.java
  
  Index: TransactionCompleted.java
  ===================================================================
  package org.jboss.cache.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 at jboss.org">Manik Surtani</a>
   * @see CacheListener
   * @since 2.0.0
   */
  // ensure this annotation is available at runtime.
  @Retention(RetentionPolicy.RUNTIME)
  // ensure that this annotation is applied to classes.
  @Target(ElementType.METHOD)
  public @interface TransactionCompleted
  {
  }
  
  
  
  1.1      date: 2007/06/28 16:53:36;  author: msurtani;  state: Exp;JBossCache/src/org/jboss/cache/notifications/annotation/NodeRemoved.java
  
  Index: NodeRemoved.java
  ===================================================================
  package org.jboss.cache.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 at jboss.org">Manik Surtani</a>
   * @see CacheListener
   * @since 2.0.0
   */
  // ensure this annotation is available at runtime.
  @Retention(RetentionPolicy.RUNTIME)
  // ensure that this annotation is applied to classes.
  @Target(ElementType.METHOD)
  public @interface NodeRemoved
  {
  }
  
  
  



More information about the jboss-cvs-commits mailing list