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

Manik Surtani manik at jboss.org
Tue Jul 17 10:44:22 EDT 2007


  User: msurtani
  Date: 07/07/17 10:44:22

  Modified:    src/org/jboss/cache   CacheStatus.java CacheImpl.java
  Log:
  JBCACHE-1100
  
  Revision  Changes    Path
  1.2       +45 -40    JBossCache/src/org/jboss/cache/CacheStatus.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: CacheStatus.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/CacheStatus.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -b -r1.1 -r1.2
  --- CacheStatus.java	23 May 2007 19:22:41 -0000	1.1
  +++ CacheStatus.java	17 Jul 2007 14:44:22 -0000	1.2
  @@ -31,7 +31,7 @@
    * and <code>destroy()</code>) might be in.
    * 
    * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
  - * @version $Revision: 1.1 $
  + * @version $Revision: 1.2 $
    */
   public enum CacheStatus 
   {
  @@ -85,7 +85,7 @@
      
      public boolean createAllowed()
      {
  -      switch(this)
  +      switch (this)
         {
            case CREATING:
            case CREATED:
  @@ -121,7 +121,7 @@
      
      public boolean startAllowed()
      {
  -      switch(this)
  +      switch (this)
         {
            case INSTANTIATED:
            case DESTROYED:         
  @@ -144,7 +144,7 @@
      
      public boolean needCreateBeforeStart()
      {
  -      switch(this)
  +      switch (this)
         {
            case INSTANTIATED:
            case DESTROYED:
  @@ -158,7 +158,7 @@
      
      public boolean stopAllowed()
      {
  -      switch(this)
  +      switch (this)
         {
            case INSTANTIATED:
            case CREATED:
  @@ -182,7 +182,7 @@
      
      public boolean destroyAllowed()
      {
  -      switch(this)
  +      switch (this)
         {
            case INSTANTIATED:
            case DESTROYED:
  @@ -216,4 +216,9 @@
         
         return false;         
      }
  +
  +   public boolean allowInvocations()
  +   {
  +      return (this == CacheStatus.STARTED);
  +   }
   }
  
  
  
  1.102     +5 -1      JBossCache/src/org/jboss/cache/CacheImpl.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: CacheImpl.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/CacheImpl.java,v
  retrieving revision 1.101
  retrieving revision 1.102
  diff -u -b -r1.101 -r1.102
  --- CacheImpl.java	17 Jul 2007 14:10:21 -0000	1.101
  +++ CacheImpl.java	17 Jul 2007 14:44:22 -0000	1.102
  @@ -202,7 +202,7 @@
      /**
       * The current lifecycle state.
       */
  -   private CacheStatus cacheStatus;
  +   CacheStatus cacheStatus;
   
      /**
       * Buddy Manager
  @@ -3889,6 +3889,10 @@
       */
      protected Object invokeMethod(MethodCall m, boolean originLocal) throws CacheException
      {
  +
  +      if (!cacheStatus.allowInvocations())
  +         throw new IllegalStateException("Cache not in a state to accept invocations!");
  +
         // don't create a new one; get it from ThreadLocal just this once, in case a user has added any overrides.
         InvocationContext ctx = getInvocationContext();
         MethodCall oldCall = null;
  
  
  



More information about the jboss-cvs-commits mailing list