[java-opensaml COMMIT] in /trunk: opensaml-storage-api/src/test/java/org/opensaml/storage/StorageServiceTest.java ope...

noreply at shibboleth.net noreply at shibboleth.net
Fri Feb 13 01:15:46 EST 2015


Author: dfisher
Date: Fri Feb 13 01:15:40 2015
New Revision: 4226

URL: http://svn.shibboleth.net/view/java-opensaml?rev=4226&view=rev
Log:
OSJ-101

Remove timeOut from strings() test, fixes MySQL and Postgres tests.
Improve logging in JPAStorageService.

Modified:
    trunk/opensaml-storage-api/src/test/java/org/opensaml/storage/StorageServiceTest.java
    trunk/opensaml-storage-impl/src/main/java/org/opensaml/storage/impl/JPAStorageService.java

Modified: trunk/opensaml-storage-api/src/test/java/org/opensaml/storage/StorageServiceTest.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-storage-api/src/test/java/org/opensaml/storage/StorageServiceTest.java?rev=4226&r1=4225&r2=4226&view=diff
==============================================================================
--- trunk/opensaml-storage-api/src/test/java/org/opensaml/storage/StorageServiceTest.java (original)
+++ trunk/opensaml-storage-api/src/test/java/org/opensaml/storage/StorageServiceTest.java Fri Feb 13 01:15:40 2015
@@ -75,7 +75,7 @@
         }
     }
     
-    @Test(threadPoolSize = 10, invocationCount = 10,  timeOut = 10000)
+    @Test(threadPoolSize = 10, invocationCount = 10)
     public void strings() throws IOException {
         threadInit();
         

Modified: trunk/opensaml-storage-impl/src/main/java/org/opensaml/storage/impl/JPAStorageService.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-storage-impl/src/main/java/org/opensaml/storage/impl/JPAStorageService.java?rev=4226&r1=4225&r2=4226&view=diff
==============================================================================
--- trunk/opensaml-storage-impl/src/main/java/org/opensaml/storage/impl/JPAStorageService.java (original)
+++ trunk/opensaml-storage-impl/src/main/java/org/opensaml/storage/impl/JPAStorageService.java Fri Feb 13 01:15:40 2015
@@ -94,7 +94,7 @@
                 // Not yet expired?
                 final Long exp = entity.getExpiration();
                 if (exp == null || System.currentTimeMillis() < exp) {
-                    log.debug("Duplicate record '{}' in context '{}' with expiration '{}'", key, context, expiration);
+                    log.debug("Duplicate record '{}' in context '{}'", key, context);
                     return false;
                 }
 
@@ -109,7 +109,7 @@
             entity.setValue(value);
             entity.setExpiration(expiration);
             manager.merge(entity);
-            log.debug("Merged record '{}' in context '{}' with expiration '{}'", new Object[] {key, context,
+            log.debug("Create record '{}' in context '{}' with expiration '{}'", new Object[] {key, context,
                     expiration,});
             return true;
         } catch (final EntityExistsException e) {
@@ -383,7 +383,7 @@
             }
             entity.setExpiration(expiration);
             manager.merge(entity);
-            log.debug("Merged record '{}' in context '{}' with expiration '{}'", new Object[] {key, context,
+            log.debug("Update record '{}' in context '{}' with expiration '{}'", new Object[] {key, context,
                     expiration,});
             return entity.getVersion();
         } catch (final VersionMismatchException e) {
@@ -592,7 +592,8 @@
                     if (expiration == null || (entity.getExpiration() != null &&
                             entity.getExpiration() <= expiration)) {
                         manager.remove(entity);
-                        log.trace("Deleted entity {}", entity);
+                        log.debug("Deleted record '{}' in context '{}' with expiration '{}'", entity.getKey(),
+                                entity.getContext(), entity.getExpiration());
                     }
                 }
             }
@@ -686,11 +687,12 @@
 
             /** {@inheritDoc} */
             @Override public void run() {
-                log.debug("Running cleanup task");
                 final Long now = System.currentTimeMillis();
+                log.debug("Running cleanup task at {}", now);
                 List<String> contexts = null;
                 try {
                     contexts = readContexts();
+                    log.debug("Cleanup read contexts {}", contexts);
                 } catch (final IOException e) {
                     log.error("Error reading contexts", e);
                 }
@@ -698,11 +700,13 @@
                     for (final String context : contexts) {
                         try {
                             deleteContextImpl(context, now);
+                            log.debug("Cleanup removed expired records in context {}", context);
                         } catch (final IOException e) {
                             log.error("Error deleting records in context '{}' for timestamp '{}'", context, now, e);
                         }
                     }
                 }
+                log.debug("Finished cleanup task");
             }
         };
     }



More information about the commits mailing list