Может кто-либо обьяснить, почему:
Service s = cache.getService(jndiName);
    if (s == null) {
            InitialContext iс = new InitialContext();
            cache.addService((Service) iс.lookup(jndiName));
            s = cache.getService(jndiName);
            }
            return s;
            }
Ужасно. кошмарно и не проходит 5й пункт, а:
Service s = cache.getService(jndiName);
        if (s == null) {
            InitialContext iс = new InitialContext();
            cache.addService(s = (Service) iс.lookup(jndiName));
        }
        return s;
    }
Отлично, великолепно и проходит? Потому, что я реально не понимаю разницы...