title: CXF's readEntity() got "Entity is not available"
body: <p>I am working on a piece of code that uses <code>CXF</code> (3.1.2)</p>
  
  <p>I am seeing this error intermittently:</p>
  
  <pre><code>java.lang.IllegalStateException: Entity is not available
  at org.apache.cxf.jaxrs.impl.ResponseImpl.checkEntityIsClosed(ResponseImpl.java:481)
  at org.apache.cxf.jaxrs.impl.ResponseImpl.doReadEntity(ResponseImpl.java:333)
  at org.apache.cxf.jaxrs.impl.ResponseImpl.readEntity(ResponseImpl.java:320)
  at org.apache.cxf.jaxrs.impl.ResponseImpl.readEntity(ResponseImpl.java:310)
  </code></pre>
  
  <p>To improve performance, the <code>Response</code> objects are held through a Google Guava <code>LoadingCache</code> (<code>com.google.common.cache.LoadingCache</code>).  It seems like I would get this error after an object has been in the cache for a few minutes.  Could the <code>Response</code> object because invalid 
  after a few minutes?</p>
  
  <pre><code>private static LoadingCache&lt;String, Response&gt; cachedLdapRespMap
      = CacheBuilder.newBuilder()
          .maximumSize(Constants.LDAP_RESP_CACHE_SIZE)
          .expireAfterWrite(Constants.LDAP_RESP_CACHE_KEEP_ALIVE_MINUTE
                              , TimeUnit.MINUTES)
          .build(
                  new CacheLoader&lt;String, Response&gt;() {
  
                      @Override
                      public Response load(String uid)
                              throws Exception {
                          Response res = makeLdapRequest(uid);
                          return res;
                      }
  
                  }
              );
  </code></pre>