@@ -66,19 +66,28 @@ public class SwiftSession extends HttpSession<Client> {
6666 = new SwiftRegionService (this );
6767
6868 private final Map <Region , AccountInfo > accounts = new ConcurrentHashMap <>();
69+ private final Map <Path , Set <Distribution >> distributions = new ConcurrentHashMap <>();
6970
7071 private final DelegatingSchedulerFeature scheduler = new DelegatingSchedulerFeature (
71- new SwiftAccountLoader (this ) {
72+ new HostPreferences ( host ). getBoolean ( "openstack.account.preload" ) ? new SwiftAccountLoader (this ) {
7273 @ Override
7374 protected Map <Region , AccountInfo > operate (final PasswordCallback callback ) throws BackgroundException {
7475 final Map <Region , AccountInfo > result = super .operate (callback );
7576 // Only executed single time
7677 accounts .putAll (result );
7778 return result ;
7879 }
79- }, new SwiftDistributionConfigurationLoader (this )
80+ } : Scheduler .noop ,
81+ new HostPreferences (host ).getBoolean ("openstack.cdn.preload" ) ? new SwiftDistributionConfigurationLoader (this ) {
82+ @ Override
83+ protected Map <Path , Set <Distribution >> operate (final PasswordCallback callback ) throws BackgroundException {
84+ final Map <Path , Set <Distribution >> result = super .operate (callback );
85+ // Only executed single time
86+ distributions .putAll (result );
87+ return result ;
88+ }
89+ } : Scheduler .noop
8090 );
81- private final Map <Path , Set <Distribution >> distributions = new ConcurrentHashMap <>();
8291
8392 public SwiftSession (final Host host , final X509TrustManager trust , final X509KeyManager key ) {
8493 super (host , trust , key );
@@ -210,10 +219,7 @@ public Distribution read(final Path container, final Distribution.Method method,
210219 return (T ) new SwiftAttributesFinderFeature (this , regionService );
211220 }
212221 if (type == Scheduler .class ) {
213- if (new HostPreferences (host ).getBoolean ("openstack.accounts.preload" )) {
214- return (T ) scheduler ;
215- }
216- return null ;
222+ return (T ) scheduler ;
217223 }
218224 return super ._getFeature (type );
219225 }
0 commit comments