code: void putEntityManager(EntityManager entityManager) {
          if (entityManager != null && entityManager.isOpen()) {
              boolean addToPool = false;
  
              entityManager.clear();
              synchronized (this) {
                  if (ivPoolSize < ivPoolCapacity) {
                      ++ivPoolSize;
                      addToPool = true;
                  }
              }
  
              if (addToPool) {
                  if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                      Tr.debug(tc, "putEntityManager : [" + ivPoolSize + "] " +
                                   entityManager);
                  ivPool.add(entityManager);
              } else {
                  if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                      Tr.debug(tc, "putEntityManager : close : " + entityManager);
                  entityManager.close();
              }
          } else {
              if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                  Tr.debug(tc, "putEntityManager : not open : " + entityManager);
          }
      }
docs: Returns an EntityManager instance to the pool (after clearing), or
  closes the EntityManager if the pool is full.
  If the provider supports the "prepareForPooling()" API, then
  that method will be invoked to clear the Entity Manager and prepare
  it for pooling. Otherwise we will call clear on the Entity Manager
  directly. <p>
  
  @param entityManager
  EntityManager to place in the pool; or close.