private Object executeWithPossibleReAuthentication(Connection conn, Op op) throws Exception { try { return conn.execute(op); } catch (ServerConnectivityException sce) { Throwable cause = sce.getCause(); if ((cause instanceof AuthenticationRequiredException && "User authorization attributes not found.".equals(cause.getMessage())) || sce.getMessage().contains("Connection error while authenticating user")) { // (ashetkar) Need a cleaner way of doing above check. // 2nd exception-message above is from AbstractOp.sendMessage() PoolImpl pool = (PoolImpl) PoolManagerImpl.getPMI().find(this.endpointManager.getPoolName()); if (!pool.getMultiuserAuthentication()) { Connection connImpl = this.connectionManager.getConnection(conn); conn.getServer().setUserId((Long) AuthenticateUserOp.executeOn(connImpl, this)); return conn.execute(op); } else { UserAttributes ua = UserAttributes.userAttributes.get(); if (ua != null) { authenticateMultiuser(pool, conn, ua); } return conn.execute(op); } } else { throw sce; } } }
(PoolImpl) PoolManagerImpl.getPMI().find(this.endpointManager.getPoolName()); if (poolImpl == null) { return;