protected RetryableOperationResult applyOperationInternal()

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


    protected RetryableOperationResult applyOperationInternal(
            Session session, List<Operation> ops, String logMessage, String reference, RetryableOperation retry) {
        return retry.apply(
                () -> {
                    try {
                        processor.apply(session, ops);
                        if (session.hasPendingChanges()) {
                            session.save();
                        }
                        return new RetryableOperation.RetryableOperationResult(true, false, reference, 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, reference, 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, reference, ex);
                    }
                },
                logMessage);
    }