Skip to content

Commit bf81047

Browse files
committed
add warn log
1 parent f04cf0b commit bf81047

File tree

1 file changed

+13
-0
lines changed
  • cloudplatform/connectivity-destination-service/src/main/java/com/sap/cloud/sdk/cloudplatform/connectivity

1 file changed

+13
-0
lines changed

cloudplatform/connectivity-destination-service/src/main/java/com/sap/cloud/sdk/cloudplatform/connectivity/DestinationService.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import java.time.Duration;
44
import java.util.ArrayList;
5+
import java.util.Arrays;
56
import java.util.Collection;
67
import java.util.LinkedHashMap;
78
import java.util.List;
@@ -878,11 +879,23 @@ private static Try<List<DestinationProperties>> getOrComputeAllDestinations(
878879
return destinationDownloader.apply(options);
879880
}
880881

882+
if( isUsingExperimentalFeatures(options) ) {
883+
log
884+
.warn(
885+
"Using cache/change detection together with either fragments, cross-level options, or custom headers is discouraged and might lead to unexpected behaviour.");
886+
}
887+
881888
return GetOrComputeAllDestinationsCommand
882889
.prepareCommand(options, instanceAll(), isolationLocks(), destinationDownloader)
883890
.execute();
884891
}
885892

893+
private static boolean isUsingExperimentalFeatures( @Nonnull final DestinationOptions options )
894+
{
895+
String[] featureNames = { "X-fragment-name", "crossLevelSetting", "customHeader" };
896+
return options.getOptionKeys().stream().anyMatch(s -> Arrays.stream(featureNames).anyMatch(s::contains));
897+
}
898+
886899
private Cache()
887900
{
888901
throw new IllegalStateException("This static class must never be instantiated.");

0 commit comments

Comments
 (0)