code: @Override
  	// CHECKSTYLE:OFF
  	public synchronized Object getObjectInstance(Object obj, Name name, Context nameCtx, // NOPMD
  			Hashtable<?, ?> environment) throws NamingException { // NOPMD
  		// CHECKSTYLE:ON
  		final Reference reference = (Reference) obj;
  		final RefAddr jndiRefAddr = reference.get("jndi-ref");
  		if (jndiRefAddr == null) {
  			throw new NamingException("You must specify a 'jndi-ref' in the <Resource> tag");
  		}
  		final String jndiRef = (String) jndiRefAddr.getContent();
  		Object cachedObject = CACHED_OBJECTS.get(jndiRef);
  		if (cachedObject == null) {
  			final InitialContext context = new InitialContext();
  			cachedObject = context.lookup(jndiRef);
  			if (cachedObject == null) {
  				throw new NamingException("No jndi object found for the 'jndi-ref': " + jndiRef);
  			}
  			CACHED_OBJECTS.put(jndiRef, cachedObject);
  		}
  		return cachedObject;
  	}
docs: {@inheritDoc}