Use initialization holder class idiom
diff --git a/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/TypeRepository.java b/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/TypeRepository.java
index 31c2d4f..e7fc362 100755
--- a/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/TypeRepository.java
+++ b/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/TypeRepository.java
@@ -34,7 +34,6 @@
 import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.atomic.AtomicReference;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
@@ -257,22 +256,13 @@
         }
     }
 
-    private static final AtomicReference<WeakReference<TypeRepository>> singletonWeakRef = new AtomicReference<>();
+    private static enum RepoHolder {
+        ;
+        static final TypeRepository value = new TypeRepository();
+    }
+
     public static TypeRepository get() {
-        TypeRepository repo = null;
-        WeakReference<TypeRepository> weakRef = singletonWeakRef.get();
-        if (null != weakRef) {
-            repo = weakRef.get();
-            if (null != repo) return repo;
-        }
-        final TypeRepository newRepo = new TypeRepository();
-        final WeakReference<TypeRepository> newRef = new WeakReference<>(newRepo);
-        while(!!!singletonWeakRef.compareAndSet(weakRef, newRef)) {
-            weakRef = singletonWeakRef.get();
-            repo = weakRef.get();
-            if (null != repo) return repo;
-        }
-        return newRepo;
+        return RepoHolder.value;
     }
 
     public String getRepositoryID(Class<?> type) {
diff --git a/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/ValueHandlerImpl.java b/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/ValueHandlerImpl.java
index 0ed86c0..8a8bd23 100755
--- a/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/ValueHandlerImpl.java
+++ b/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/ValueHandlerImpl.java
@@ -18,8 +18,6 @@
 
 package org.apache.yoko.rmi.impl;
 
-import java.lang.ref.WeakReference;
-import java.util.concurrent.atomic.AtomicReference;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
@@ -43,22 +41,13 @@
         this.repo = TypeRepository.get();
     }
 
-    private static final AtomicReference<WeakReference<ValueHandlerImpl>> singletonWeakRef = new AtomicReference<>();
+    private static enum HandlerHolder {
+        ;
+        static final ValueHandlerImpl value = new ValueHandlerImpl();
+    }
+
     public static ValueHandlerImpl get() {
-        ValueHandlerImpl vh = null;
-        WeakReference<ValueHandlerImpl> weakRef = singletonWeakRef.get();
-        if (null != weakRef) {
-            vh = weakRef.get();
-            if (null != vh) return vh;
-        }
-        final ValueHandlerImpl newVh = new ValueHandlerImpl();
-        final WeakReference<ValueHandlerImpl> newRef = new WeakReference<>(newVh);
-        while(!!!singletonWeakRef.compareAndSet(weakRef, newRef)) {
-            weakRef = singletonWeakRef.get();
-            vh = weakRef.get();
-            if (null != vh) return vh;
-        }
-        return newVh;
+        return HandlerHolder.value;
     }
 
     private ValueDescriptor desc(Class clz) {