public void deregisterDeferredService() {
        Object obj = serviceReg.get();
        if (obj == null) {
            // already deregistered so there is nothing to be done
            return;
        }
        if (obj instanceof CountDownLatch) {
            // If someone else has the latch, then let them do whatever they are doing and we pretend
            // we've already done the deregister.
            return;
        } else if (obj instanceof ServiceRegistration<?>) {
            CountDownLatch latch = new CountDownLatch(1);
            if (serviceReg.compareAndSet(obj, latch)) {
                // This thread won the right to deregister the service
                try {
                    ((ServiceRegistration<?>) obj).unregister();
                    // successfully deregistered - nothing more to do
                    return;
                } finally {
                    // if the serviceReg was not updated for any reason, we need to restore the previous value
                    serviceReg.compareAndSet(latch, obj);
                    // in any case we need to allow any blocked threads to proceed
                    latch.countDown();
                }
            }
        }

    }
public void deregisterDeferredService ( ) { Object obj = serviceReg . get ( ) ; if ( obj == null ) { return ; } if ( obj instanceof CountDownLatch ) { return ; } else if ( obj instanceof ServiceRegistration < ? > ) { CountDownLatch latch = new CountDownLatch ( 1 ) ; if ( serviceReg . compareAndSet ( obj , latch ) ) { try { ( ( ServiceRegistration < ? > ) obj ) . unregister ( ) ; return ; } finally { serviceReg . compareAndSet ( latch , obj ) ; latch . countDown ( ) ; } } } }
Unregister information provided after class loader was created