Jackrabbit oak : Not able to set VersionGCOptions

77 Views Asked by At

I am using JackRabbit Oak(1.22.3) implementation for deleting nodes using Version garbage collection. I am setting below custom values for garbage collection.

VersionGCOptions versionGCOptions = new VersionGCOptions();
versionGCOptions.withOverflowToDiskThreshold(900000);
versionGCOptions.withCollectLimit(900000L);
versionGCOptions.withMaxIterations(10);
documentNodeStore.getVersionGarbageCollector().setOptions(versionGCOptions);

But when I am trying to get above values, I am getting default values not custom values:

System.out.println("collectLimit : "+versionGarbageCollector.getOptions().collectLimit);
System.out.println("maxIterations : "+versionGarbageCollector.getOptions().maxIterations);

**output:-**
collectLimit : 100000
maxIterations : 0

I am not getting why this is happening, please help me here to resolve this.

1

There are 1 best solutions below

6
On

The "with...()" methods return a new VersionGCOptions object (they do not modify the existing one).

Thus you need to do something like:

versionGCOptions = versionGCOptions.withOverflowToDiskThreshold(900000);