private static EmbeddedCacheManager findCacheContainer()
    {
        EmbeddedCacheManager ret = null;
        InitialContext context = null;
        try {
            context = new InitialContext();
        } catch (final NamingException ex) {
            InfinispanCache.LOG.error("Could not initialise JNDI InitialContext", ex);
        }
        for (final String lookup : InfinispanCache.KNOWN_JNDI_KEYS) {
            if (lookup != null) {
                try {
                    ret = (EmbeddedCacheManager) context.lookup(lookup);
                    InfinispanCache.LOG.info("CacheContainer found in JNDI under '{}'", lookup);
                } catch (final NamingException e) {
                    InfinispanCache.LOG.debug("CacheContainer not found in JNDI under '{}'", lookup);
                }
            }
        }
        if (ret == null) {
            InfinispanCache.LOG.debug("No CacheContainer found under known names");
        }
        return ret;
    }
private static EmbeddedCacheManager findCacheContainer ( ) { EmbeddedCacheManager ret = null ; InitialContext context = null ; try { context = new InitialContext ( ) ; } catch ( final NamingException ex ) { InfinispanCache . LOG . error ( "Could not initialise JNDI InitialContext" , ex ) ; } for ( final String lookup : InfinispanCache . KNOWN_JNDI_KEYS ) { if ( lookup != null ) { try { ret = ( EmbeddedCacheManager ) context . lookup ( lookup ) ; InfinispanCache . LOG . info ( "CacheContainer found in JNDI under '{}'" , lookup ) ; } catch ( final NamingException e ) { InfinispanCache . LOG . debug ( "CacheContainer not found in JNDI under '{}'" , lookup ) ; } } } if ( ret == null ) { InfinispanCache . LOG . debug ( "No CacheContainer found under known names" ) ; } return ret ; }
@return the CacheContainer