public static @Nonnull ConfidentialStore get() {
        if (TEST!=null) return TEST.get();

        Jenkins j = Jenkins.getInstance();
        Lookup lookup = j.lookup;
        ConfidentialStore cs = lookup.get(ConfidentialStore.class);
        if (cs==null) {
            try {
                Iterator<ConfidentialStore> it = ServiceLoader.load(ConfidentialStore.class, ConfidentialStore.class.getClassLoader()).iterator();
                if (it.hasNext()) {
                    cs = it.next();
                }
            } catch (ServiceConfigurationError e) {
                LOGGER.log(Level.WARNING, "Failed to list up ConfidentialStore implementations",e);
                // fall through
            }

            if (cs==null)
                try {
                    cs = new DefaultConfidentialStore();
                } catch (Exception e) {
                    // if it's still null, bail out
                    throw new Error(e);
                }

            cs = lookup.setIfNull(ConfidentialStore.class,cs);
        }
        return cs;
    }
public static @ Nonnull ConfidentialStore get ( ) { if ( TEST != null ) return TEST . get ( ) ; Jenkins j = Jenkins . getInstance ( ) ; Lookup lookup = j . lookup ; ConfidentialStore cs = lookup . get ( ConfidentialStore . class ) ; if ( cs == null ) { try { Iterator < ConfidentialStore > it = ServiceLoader . load ( ConfidentialStore . class , ConfidentialStore . class . getClassLoader ( ) ) . iterator ( ) ; if ( it . hasNext ( ) ) { cs = it . next ( ) ; } } catch ( ServiceConfigurationError e ) { LOGGER . log ( Level . WARNING , "Failed to list up ConfidentialStore implementations" , e ) ; } if ( cs == null ) try { cs = new DefaultConfidentialStore ( ) ; } catch ( Exception e ) { throw new Error ( e ) ; } cs = lookup . setIfNull ( ConfidentialStore . class , cs ) ; } return cs ; }
Retrieves the currently active singleton instance of {@link ConfidentialStore}.