[java-opensaml COMMIT] in /trunk: opensaml-storage-api/src/main/java/org/opensaml/storage/AbstractStorageService.java...

noreply at shibboleth.net noreply at shibboleth.net
Fri Oct 4 16:58:01 EDT 2013


Author: scantor
Date: Fri Oct  4 16:58:00 2013
New Revision: 3460

URL: http://svn.shibboleth.net/view/java-opensaml?rev=3460&view=rev
Log:
Add versioned deletes to help with race conditions.

Modified:
    trunk/opensaml-storage-api/src/main/java/org/opensaml/storage/AbstractStorageService.java
    trunk/opensaml-storage-api/src/main/java/org/opensaml/storage/StorageService.java
    trunk/opensaml-storage-impl/src/main/java/org/opensaml/storage/impl/LDAPStorageService.java
    trunk/opensaml-storage-impl/src/main/java/org/opensaml/storage/impl/MemoryStorageService.java

Modified: trunk/opensaml-storage-api/src/main/java/org/opensaml/storage/AbstractStorageService.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-storage-api/src/main/java/org/opensaml/storage/AbstractStorageService.java?rev=3460&r1=3459&r2=3460&view=diff
==============================================================================
--- trunk/opensaml-storage-api/src/main/java/org/opensaml/storage/AbstractStorageService.java (original)
+++ trunk/opensaml-storage-api/src/main/java/org/opensaml/storage/AbstractStorageService.java Fri Oct  4 16:58:00 2013
@@ -216,8 +216,8 @@
     
     /** {@inheritDoc} */
     public boolean create(@Nonnull @NotEmpty final String context, @Nonnull @NotEmpty final String key,
-            @Nonnull final Object value, @Nonnull final StorageSerializer serializer, @Nullable final Long expiration)
-                    throws IOException {
+            @Nonnull final Object value, @Nonnull final StorageSerializer serializer,
+            @Nullable @Positive final Long expiration) throws IOException {
         return create(context, key, serializer.serialize(value), expiration);
     }
     
@@ -240,16 +240,16 @@
     
     /** {@inheritDoc} */
     @Nullable public Integer update(@Nonnull @NotEmpty final String context, @Nonnull @NotEmpty final String key,
-            @Nonnull final Object value, @Nonnull final StorageSerializer serializer, @Nullable final Long expiration)
-                    throws IOException {
+            @Nonnull final Object value, @Nonnull final StorageSerializer serializer,
+            @Nullable @Positive final Long expiration) throws IOException {
         return update(context, key, serializer.serialize(value), expiration);
     }
 
     /** {@inheritDoc} */
     // Checkstyle: ParameterNumber OFF
-    @Nullable public Integer updateWithVersion(final int version, @Nonnull @NotEmpty final String context,
+    @Nullable public Integer updateWithVersion(@Positive final int version, @Nonnull @NotEmpty final String context,
             @Nonnull @NotEmpty final String key, @Nonnull final Object value,
-            @Nonnull final StorageSerializer serializer, @Nullable final Long expiration)
+            @Nonnull final StorageSerializer serializer, @Nullable @Positive final Long expiration)
                     throws IOException, VersionMismatchException {
         return updateWithVersion(version, context, key, serializer.serialize(value), expiration);
     }
@@ -263,7 +263,7 @@
     
 
     /** {@inheritDoc} */
-    @Nullable public Integer updateWithVersion(final int version, @Nonnull final Object value)
+    @Nullable public Integer updateWithVersion(@Positive final int version, @Nonnull final Object value)
             throws IOException, VersionMismatchException {
         return updateWithVersion(version, AnnotationSupport.getContext(value), AnnotationSupport.getKey(value),
                 AnnotationSupport.getValue(value), AnnotationSupport.getExpiration(value));
@@ -279,5 +279,11 @@
     public boolean delete(@Nonnull final Object value) throws IOException {
         return delete(AnnotationSupport.getContext(value), AnnotationSupport.getKey(value));
     }
+
+    /** {@inheritDoc} */
+    public boolean deleteWithVersion(@Positive final int version, @Nonnull final Object value)
+            throws IOException, VersionMismatchException {
+        return deleteWithVersion(version, AnnotationSupport.getContext(value), AnnotationSupport.getKey(value));
+    }
     
 }

Modified: trunk/opensaml-storage-api/src/main/java/org/opensaml/storage/StorageService.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-storage-api/src/main/java/org/opensaml/storage/StorageService.java?rev=3460&r1=3459&r2=3460&view=diff
==============================================================================
--- trunk/opensaml-storage-api/src/main/java/org/opensaml/storage/StorageService.java (original)
+++ trunk/opensaml-storage-api/src/main/java/org/opensaml/storage/StorageService.java Fri Oct  4 16:58:00 2013
@@ -23,6 +23,7 @@
 import javax.annotation.Nullable;
 
 import net.shibboleth.utilities.java.support.annotation.constraint.NotEmpty;
+import net.shibboleth.utilities.java.support.annotation.constraint.Positive;
 import net.shibboleth.utilities.java.support.annotation.constraint.ThreadSafeAfterInit;
 import net.shibboleth.utilities.java.support.collection.Pair;
 import net.shibboleth.utilities.java.support.component.DestructableComponent;
@@ -69,7 +70,7 @@

[... 370 lines stripped ...]


More information about the commits mailing list