[java-opensaml COMMIT] in /trunk/opensaml-util/src: main/java/org/opensaml/util/storage/StorageService.java main/java...
noreply at shibboleth.net
noreply at shibboleth.net
Mon Jun 3 17:53:05 EDT 2013
Author: scantor
Date: Mon Jun 3 17:53:04 2013
New Revision: 3362
URL: http://svn.shibboleth.net/view/java-opensaml?rev=3362&view=rev
Log:
Switch to milliseconds for expirations.
Modified:
trunk/opensaml-util/src/main/java/org/opensaml/util/storage/StorageService.java
trunk/opensaml-util/src/main/java/org/opensaml/util/storage/impl/MemoryStorageService.java
trunk/opensaml-util/src/test/java/org/opensaml/util/storage/StorageServiceTest.java
Modified: trunk/opensaml-util/src/main/java/org/opensaml/util/storage/StorageService.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-util/src/main/java/org/opensaml/util/storage/StorageService.java?rev=3362&r1=3361&r2=3362&view=diff
==============================================================================
--- trunk/opensaml-util/src/main/java/org/opensaml/util/storage/StorageService.java (original)
+++ trunk/opensaml-util/src/main/java/org/opensaml/util/storage/StorageService.java Mon Jun 3 17:53:04 2013
@@ -21,9 +21,9 @@
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
-import javax.annotation.concurrent.ThreadSafe;
import net.shibboleth.utilities.java.support.annotation.constraint.NotEmpty;
+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;
import net.shibboleth.utilities.java.support.component.IdentifiableComponent;
@@ -43,9 +43,9 @@
* <p>The allowable sizes for contexts and keys can vary and be reported
* by the implementation to callers, but MUST be at least 255 characters.</p>
*
- * <p>Expiration is expressed in seconds since the epoch.</p>
+ * <p>Expiration is expressed in milliseconds since the beginning of the epoch.</p>
*/
- at ThreadSafe
+ at ThreadSafeAfterInit
public interface StorageService extends InitializableComponent, DestructableComponent,
IdentifiableComponent, ValidatableComponent {
Modified: trunk/opensaml-util/src/main/java/org/opensaml/util/storage/impl/MemoryStorageService.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-util/src/main/java/org/opensaml/util/storage/impl/MemoryStorageService.java?rev=3362&r1=3361&r2=3362&view=diff
==============================================================================
--- trunk/opensaml-util/src/main/java/org/opensaml/util/storage/impl/MemoryStorageService.java (original)
+++ trunk/opensaml-util/src/main/java/org/opensaml/util/storage/impl/MemoryStorageService.java Mon Jun 3 17:53:04 2013
@@ -267,7 +267,7 @@
if (record != null) {
// Not yet expired?
Long exp = record.getExpiration();
- if (exp == null || System.currentTimeMillis() < (exp * 1000)) {
+ if (exp == null || System.currentTimeMillis() < exp) {
return false;
}
@@ -312,7 +312,7 @@
return new Pair();
} else {
Long exp = record.getExpiration();
- if (exp != null && System.currentTimeMillis() >= (exp * 1000)) {
+ if (exp != null && System.currentTimeMillis() >= exp) {
return new Pair();
}
}
@@ -361,7 +361,7 @@
return null;
} else {
Long exp = record.getExpiration();
- if (exp != null && System.currentTimeMillis() >= (exp * 1000)) {
+ if (exp != null && System.currentTimeMillis() >= exp) {
return null;
}
}
@@ -409,7 +409,7 @@
Long now = System.currentTimeMillis();
for (MutableStorageRecord record : dataMap.values()) {
final Long exp = record.getExpiration();
- if (exp == null || now < (exp * 1000)) {
+ if (exp == null || now < exp) {
record.setExpiration(expiration);
}
}
@@ -435,7 +435,7 @@
return Iterables.removeIf(dataMap.entrySet(), new Predicate<Entry<String, MutableStorageRecord>>() {
public boolean apply(@Nullable final Entry<String, MutableStorageRecord> entry) {
Long exp = entry.getValue().getExpiration();
- return exp != null && (exp * 1000) <= expiration;
+ return exp != null && exp <= expiration;
}
}
);
Modified: trunk/opensaml-util/src/test/java/org/opensaml/util/storage/StorageServiceTest.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-util/src/test/java/org/opensaml/util/storage/StorageServiceTest.java?rev=3362&r1=3361&r2=3362&view=diff
==============================================================================
--- trunk/opensaml-util/src/test/java/org/opensaml/util/storage/StorageServiceTest.java (original)
[... 29 lines stripped ...]
More information about the commits
mailing list