File tree Expand file tree Collapse file tree 6 files changed +23
-4
lines changed
apollo-client/src/main/java/com/ctrip/framework/apollo
apollo-core/src/main/java/com/ctrip/framework Expand file tree Collapse file tree 6 files changed +23
-4
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ Apollo Java 2.1.0
1818* [ Add apollo-plugin-log4j2 module to support log4j2.xml integration] ( https://github.com/apolloconfig/apollo-java/pull/6 )
1919* [ Allow users to config comma-separated namespaces for ApolloConfigChangeListener] ( https://github.com/apolloconfig/apollo-java/pull/11 )
2020* [ Fix beanName2SpringValueDefinitions cache issue] ( https://github.com/apolloconfig/apollo-java/pull/16 )
21+ * [ Add Ordered interface to MessageProducerManager and Injector SPI] ( https://github.com/apolloconfig/apollo-java/pull/15 )
2122
2223------------------
2324All issues and pull requests are [ here] ( https://github.com/apolloconfig/apollo-java/milestone/1?closed=1 )
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ private static Injector getInjector() {
3333 synchronized (lock ) {
3434 if (s_injector == null ) {
3535 try {
36- s_injector = ServiceBootstrap .loadFirst (Injector .class );
36+ s_injector = ServiceBootstrap .loadPrimary (Injector .class );
3737 } catch (Throwable ex ) {
3838 ApolloConfigException exception = new ApolloConfigException ("Unable to initialize Apollo Injector!" , ex );
3939 Tracer .logError (exception );
Original file line number Diff line number Diff line change 1616 */
1717package com .ctrip .framework .apollo .internals ;
1818
19+ import com .ctrip .framework .apollo .core .spi .Ordered ;
20+
1921/**
2022 * @author Jason Song(song_s@ctrip.com)
2123 */
22- public interface Injector {
24+ public interface Injector extends Ordered {
2325
2426 /**
2527 * Returns the appropriate instance for the given injection type
@@ -30,4 +32,9 @@ public interface Injector {
3032 * Returns the appropriate instance for the given injection type and name
3133 */
3234 <T > T getInstance (Class <T > clazz , String name );
35+
36+ @ Override
37+ default int getOrder () {
38+ return 0 ;
39+ }
3340}
Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ private static MessageProducer getProducer() {
4444 if (producerManager == null ) {
4545 synchronized (lock ) {
4646 if (producerManager == null ) {
47- producerManager = ServiceBootstrap .loadFirst (MessageProducerManager .class );
47+ producerManager = ServiceBootstrap .loadPrimary (MessageProducerManager .class );
4848 }
4949 }
5050 }
Original file line number Diff line number Diff line change 1616 */
1717package com .ctrip .framework .apollo .tracer .spi ;
1818
19+ import com .ctrip .framework .apollo .core .spi .Ordered ;
20+
1921/**
2022 * @author Jason Song(song_s@ctrip.com)
2123 */
22- public interface MessageProducerManager {
24+ public interface MessageProducerManager extends Ordered {
2325 /**
2426 * @return the message producer
2527 */
2628 MessageProducer getProducer ();
29+
30+ @ Override
31+ default int getOrder () {
32+ return 0 ;
33+ }
2734}
Original file line number Diff line number Diff line change 2525import java .util .ServiceLoader ;
2626
2727public class ServiceBootstrap {
28+
29+ /**
30+ * @deprecated use {@link ServiceBootstrap#loadPrimary(Class)} instead
31+ */
2832 public static <S > S loadFirst (Class <S > clazz ) {
2933 Iterator <S > iterator = loadAll (clazz );
3034 if (!iterator .hasNext ()) {
You can’t perform that action at this time.
0 commit comments