[ANNOUNCE] Apache Jackrabbit 2.8.6 released

2017-09-27 Thread Julian Reschke

The Apache Jackrabbit community is pleased to announce the release of
Apache Jackrabbit 2.8.6. The release is available for download at:

https://jackrabbit.apache.org/jcr/downloads.html#v2.8

See the full release notes below for details about this release:

Release Notes -- Apache Jackrabbit -- Version 2.8.6

Introduction


This is Apache Jackrabbit(TM) 2.8.6, a fully compliant implementation of the
Content Repository for Java(TM) Technology API, version 2.0 (JCR 2.0) as
specified in the Java Specification Request 283 (JSR 283).

Apache Jackrabbit 2.8.6 is a patch release that contains fixes and
improvements over Jackrabbit 2.8. Jackrabbit 2.8.x releases are considered
stable and targeted for production use.

Changes since Jackrabbit 2.8.5
--

Bug

[JCR-4079] - incorrect PROPPATCH response error handling
[JCR-4118] - RepositoryChecker creates invalid node names
[JCR-4121] - ConcurrentModificationException in 
InternalVersionHistoryImpl.fixLegacy()

[JCR-4133] - fix javadoc problems that are errors with JDK8

Improvement

[JCR-3924] - Allow release-deploy to skip tests

Task

[JCR-4122] - align parent pom references with Oak
[JCR-4129] - get rid of unused org.json dependency


In addition to the above-mentioned changes, this release contains
all the changes included up to the Apache Jackrabbit 2.8.3 release.

For more detailed information about all the changes in this and other
Jackrabbit releases, please see the Jackrabbit issue tracker at

https://issues.apache.org/jira/browse/JCR

Release Contents


This release consists of a single source archive packaged as a zip file.
The archive can be unpacked with the jar tool from your JDK installation.
See the README.txt file for instructions on how to build this release.

The source archive is accompanied by SHA1 and MD5 checksums and a PGP
signature that you can use to verify the authenticity of your download.
The public key used for the PGP signature can be found at
https://svn.apache.org/repos/asf/jackrabbit/dist/KEYS.

About Apache Jackrabbit
---

Apache Jackrabbit is a fully conforming implementation of the Content
Repository for Java Technology API (JCR). A content repository is a
hierarchical content store with support for structured and unstructured
content, full text search, versioning, transactions, observation, and
more.

For more information, visit http://jackrabbit.apache.org/

About The Apache Software Foundation


Established in 1999, The Apache Software Foundation provides organizational,
legal, and financial support for more than 140 freely-available,
collaboratively-developed Open Source projects. The pragmatic Apache License
enables individual and commercial users to easily deploy Apache software;
the Foundation's intellectual property framework limits the legal exposure
of its 3,800+ contributors.

For more information, visit http://www.apache.org/

Trademarks
--

Apache Jackrabbit, Jackrabbit, Apache, the Apache feather logo, and the 
Apache

Jackrabbit project logo are trademarks of The Apache Software Foundation.







adaptTo() 2017 - slides online

2017-09-27 Thread Stefan Seifert
the slides of the adaptTo() 2017 conference in berlin are now online - 24 talks 
plus lightning talks, 200 participants.

you find the slides and code samples here:
https://adapt.to/2017/schedule

and some images... (more to follow)
https://adapt.to/2017/en/conference/gallery.html

this year we have also video recordings in high quality, published at youtube. 
the videos are linked in the talk page of the schedule as well (currently only 
from day 1 available - more to come soon).

stefan




Re: Debugging oak-pojosr test failures

2017-09-27 Thread Robert Munteanu
Eventually managed to understand the root cause using the Felix
ScrService and printing out component information.

See https://issues.apache.org/jira/browse/OAK-6736 .

Thanks,

Robert


On Wed, 2017-09-27 at 19:27 +0530, Chetan Mehrotra wrote:
> You need to do two changes
> 
> 1. Set ds.loglevel=4 as you have done
> 2. Configure logger corresponding to bundle symbolic name to trace
> level. Do it for the bundles you are interested in
> 
> 
> 
> > BTW, did you ever try to set up the web console? I would give it a
> > shot.
> 
> Not here but the standalone example do configure the Felix WebConsole
> [1]. You can try if standalone comes up with your changes to see it
> works for basic case
> 
> Chetan Mehrotra
> [1] https://github.com/apache/jackrabbit-oak/blob/trunk/oak-examples/
> standalone/src/main/java/org/apache/jackrabbit/oak/standalone/WebCons
> oleSupport.java
> 
> 
> On Wed, Sep 27, 2017 at 5:18 PM, Robert Munteanu 
> wrote:
> > Hi Chetan,
> > 
> > On Wed, 2017-09-27 at 15:48 +0530, Chetan Mehrotra wrote:
> > > Hi Robert,
> > > 
> > > The unit-test.log should give details about which bundle is
> > > starting
> > > and which components are activated like [1]. For the error you
> > > are
> > > seeing it means RepositoryManager is not getting activated for
> > > some
> > > reason (may be some missing dependency).
> > > 
> > > So we would need to analyze from OSGi side to see which component
> > > has
> > > dependency missing. This is bit tricky in absence of Felix
> > > WebConsole.
> > > Probably enabling SCR logs (ds.loglevel=3?) would give some
> > > insight
> > > here
> > 
> > How would I do that? I tried the following change but got no extra
> > logs:
> > 
> > diff --git a/oak-
> > pojosr/src/test/groovy/org/apache/jackrabbit/oak/run/osgi/AbstractR
> > epos
> > itoryFactoryTest.groovy b/oak-
> > pojosr/src/test/groovy/org/apache/jackrabbit/oak/run/osgi/AbstractR
> > epos
> > itoryFactoryTest.groovy
> > index e0d08b5025..91f39bc277 100644
> > --- a/oak-
> > pojosr/src/test/groovy/org/apache/jackrabbit/oak/run/osgi/AbstractR
> > epos
> > itoryFactoryTest.groovy
> > +++ b/oak-
> > pojosr/src/test/groovy/org/apache/jackrabbit/oak/run/osgi/AbstractR
> > epos
> > itoryFactoryTest.groovy
> > @@ -57,6 +57,7 @@ abstract class AbstractRepositoryFactoryTest{
> >  config = [
> >  (REPOSITORY_HOME): workDir.absolutePath,
> >  (REPOSITORY_TIMEOUT_IN_SECS) : 60,
> > +"ds.loglevel" : 3
> >  ]
> >  }
> > 
> > BTW, did you ever try to set up the web console? I would give it a
> > shot.
> > 
> > Thanks,
> > 
> > Robert
> > 
> > > 
> > > Chetan Mehrotra
> > > [1]
> > > 27.09.2017 15:43:06.603 *INFO* [main]
> > > org.apache.jackrabbit.oak-query-spi BundleEvent STARTED
> > > 27.09.2017 15:43:06.603 *INFO* [main] org.apache.jackrabbit.oak-
> > > core
> > > BundleEvent STARTING
> > > 27.09.2017 15:43:06.761 *INFO* [main] org.apache.jackrabbit.oak-
> > > core
> > > Service
> > > [org.apache.jackrabbit.oak.spi.security.user.action.DefaultAuthor
> > > izab
> > > leActionProvider,17,
> > > [org.apache.jackrabbit.oak.spi.security.user.action.AuthorizableA
> > > ctio
> > > nProvider]]
> > > ServiceEvent REGISTERED
> > > 27.09.2017 15:43:06.762 *INFO* [main] org.apache.jackrabbit.oak-
> > > core
> > > Service
> > > [org.apache.jackrabbit.oak.security.authorization.restriction.Res
> > > tric
> > > tionProviderImpl,18,
> > > [org.apache.jackrabbit.oak.spi.security.authorization.restriction
> > > .Res
> > > trictionProvider]]
> > > ServiceEvent REGISTERED
> > > 27.09.2017 15:43:06.770 *INFO* [main]
> > > org.apache.jackrabbit.oak.plugins.metric.StatisticsProviderFactor
> > > y
> > > Using MetricsStatisticsProvider
> > > 27.09.2017 15:43:06.804 *INFO* [main] org.apache.jackrabbit.oak-
> > > core
> > > Service [19, [com.codahale.metrics.MetricRegistry]] ServiceEvent
> > > REGISTERED
> > > 27.09.2017 15:43:06.825 *INFO* [main]
> > > org.apache.jackrabbit.oak.segment.file.FileStore Creating file
> > > store
> > > FileStoreBuilder{version=1.8-SNAPSHOT,
> > > directory=/home/chetanm/git/apache/jackrabbit-oak/oak-
> > > pojosr/target/junit5333968922356600629/repository/segmentstore,
> > > blobStore=null, maxFileSize=256, segmentCacheSize=256,
> > > stringCacheSize=256, templateCacheSize=64,
> > > stringDeduplicationCacheSize=15000,
> > > templateDeduplicationCacheSize=3000,
> > > nodeDeduplicationCacheSize=1048576, memoryMapping=true,
> > > gcOptions=SegmentGCOptions{paused=false,
> > > estimationDisabled=false,
> > > gcSizeDeltaEstimation=1073741824, retryCount=5, forceTimeout=60,
> > > retainedGenerations=2, gcType=FULL}}
> > > 27.09.2017 15:43:07.070 *INFO* [main]
> > > org.apache.jackrabbit.oak.segment.file.FileStore TarMK opened:
> > > /home/chetanm/git/apache/jackrabbit-oak/oak-
> > > pojosr/target/junit5333968922356600629/repository/segmentstore
> > > (mmap=true)
> > > 27.09.2017 15:43:07.135 *INFO* [main]
> > > 

Re: Debugging oak-pojosr test failures

2017-09-27 Thread Chetan Mehrotra
You need to do two changes

1. Set ds.loglevel=4 as you have done
2. Configure logger corresponding to bundle symbolic name to trace
level. Do it for the bundles you are interested in



> BTW, did you ever try to set up the web console? I would give it a shot.

Not here but the standalone example do configure the Felix WebConsole
[1]. You can try if standalone comes up with your changes to see it
works for basic case

Chetan Mehrotra
[1] 
https://github.com/apache/jackrabbit-oak/blob/trunk/oak-examples/standalone/src/main/java/org/apache/jackrabbit/oak/standalone/WebConsoleSupport.java


On Wed, Sep 27, 2017 at 5:18 PM, Robert Munteanu  wrote:
> Hi Chetan,
>
> On Wed, 2017-09-27 at 15:48 +0530, Chetan Mehrotra wrote:
>> Hi Robert,
>>
>> The unit-test.log should give details about which bundle is starting
>> and which components are activated like [1]. For the error you are
>> seeing it means RepositoryManager is not getting activated for some
>> reason (may be some missing dependency).
>>
>> So we would need to analyze from OSGi side to see which component has
>> dependency missing. This is bit tricky in absence of Felix
>> WebConsole.
>> Probably enabling SCR logs (ds.loglevel=3?) would give some insight
>> here
>
> How would I do that? I tried the following change but got no extra
> logs:
>
> diff --git a/oak-
> pojosr/src/test/groovy/org/apache/jackrabbit/oak/run/osgi/AbstractRepos
> itoryFactoryTest.groovy b/oak-
> pojosr/src/test/groovy/org/apache/jackrabbit/oak/run/osgi/AbstractRepos
> itoryFactoryTest.groovy
> index e0d08b5025..91f39bc277 100644
> --- a/oak-
> pojosr/src/test/groovy/org/apache/jackrabbit/oak/run/osgi/AbstractRepos
> itoryFactoryTest.groovy
> +++ b/oak-
> pojosr/src/test/groovy/org/apache/jackrabbit/oak/run/osgi/AbstractRepos
> itoryFactoryTest.groovy
> @@ -57,6 +57,7 @@ abstract class AbstractRepositoryFactoryTest{
>  config = [
>  (REPOSITORY_HOME): workDir.absolutePath,
>  (REPOSITORY_TIMEOUT_IN_SECS) : 60,
> +"ds.loglevel" : 3
>  ]
>  }
>
> BTW, did you ever try to set up the web console? I would give it a
> shot.
>
> Thanks,
>
> Robert
>
>>
>> Chetan Mehrotra
>> [1]
>> 27.09.2017 15:43:06.603 *INFO* [main]
>> org.apache.jackrabbit.oak-query-spi BundleEvent STARTED
>> 27.09.2017 15:43:06.603 *INFO* [main] org.apache.jackrabbit.oak-core
>> BundleEvent STARTING
>> 27.09.2017 15:43:06.761 *INFO* [main] org.apache.jackrabbit.oak-core
>> Service
>> [org.apache.jackrabbit.oak.spi.security.user.action.DefaultAuthorizab
>> leActionProvider,17,
>> [org.apache.jackrabbit.oak.spi.security.user.action.AuthorizableActio
>> nProvider]]
>> ServiceEvent REGISTERED
>> 27.09.2017 15:43:06.762 *INFO* [main] org.apache.jackrabbit.oak-core
>> Service
>> [org.apache.jackrabbit.oak.security.authorization.restriction.Restric
>> tionProviderImpl,18,
>> [org.apache.jackrabbit.oak.spi.security.authorization.restriction.Res
>> trictionProvider]]
>> ServiceEvent REGISTERED
>> 27.09.2017 15:43:06.770 *INFO* [main]
>> org.apache.jackrabbit.oak.plugins.metric.StatisticsProviderFactory
>> Using MetricsStatisticsProvider
>> 27.09.2017 15:43:06.804 *INFO* [main] org.apache.jackrabbit.oak-core
>> Service [19, [com.codahale.metrics.MetricRegistry]] ServiceEvent
>> REGISTERED
>> 27.09.2017 15:43:06.825 *INFO* [main]
>> org.apache.jackrabbit.oak.segment.file.FileStore Creating file store
>> FileStoreBuilder{version=1.8-SNAPSHOT,
>> directory=/home/chetanm/git/apache/jackrabbit-oak/oak-
>> pojosr/target/junit5333968922356600629/repository/segmentstore,
>> blobStore=null, maxFileSize=256, segmentCacheSize=256,
>> stringCacheSize=256, templateCacheSize=64,
>> stringDeduplicationCacheSize=15000,
>> templateDeduplicationCacheSize=3000,
>> nodeDeduplicationCacheSize=1048576, memoryMapping=true,
>> gcOptions=SegmentGCOptions{paused=false, estimationDisabled=false,
>> gcSizeDeltaEstimation=1073741824, retryCount=5, forceTimeout=60,
>> retainedGenerations=2, gcType=FULL}}
>> 27.09.2017 15:43:07.070 *INFO* [main]
>> org.apache.jackrabbit.oak.segment.file.FileStore TarMK opened:
>> /home/chetanm/git/apache/jackrabbit-oak/oak-
>> pojosr/target/junit5333968922356600629/repository/segmentstore
>> (mmap=true)
>> 27.09.2017 15:43:07.135 *INFO* [main]
>> org.apache.jackrabbit.oak-segment-tar Service [21,
>> [org.apache.jackrabbit.oak.api.jmx.CacheStatsMBean]] ServiceEvent
>> REGISTERED
>> 27.09.2017 15:43:07.137 *INFO* [main]
>> org.apache.jackrabbit.oak-segment-tar Service [22,
>> [org.apache.jackrabbit.oak.api.jmx.CacheStatsMBean]] ServiceEvent
>> REGISTERED
>> 27.09.2017 15:43:07.138 *INFO* [main]
>> org.apache.jackrabbit.oak-segment-tar Service [23,
>> [org.apache.jackrabbit.oak.api.jmx.CacheStatsMBean]] ServiceEvent
>> REGISTERED
>> 27.09.2017 15:43:07.140 *INFO* [main]
>> org.apache.jackrabbit.oak-segment-tar Service [24,
>> [org.apache.jackrabbit.oak.api.jmx.CacheStatsMBean]] ServiceEvent
>> REGISTERED
>> 27.09.2017 15:43:07.141 *INFO* 

Re: Debugging oak-pojosr test failures

2017-09-27 Thread Chetan Mehrotra
Hi Robert,

The unit-test.log should give details about which bundle is starting
and which components are activated like [1]. For the error you are
seeing it means RepositoryManager is not getting activated for some
reason (may be some missing dependency).

So we would need to analyze from OSGi side to see which component has
dependency missing. This is bit tricky in absence of Felix WebConsole.
Probably enabling SCR logs (ds.loglevel=3?) would give some insight
here

Chetan Mehrotra
[1]
27.09.2017 15:43:06.603 *INFO* [main]
org.apache.jackrabbit.oak-query-spi BundleEvent STARTED
27.09.2017 15:43:06.603 *INFO* [main] org.apache.jackrabbit.oak-core
BundleEvent STARTING
27.09.2017 15:43:06.761 *INFO* [main] org.apache.jackrabbit.oak-core
Service 
[org.apache.jackrabbit.oak.spi.security.user.action.DefaultAuthorizableActionProvider,17,
[org.apache.jackrabbit.oak.spi.security.user.action.AuthorizableActionProvider]]
ServiceEvent REGISTERED
27.09.2017 15:43:06.762 *INFO* [main] org.apache.jackrabbit.oak-core
Service 
[org.apache.jackrabbit.oak.security.authorization.restriction.RestrictionProviderImpl,18,
[org.apache.jackrabbit.oak.spi.security.authorization.restriction.RestrictionProvider]]
ServiceEvent REGISTERED
27.09.2017 15:43:06.770 *INFO* [main]
org.apache.jackrabbit.oak.plugins.metric.StatisticsProviderFactory
Using MetricsStatisticsProvider
27.09.2017 15:43:06.804 *INFO* [main] org.apache.jackrabbit.oak-core
Service [19, [com.codahale.metrics.MetricRegistry]] ServiceEvent
REGISTERED
27.09.2017 15:43:06.825 *INFO* [main]
org.apache.jackrabbit.oak.segment.file.FileStore Creating file store
FileStoreBuilder{version=1.8-SNAPSHOT,
directory=/home/chetanm/git/apache/jackrabbit-oak/oak-pojosr/target/junit5333968922356600629/repository/segmentstore,
blobStore=null, maxFileSize=256, segmentCacheSize=256,
stringCacheSize=256, templateCacheSize=64,
stringDeduplicationCacheSize=15000,
templateDeduplicationCacheSize=3000,
nodeDeduplicationCacheSize=1048576, memoryMapping=true,
gcOptions=SegmentGCOptions{paused=false, estimationDisabled=false,
gcSizeDeltaEstimation=1073741824, retryCount=5, forceTimeout=60,
retainedGenerations=2, gcType=FULL}}
27.09.2017 15:43:07.070 *INFO* [main]
org.apache.jackrabbit.oak.segment.file.FileStore TarMK opened:
/home/chetanm/git/apache/jackrabbit-oak/oak-pojosr/target/junit5333968922356600629/repository/segmentstore
(mmap=true)
27.09.2017 15:43:07.135 *INFO* [main]
org.apache.jackrabbit.oak-segment-tar Service [21,
[org.apache.jackrabbit.oak.api.jmx.CacheStatsMBean]] ServiceEvent
REGISTERED
27.09.2017 15:43:07.137 *INFO* [main]
org.apache.jackrabbit.oak-segment-tar Service [22,
[org.apache.jackrabbit.oak.api.jmx.CacheStatsMBean]] ServiceEvent
REGISTERED
27.09.2017 15:43:07.138 *INFO* [main]
org.apache.jackrabbit.oak-segment-tar Service [23,
[org.apache.jackrabbit.oak.api.jmx.CacheStatsMBean]] ServiceEvent
REGISTERED
27.09.2017 15:43:07.140 *INFO* [main]
org.apache.jackrabbit.oak-segment-tar Service [24,
[org.apache.jackrabbit.oak.api.jmx.CacheStatsMBean]] ServiceEvent
REGISTERED
27.09.2017 15:43:07.141 *INFO* [main]
org.apache.jackrabbit.oak-segment-tar Service [25,
[org.apache.jackrabbit.oak.api.jmx.CacheStatsMBean]] ServiceEvent
REGISTERED
27.09.2017 15:43:07.143 *INFO* [main]
org.apache.jackrabbit.oak-segment-tar Service [26,
[org.apache.jackrabbit.oak.api.jmx.CacheStatsMBean]] ServiceEvent
REGISTERED
27.09.2017 15:43:07.145 *INFO* [main]
org.apache.jackrabbit.oak-segment-tar Service [27,
[org.apache.jackrabbit.oak.spi.gc.GCMonitor]] ServiceEvent REGISTERED
27.09.2017 15:43:07.148 *INFO* [main]
org.apache.jackrabbit.oak-segment-tar Service [28,
[org.apache.jackrabbit.oak.segment.compaction.SegmentRevisionGC]]
ServiceEvent REGISTERED
27.09.2017 15:43:07.153 *INFO* [main]
org.apache.jackrabbit.oak-segment-tar Service [29,
[org.apache.jackrabbit.oak.spi.state.RevisionGCMBean]] ServiceEvent
REGISTERED
27.09.2017 15:43:07.153 *INFO* [main]
org.apache.jackrabbit.oak-segment-tar Service [30,
[org.apache.jackrabbit.oak.segment.file.FileStoreStatsMBean]]
ServiceEvent REGISTERED
27.09.2017 15:43:07.155 *INFO* [main]
org.apache.jackrabbit.oak.segment.SegmentNodeStore$SegmentNodeStoreBuilder
Creating segment node store SegmentNodeStoreBuilder{blobStore=inline}
27.09.2017 15:43:07.161 *INFO* [main]
org.apache.jackrabbit.oak.segment.scheduler.LockBasedScheduler
Initializing SegmentNodeStore with the commitFairLock option enabled.
27.09.2017 15:43:07.170 *INFO* [main]
org.apache.jackrabbit.oak-segment-tar Service [31,
[org.apache.jackrabbit.oak.api.jmx.CheckpointMBean]] ServiceEvent
REGISTERED
27.09.2017 15:43:07.183 *INFO* [main]
org.apache.jackrabbit.oak.spi.cluster.ClusterRepositoryInfo
getOrCreateId: created a new
clusterId=c696b381-f3e7-4826-ac5e-552f3ac4fecc
27.09.2017 15:43:07.184 *INFO* [main]
org.apache.jackrabbit.oak-segment-tar Service [32,
[org.apache.jackrabbit.oak.api.Descriptors]] ServiceEvent REGISTERED


Debugging oak-pojosr test failures

2017-09-27 Thread Robert Munteanu
Hi,

I am trying out some changes to the OSGi annotations based on Julian's
work and I'm getting test failures in oak-pojosr, for instance

[INFO] Running org.apache.jackrabbit.oak.run.osgi.RepositoryClosedTest
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed:
61.084 s <<< FAILURE! - in
org.apache.jackrabbit.oak.run.osgi.RepositoryClosedTest
[ERROR]
sessionUsePostClose(org.apache.jackrabbit.oak.run.osgi.RepositoryClosed
Test)  Time elapsed: 60.638 s  <<< ERROR!
javax.jcr.RepositoryException: Repository could not be started in 60
seconds
at
org.apache.jackrabbit.oak.run.osgi.RepositoryClosedTest.sessionUsePostC
lose(RepositoryClosedTest.groovy:47)
Caused by: java.util.concurrent.TimeoutException: Timeout waiting for
task.
at
org.apache.jackrabbit.oak.run.osgi.RepositoryClosedTest.sessionUsePostC
lose(RepositoryClosedTest.groovy:47)

Unfortunately I get no useful output in the target/unit-tests.log file,
only some warnings from fileinstall:

3659:27.09.2017 12:33:58.435 *WARN* [main] org.apache.felix.fileinstall
/home/robert/Documents/sources/apache/jackrabbit-oak/oak-
pojosr/target/junit7412715572491972111/config does not exist, please
create it.
3660:27.09.2017 12:33:58.435 *WARN* [main] org.apache.felix.fileinstall
Root path does not exist:
/home/robert/Documents/sources/apache/jackrabbit-oak/oak-
pojosr/target/junit7412715572491972111/config

How can I get more debug information about what is going on with the
oak-pojosr setup?

Thanks,

Robert


Re: Oak Session save behavior

2017-09-27 Thread Michael Dürig


Hi,

As Chetan mentioned JCR sessions are synchronous. However IIUC, you are 
wrapping operations on sessions into futures in your code. So I would 
guess you would have to use the future API to determine the state of the 
wrapped operation (e.g. via a completion handler).


Michael

On 26.09.17 20:24, yogesh upadhyay wrote:

Hello,

We are working on a small CMS using Oak-Core (Version 1.6.0) with Play
framework and RDBMS as datastore.

"mysqlConnectorJava": "mysql:mysql-connector-java:5.1.38",

"oak-jcr": "org.apache.jackrabbit:oak-jcr:1.6.0",



We use the following code for session handle,

public  CompletableFuture withSession(final FunctionWithCE operation) {

   final CompletableFuture completableFuture = new CompletableFuture<>();
   CompletableFuture.runAsync(() -> {
 Session session = null;
 try {
   session = _repository.login(_credentials);
   completableFuture.complete(operation. apply(session));
 } catch (Exception e) {
   logger.error("Something went wrong while using session {}", e);
   completableFuture.completeExceptionally(e);
 } finally {
   if (session != null) {
 session.logout();
   }
 }
   }, (Runnable command) -> {
 ExecutionContexts.repositoryOperation().execute(command);
   });

   return completableFuture;
}



  And this is how repository component is set up

@Inject

public RepositoryComponentImpl(final ApplicationLifecycle applicationLifecycle, 
Database database,
 Configuration configuration) {
   final String jcrUsername = configuration.getString("jcrUsername");
   final String jcrPassword = configuration.getString("jcrPassword");
   if (jcrPassword != null || jcrUsername != null) {
 _credentials = new SimpleCredentials(jcrUsername, 
jcrPassword.toCharArray());
 final DocumentMK.Builder documentMkBuilder = new DocumentMK.Builder();
 documentMkBuilder.setAsyncDelay(3000);
 documentMkBuilder.setPrefetchExternalChanges(true);
 final DocumentNodeStore documentNodeStore =
 
documentMkBuilder.setRDBConnection(database.getDataSource()).getNodeStore();
 _repository = new Jcr(new Oak(documentNodeStore)).createRepository();
 final CompletableFuture setupCompletable = withSession((Session 
session) -> setupRepository(session));
 setupCompletable.exceptionally(e -> {
   /*
* If there is an exception, log the message and rethrow, otherwise it 
would be
* lost in the other thread and not surfaced
*/
   logger.error(e.getMessage(), e);
   throw new CompletionException(e);
 });
 applicationLifecycle.addStopHook(() -> {
   documentNodeStore.dispose();
   return F.Promise.pure(null);
 });
   } else {
 throw new IllegalStateException("Unable to get repository credentials.");
   }
}



And this is how session is being used in save operation,

public CompletableFuture deleteBlob(String blobId) {
   return _repositoryComponent.withSession((Session session) -> {
   session.getNode("/asset/").getNode(blobId).remove();
   session.save();
   return (null);
   });

}


For read operations, we use new session again.

Now the problem we are running into is, after save operation is performed,
there is no good way for us to know if save was done (Since save in oak is
async). So after save we refresh the page, the user sees old content.

We can provide some kind of delay on redirect to remedy this issue but it
won't be good user experience.

We are wondering, if there Is any good way to find if after
"session.save()" is called, data is saved in RDBMS and now all new session
will get updated data? Or we are doing anything wrong here.


Yogesh