File tree Expand file tree Collapse file tree 3 files changed +30
-0
lines changed
main/java/org/apache/jackrabbit/oak/plugins/document
test/java/org/apache/jackrabbit/oak/plugins/document Expand file tree Collapse file tree 3 files changed +30
-0
lines changed Original file line number Diff line number Diff line change 395395 description = "Integer value indicating the number of documents to check for garbage in each Full GC cycle." +
396396 "The default value is " + DocumentNodeStoreService .DEFAULT_FGC_PROGRESS_SIZE )
397397 int fullGCProgressSize () default DocumentNodeStoreService .DEFAULT_FGC_PROGRESS_SIZE ;
398+
399+ @ AttributeDefinition (
400+ name = "Invisible for discovery" ,
401+ description = "Boolean value indicating that the instance should not be discoverable for the cluster. The default value is " + DocumentNodeStoreService .DEFAULT_INVISIBLE_FOR_DISCOVERY )
402+ boolean invisibleForDiscovery () default DocumentNodeStoreService .DEFAULT_INVISIBLE_FOR_DISCOVERY ;
398403}
Original file line number Diff line number Diff line change 130130 configurationPid = {Configuration .PID })
131131public class DocumentNodeStoreService {
132132
133+ public static final boolean DEFAULT_INVISIBLE_FOR_DISCOVERY = false ;
133134 private static final long MB = 1024 * 1024 ;
134135 static final String DEFAULT_URI = "mongodb://localhost:27017/oak" ;
135136 static final int DEFAULT_CACHE = (int ) (DEFAULT_MEMORY_CACHE_SIZE / MB );
@@ -510,6 +511,7 @@ private void configureBuilder(DocumentNodeStoreBuilder<?> builder) {
510511 config .childrenCachePercentage (),
511512 config .diffCachePercentage (),
512513 config .prevNoPropCachePercentage ()).
514+ setClusterInvisible (config .invisibleForDiscovery ()).
513515 setCacheSegmentCount (config .cacheSegmentCount ()).
514516 setCacheStackMoveDistance (config .cacheStackMoveDistance ()).
515517 setBundlingDisabled (config .bundlingDisabled ()).
Original file line number Diff line number Diff line change @@ -256,6 +256,29 @@ public void strictLeaseCheckMode() {
256256 assertEquals (LeaseCheckMode .STRICT , dns .getClusterInfo ().getLeaseCheckMode ());
257257 }
258258
259+ @ Test
260+ public void invisibleForDiscoveryTrueFalse () {
261+ Map <String , Object > config = newConfig (repoHome );
262+ MockOsgi .setConfigForPid (context .bundleContext (), PID , config );
263+ MockOsgi .activate (service , context .bundleContext ());
264+
265+ DocumentNodeStore dns = context .getService (DocumentNodeStore .class );
266+ // false is the default
267+ assertFalse (dns .getClusterInfo ().isInvisible ());
268+ }
269+
270+ @ Test
271+ public void invisibleForDiscoveryTrue () {
272+ Map <String , Object > config = newConfig (repoHome );
273+ config .put ("invisibleForDiscovery" , true );
274+ MockOsgi .setConfigForPid (context .bundleContext (), PID , config );
275+ MockOsgi .activate (service , context .bundleContext ());
276+
277+ DocumentNodeStore dns = context .getService (DocumentNodeStore .class );
278+ assertTrue (dns .getClusterInfo ().isInvisible ());
279+ }
280+
281+
259282 @ Test
260283 public void lenientLeaseCheckMode () {
261284 Map <String , Object > config = newConfig (repoHome );
You can’t perform that action at this time.
0 commit comments