@@ -35,7 +35,7 @@ final class V2StackSupport {
3535 private static final ConfigurationProperty <Boolean > V2_STACK_PROPERTY
3636 = ConfigurationPropertyBuilder .ofBoolean (V2_STACK_KEY )
3737 .environmentVariableName (V2_STACK_KEY )
38- .defaultValue (false )
38+ .defaultValue (true )
3939 .shared (true )
4040 .build ();
4141 private final AtomicReference <Boolean > v2StackFlag = new AtomicReference <>();
@@ -62,7 +62,7 @@ final class V2StackSupport {
6262 * @return true if the clients should use the v2 stack.
6363 */
6464 boolean isV2StackEnabled (Configuration configuration ) {
65- return isOptedIn (configuration , V2_STACK_PROPERTY , v2StackFlag );
65+ return ! isOptedOut (configuration , V2_STACK_PROPERTY , v2StackFlag );
6666 }
6767
6868 /**
@@ -113,33 +113,6 @@ private boolean isOptedOut(Configuration configuration, ConfigurationProperty<Bo
113113 return choiceFlag .get ();
114114 }
115115
116- private boolean isOptedIn (Configuration configuration , ConfigurationProperty <Boolean > configProperty ,
117- AtomicReference <Boolean > choiceFlag ) {
118- final Boolean flag = choiceFlag .get ();
119- if (flag != null ) {
120- return flag ;
121- }
122-
123- final String propName = configProperty .getName ();
124- final boolean isOptedIn ;
125- if (configuration != null ) {
126- isOptedIn = configuration .get (configProperty );
127- } else {
128- assert !CoreUtils .isNullOrEmpty (propName );
129- if (!CoreUtils .isNullOrEmpty (System .getenv (propName ))) {
130- isOptedIn = "true" .equalsIgnoreCase (System .getenv (propName ));
131- } else if (!CoreUtils .isNullOrEmpty (System .getProperty (propName ))) {
132- isOptedIn = "true" .equalsIgnoreCase (System .getProperty (propName ));
133- } else {
134- isOptedIn = false ;
135- }
136- }
137- if (choiceFlag .compareAndSet (null , isOptedIn )) {
138- logger .verbose ("Selected configuration {}={}" , propName , isOptedIn );
139- }
140- return choiceFlag .get ();
141- }
142-
143116 ReactorConnectionCache <EventHubReactorAmqpConnection > createConnectionCache (ConnectionOptions connectionOptions ,
144117 Supplier <String > eventHubNameSupplier , MessageSerializer serializer , Meter meter ,
145118 boolean useSessionChannelCache ) {
0 commit comments