svn commit: r1078215 - /ofbiz/trunk/framework/base/src/org/ofbiz/base/concurrent/TTLObject.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1078215 - /ofbiz/trunk/framework/base/src/org/ofbiz/base/concurrent/TTLObject.java

mrisaliti
Author: mrisaliti
Date: Fri Mar  4 23:29:42 2011
New Revision: 1078215

URL: http://svn.apache.org/viewvc?rev=1078215&view=rev
Log:
Remove some warning in TTLObject (OFBIZ-4102)

Modified:
    ofbiz/trunk/framework/base/src/org/ofbiz/base/concurrent/TTLObject.java

Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/concurrent/TTLObject.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/concurrent/TTLObject.java?rev=1078215&r1=1078214&r2=1078215&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/org/ofbiz/base/concurrent/TTLObject.java (original)
+++ ofbiz/trunk/framework/base/src/org/ofbiz/base/concurrent/TTLObject.java Fri Mar  4 23:29:42 2011
@@ -29,6 +29,7 @@ import java.util.concurrent.atomic.Atomi
 
 import org.ofbiz.base.lang.ObjectWrapper;
 import org.ofbiz.base.lang.SourceMonitored;
+import org.ofbiz.base.util.UtilGenerics;
 
 @SourceMonitored
 public abstract class TTLObject<T> implements ObjectWrapper<T> {
@@ -81,9 +82,9 @@ public abstract class TTLObject<T> imple
     }
 
     public enum State { INVALID, REGEN, REGENERATING, GENERATE, GENERATING, GENERATING_INITIAL, VALID, ERROR, ERROR_INITIAL, SET }
-    private volatile ValueAndState<T> object = new StandardValueAndState<T>(this, null, null, State.INVALID, 0, null, null);
-    private static final AtomicReferenceFieldUpdater<TTLObject, ValueAndState> objectAccessor = AtomicReferenceFieldUpdater.newUpdater(TTLObject.class, ValueAndState.class, "object");
-    private static final AtomicIntegerFieldUpdater<TTLObject> serialAccessor = AtomicIntegerFieldUpdater.newUpdater(TTLObject.class, "serial");
+    @SuppressWarnings("unchecked")
+    private static final AtomicReferenceFieldUpdater<TTLObject<?>, ValueAndState> objectAccessor = UtilGenerics.cast(AtomicReferenceFieldUpdater.newUpdater(TTLObject.class, ValueAndState.class, "object"));
+    private static final AtomicIntegerFieldUpdater<TTLObject<?>> serialAccessor = UtilGenerics.cast(AtomicIntegerFieldUpdater.newUpdater(TTLObject.class, "serial"));
     protected volatile int serial;
 
     protected static abstract class ValueAndState<T> {
@@ -138,6 +139,7 @@ public abstract class TTLObject<T> imple
         return new StandardValueAndState<T>(this, value, future, state, serial, t, pulse);
     }
 
+    @SuppressWarnings("hiding")
     private class StandardValueAndState<T> extends ValueAndState<T> {
         protected final T value;