Tentative solution for AXIS2-5904.
diff --git a/modules/kernel/src/org/apache/axis2/description/AxisBindingMessage.java b/modules/kernel/src/org/apache/axis2/description/AxisBindingMessage.java
index e358cbb..87b374e 100644
--- a/modules/kernel/src/org/apache/axis2/description/AxisBindingMessage.java
+++ b/modules/kernel/src/org/apache/axis2/description/AxisBindingMessage.java
@@ -53,7 +53,7 @@
private boolean fault = false;
private volatile Policy effectivePolicy = null;
- private volatile Date lastPolicyCalculatedTime = null;
+ private volatile OpaqueInstant lastPolicyCalculatedTime = null;
public boolean isFault() {
return fault;
@@ -225,7 +225,7 @@
synchronized (this) {
if (lastPolicyCalculatedTime == null || isPolicyUpdated()) {
effectivePolicy = calculateEffectivePolicy();
- lastPolicyCalculatedTime = new Date();
+ lastPolicyCalculatedTime = new OpaqueInstant();
}
}
}
diff --git a/modules/kernel/src/org/apache/axis2/description/AxisMessage.java b/modules/kernel/src/org/apache/axis2/description/AxisMessage.java
index f7a1d07..eb8d85c 100644
--- a/modules/kernel/src/org/apache/axis2/description/AxisMessage.java
+++ b/modules/kernel/src/org/apache/axis2/description/AxisMessage.java
@@ -37,7 +37,6 @@
import javax.xml.namespace.QName;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.Date;
import java.util.List;
@@ -67,7 +66,7 @@
private boolean wrapped = true;
private volatile Policy effectivePolicy = null;
- private volatile Date lastPolicyCalculatedTime = null;
+ private volatile OpaqueInstant lastPolicyCalculatedTime = null;
public String getMessagePartName() {
return messagePartName;
@@ -241,7 +240,7 @@
synchronized (this) {
if (lastPolicyCalculatedTime == null || isPolicyUpdated()) {
effectivePolicy = calculateEffectivePolicy();
- lastPolicyCalculatedTime = new Date();
+ lastPolicyCalculatedTime = new OpaqueInstant();
}
}
}
diff --git a/modules/kernel/src/org/apache/axis2/description/OpaqueInstant.java b/modules/kernel/src/org/apache/axis2/description/OpaqueInstant.java
new file mode 100644
index 0000000..b28e024
--- /dev/null
+++ b/modules/kernel/src/org/apache/axis2/description/OpaqueInstant.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axis2.description;
+
+import java.util.concurrent.atomic.AtomicInteger;
+
+public final class OpaqueInstant {
+ private static final AtomicInteger nextSequence = new AtomicInteger();
+
+ private final int sequence;
+
+ public OpaqueInstant() {
+ sequence = nextSequence.getAndIncrement();
+ }
+
+ public boolean after(OpaqueInstant when) {
+ return sequence > when.sequence;
+ }
+}
diff --git a/modules/kernel/src/org/apache/axis2/description/PolicySubject.java b/modules/kernel/src/org/apache/axis2/description/PolicySubject.java
index 49e0b59..3bcaab0 100644
--- a/modules/kernel/src/org/apache/axis2/description/PolicySubject.java
+++ b/modules/kernel/src/org/apache/axis2/description/PolicySubject.java
@@ -25,13 +25,12 @@
import org.apache.neethi.PolicyReference;
import java.util.Collection;
-import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
public class PolicySubject {
- private Date lastUpdatedTime = new Date();
+ private OpaqueInstant lastUpdatedTime = new OpaqueInstant();
private ConcurrentHashMap<String, PolicyComponent> attachedPolicyComponents = new ConcurrentHashMap<String, PolicyComponent>();
@@ -49,7 +48,7 @@
public void attachPolicyReference(PolicyReference reference) {
attachedPolicyComponents.put(reference.getURI(), reference);
- setLastUpdatedTime(new Date());
+ setLastUpdatedTime(new OpaqueInstant());
}
public void attachPolicyComponents(List<PolicyComponent> policyComponents) {
@@ -74,7 +73,7 @@
public void attachPolicyComponent(String key,
PolicyComponent policyComponent) {
attachedPolicyComponents.put(key, policyComponent);
- setLastUpdatedTime(new Date());
+ setLastUpdatedTime(new OpaqueInstant());
}
public PolicyComponent getAttachedPolicyComponent(String key) {
@@ -94,24 +93,24 @@
"policy doesn't have a name or an id ");
}
attachedPolicyComponents.put(key, policy);
- setLastUpdatedTime(new Date());
+ setLastUpdatedTime(new OpaqueInstant());
}
public void detachPolicyComponent(String key) {
attachedPolicyComponents.remove(key);
- setLastUpdatedTime(new Date());
+ setLastUpdatedTime(new OpaqueInstant());
}
public void clear() {
attachedPolicyComponents.clear();
- setLastUpdatedTime(new Date());
+ setLastUpdatedTime(new OpaqueInstant());
}
- public Date getLastUpdatedTime() {
+ public OpaqueInstant getLastUpdatedTime() {
return lastUpdatedTime;
}
- public void setLastUpdatedTime(Date lastUpdatedTime) {
+ public void setLastUpdatedTime(OpaqueInstant lastUpdatedTime) {
this.lastUpdatedTime = lastUpdatedTime;
}
}