[exo-jcr-commits] exo-jcr SVN: r2225 - jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache.

do-not-reply at jboss.org do-not-reply at jboss.org
Thu Apr 8 06:46:54 EDT 2010


Author: areshetnyak
Date: 2010-04-08 06:46:53 -0400 (Thu, 08 Apr 2010)
New Revision: 2225

Modified:
   jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/ChangesContainerExpirationFactory.java
Log:
EXOJCR-545 : The ChangesContainerFactory was changed.

Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/ChangesContainerExpirationFactory.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/ChangesContainerExpirationFactory.java	2010-04-08 10:14:12 UTC (rev 2224)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/ChangesContainerExpirationFactory.java	2010-04-08 10:46:53 UTC (rev 2225)
@@ -42,7 +42,7 @@
    /**
     * The expiration timeout.
     */
-   public static long expirationTimeOut;
+   public final long expirationTimeOut;
 
    public ChangesContainerExpirationFactory(long expirationTimeOut)
    {
@@ -54,11 +54,13 @@
     */
    public static class PutObjectContainerExpiration extends PutObjectContainer
    {
+      private final long timeOut;
 
       public PutObjectContainerExpiration(Fqn fqn, Map<? extends Serializable, ? extends Object> data,
-         Cache<Serializable, Object> cache, int historicalIndex, boolean local)
+         Cache<Serializable, Object> cache, int historicalIndex, boolean local, long timeOut)
       {
          super(fqn, data, cache, historicalIndex, local);
+         this.timeOut = timeOut; 
       }
 
       @Override
@@ -68,7 +70,7 @@
          cache.put(fqn, data);
 
          setCacheLocalMode();
-         cache.put(fqn, ExpirationAlgorithmConfig.EXPIRATION_KEY, new Long(System.currentTimeMillis() + expirationTimeOut));
+         cache.put(fqn, ExpirationAlgorithmConfig.EXPIRATION_KEY, new Long(System.currentTimeMillis() + timeOut));
       }
    }
 
@@ -77,18 +79,20 @@
     */
    public static class PutKeyValueContainerExpiration extends PutKeyValueContainer
    {
+      private final long timeOut;
 
       public PutKeyValueContainerExpiration(Fqn fqn, Serializable key, Object value, Cache<Serializable, Object> cache,
-         int historicalIndex, boolean local)
+         int historicalIndex, boolean local, long timeOut)
       {
          super(fqn, key, value, cache, historicalIndex, local);
+         this.timeOut = timeOut;
       }
 
       @Override
       public void apply()
       {
          setCacheLocalMode();
-         cache.put(fqn, ExpirationAlgorithmConfig.EXPIRATION_KEY, new Long(System.currentTimeMillis() + expirationTimeOut));
+         cache.put(fqn, ExpirationAlgorithmConfig.EXPIRATION_KEY, new Long(System.currentTimeMillis() + timeOut));
 
          setCacheLocalMode();
          cache.put(fqn, key, value);
@@ -114,11 +118,13 @@
     */
    public static class AddToListContainerExpiration extends AddToListContainer
    {
+      private final long timeOut;
 
       public AddToListContainerExpiration(Fqn fqn, Serializable key, Object value, Cache<Serializable, Object> cache,
-         int historicalIndex, boolean local)
+         int historicalIndex, boolean local, long timeOut)
       {
          super(fqn, key, value, cache, historicalIndex, local);
+         this.timeOut = timeOut;
       }
 
       @Override
@@ -140,7 +146,7 @@
             newSet.add(value);
 
             setCacheLocalMode();
-            cache.put(fqn, ExpirationAlgorithmConfig.EXPIRATION_KEY, new Long(System.currentTimeMillis() + expirationTimeOut));
+            cache.put(fqn, ExpirationAlgorithmConfig.EXPIRATION_KEY, new Long(System.currentTimeMillis() + timeOut));
 
             setCacheLocalMode();
             cache.put(fqn, key, newSet);
@@ -158,11 +164,13 @@
     */
    public static class RemoveFromListContainerExpiration extends RemoveFromListContainer
    {
+      private final long timeOut;
 
       public RemoveFromListContainerExpiration(Fqn fqn, Serializable key, Object value, Cache<Serializable, Object> cache,
-         int historicalIndex, boolean local)
+         int historicalIndex, boolean local, long timeOut)
       {
          super(fqn, key, value, cache, historicalIndex, local);
+         this.timeOut = timeOut;
       }
 
       @Override
@@ -180,40 +188,48 @@
             newSet.remove(value);
 
             setCacheLocalMode();
-            cache.put(fqn, ExpirationAlgorithmConfig.EXPIRATION_KEY, new Long(System.currentTimeMillis() + expirationTimeOut));
+            cache.put(fqn, ExpirationAlgorithmConfig.EXPIRATION_KEY, new Long(System.currentTimeMillis() + timeOut));
 
             setCacheLocalMode();
             cache.put(fqn, key, newSet);
          }
       }
    }
-
-   @Override
+   
+   /**
+    * {@inheritDoc}
+    */
    public ChangesContainer createPutObjectContainer(Fqn fqn, Map<? extends Serializable, ? extends Object> data,
       Cache<Serializable, Object> cache, int historicalIndex, boolean local)
    {
-      return new PutObjectContainerExpiration(fqn, data, cache, historicalIndex, local);
+     return new PutObjectContainerExpiration(fqn, data, cache, historicalIndex, local, expirationTimeOut);  
    }
 
-   @Override
+   /**
+    * {@inheritDoc}
+    */
    public ChangesContainer createPutKeyValueContainer(Fqn fqn, Serializable key, Object value, Cache<Serializable, Object> cache,
       int historicalIndex, boolean local)
    {
-      return new PutKeyValueContainerExpiration(fqn, key, value, cache, historicalIndex, local);
+     return new PutKeyValueContainerExpiration(fqn, key, value, cache, historicalIndex, local, expirationTimeOut);  
    }
 
-   @Override
+   /**
+    * {@inheritDoc}
+    */
    public ChangesContainer createAddToListContainer(Fqn fqn, Serializable key, Object value, Cache<Serializable, Object> cache,
       int historicalIndex, boolean local)
    {
-      return new AddToListContainerExpiration(fqn, key, value, cache, historicalIndex, local);
+     return new AddToListContainerExpiration(fqn, key, value, cache, historicalIndex, local, expirationTimeOut);
    }
 
-   @Override
+   /**
+    * {@inheritDoc}
+    */
    public ChangesContainer createRemoveFromListContainer(Fqn fqn, Serializable key, Object value, Cache<Serializable, Object> cache,
       int historicalIndex, boolean local)
    {
-      return new RemoveFromListContainerExpiration(fqn, key, value, cache, historicalIndex, local);
+     return new RemoveFromListContainerExpiration(fqn, key, value, cache, historicalIndex, local, expirationTimeOut);
    }
 
 }



More information about the exo-jcr-commits mailing list