code: private ODatabaseDocument checkAndAcquireConnection() {
          final ODatabaseDocument res;
          if (userManager.isSpecificUser()) {
              // non pool-managed connection for different user
              res = orientDB.get().open(database, userManager.getUser(), userManager.getPassword());
          } else {
              res = pool.acquire();
          }
  
          if (res.isClosed()) {
              final String message = String.format(
                      "Pool %s return closed connection something is terribly wrong", getType());
              logger.error(message);
              throw new IllegalStateException(message);
          }
          return res;
      }
docs: Its definitely not normal that pool returns closed connections, but possible if used improperly.
  
  @return connection itself or new valid connection