2020import com .optimizely .ab .bucketing .DecisionService ;
2121import com .optimizely .ab .bucketing .FeatureDecision ;
2222import com .optimizely .ab .bucketing .UserProfileService ;
23+ import com .optimizely .ab .cmab .service .CmabService ;
2324import com .optimizely .ab .config .AtomicProjectConfigManager ;
2425import com .optimizely .ab .config .DatafileProjectConfig ;
2526import com .optimizely .ab .config .EventType ;
@@ -141,8 +142,12 @@ public class Optimizely implements AutoCloseable {
141142 @ Nullable
142143 private final ODPManager odpManager ;
143144
145+ @ Nullable
146+ private final CmabService cmabService ;
147+
144148 private final ReentrantLock lock = new ReentrantLock ();
145149
150+
146151 private Optimizely (@ Nonnull EventHandler eventHandler ,
147152 @ Nonnull EventProcessor eventProcessor ,
148153 @ Nonnull ErrorHandler errorHandler ,
@@ -152,8 +157,9 @@ private Optimizely(@Nonnull EventHandler eventHandler,
152157 @ Nullable OptimizelyConfigManager optimizelyConfigManager ,
153158 @ Nonnull NotificationCenter notificationCenter ,
154159 @ Nonnull List <OptimizelyDecideOption > defaultDecideOptions ,
155- @ Nullable ODPManager odpManager
156- ) {
160+ @ Nullable ODPManager odpManager ,
161+ @ Nullable CmabService cmabService
162+ ) {
157163 this .eventHandler = eventHandler ;
158164 this .eventProcessor = eventProcessor ;
159165 this .errorHandler = errorHandler ;
@@ -164,6 +170,7 @@ private Optimizely(@Nonnull EventHandler eventHandler,
164170 this .notificationCenter = notificationCenter ;
165171 this .defaultDecideOptions = defaultDecideOptions ;
166172 this .odpManager = odpManager ;
173+ this .cmabService = cmabService ;
167174
168175 if (odpManager != null ) {
169176 odpManager .getEventManager ().start ();
@@ -1731,6 +1738,7 @@ public static class Builder {
17311738 private NotificationCenter notificationCenter ;
17321739 private List <OptimizelyDecideOption > defaultDecideOptions ;
17331740 private ODPManager odpManager ;
1741+ private CmabService cmabService ;
17341742
17351743 // For backwards compatibility
17361744 private AtomicProjectConfigManager fallbackConfigManager = new AtomicProjectConfigManager ();
@@ -1842,6 +1850,11 @@ public Builder withODPManager(ODPManager odpManager) {
18421850 return this ;
18431851 }
18441852
1853+ public Builder withCmabService (CmabService cmabService ) {
1854+ this .cmabService = cmabService ;
1855+ return this ;
1856+ }
1857+
18451858 // Helper functions for making testing easier
18461859 protected Builder withBucketing (Bucketer bucketer ) {
18471860 this .bucketer = bucketer ;
@@ -1916,7 +1929,7 @@ public Optimizely build() {
19161929 defaultDecideOptions = Collections .emptyList ();
19171930 }
19181931
1919- return new Optimizely (eventHandler , eventProcessor , errorHandler , decisionService , userProfileService , projectConfigManager , optimizelyConfigManager , notificationCenter , defaultDecideOptions , odpManager );
1932+ return new Optimizely (eventHandler , eventProcessor , errorHandler , decisionService , userProfileService , projectConfigManager , optimizelyConfigManager , notificationCenter , defaultDecideOptions , odpManager , cmabService );
19201933 }
19211934 }
19221935}
0 commit comments