protected RetryableOperationResult applyOperationInternal()

in src/main/java/org/apache/sling/jcr/repoinit/impl/RepositoryInitializerFactory.java [173:199]


    protected RetryableOperationResult applyOperationInternal(Session session, List<Operation> ops, String logMessage,
            RetryableOperation retry) {
        return retry.apply(() -> {
            try {
                processor.apply(session, ops);
                session.save();
                return new RetryableOperation.RetryableOperationResult(true,false,null);
            } catch (InvalidItemStateException|RepoInitException ex) {
                // a retry makes sense, because this exception might be caused by an concurrent operation
                log.debug("(temporarily) failed to apply repoinit operations",ex);
                try {
                    session.refresh(false); // discard all pending changes
                } catch (RepositoryException e1) {
                    // ignore
                }
                return new RetryableOperation.RetryableOperationResult(false,true,ex);
            } catch (RepositoryException ex) {
                // a permanent error, retry is not useful
                try {
                    session.refresh(false); // discard all pending changes
                } catch (RepositoryException e1) {
                    // ignore
                }
                return new RetryableOperation.RetryableOperationResult(false,false,ex);
            }
        }, logMessage);
    }