use of com.alipay.sofa.ark.common.util.OrderComparator in project sofa-ark by alipay.
the class BizManagerServiceImpl method getBizInOrder.
@Override
public List<Biz> getBizInOrder() {
List<Biz> bizList = new ArrayList<>();
for (String bizName : bizRegistration.keySet()) {
bizList.addAll(bizRegistration.get(bizName).values());
}
Collections.sort(bizList, new OrderComparator());
return bizList;
}
use of com.alipay.sofa.ark.common.util.OrderComparator in project sofa-ark by alipay.
the class EventAdminServiceImpl method sendEvent.
@Override
public void sendEvent(ArkEvent event) {
List<EventHandler> eventHandlers = new ArrayList<>();
for (CopyOnWriteArraySet<EventHandler> values : SUBSCRIBER_MAP.values()) {
eventHandlers.addAll(values);
}
for (ServiceReference<EventHandler> eventHandler : registryService.referenceServices(EventHandler.class, null)) {
eventHandlers.add(eventHandler.getService());
}
Collections.sort(eventHandlers, new OrderComparator());
for (EventHandler eventHandler : eventHandlers) {
if (isSupportEventType(eventHandler, event)) {
eventHandler.handleEvent(event);
}
}
}
use of com.alipay.sofa.ark.common.util.OrderComparator in project sofa-ark by alipay.
the class ArkServiceContainer method start.
/**
* Start Ark Service Container
* @throws ArkRuntimeException
* @since 0.1.0
*/
public void start() throws ArkRuntimeException {
if (started.compareAndSet(false, true)) {
ClassLoader oldClassLoader = ClassLoaderUtils.pushContextClassLoader(getClass().getClassLoader());
try {
LOGGER.info("Begin to start ArkServiceContainer");
injector = Guice.createInjector(findServiceModules());
for (Binding<ArkService> binding : injector.findBindingsByType(new TypeLiteral<ArkService>() {
})) {
arkServiceList.add(binding.getProvider().get());
}
Collections.sort(arkServiceList, new OrderComparator());
for (ArkService arkService : arkServiceList) {
LOGGER.info(String.format("Init Service: %s", arkService.getClass().getName()));
arkService.init();
}
ArkServiceContainerHolder.setContainer(this);
ArkClient.setBizFactoryService(getService(BizFactoryService.class));
ArkClient.setBizManagerService(getService(BizManagerService.class));
ArkClient.setInjectionService(getService(InjectionService.class));
ArkClient.setEventAdminService(getService(EventAdminService.class));
ArkClient.setArguments(arguments);
LOGGER.info("Finish to start ArkServiceContainer");
} finally {
ClassLoaderUtils.popContextClassLoader(oldClassLoader);
}
}
}
use of com.alipay.sofa.ark.common.util.OrderComparator in project sofa-ark by alipay.
the class PluginManagerServiceImpl method getPluginsInOrder.
@Override
public List<Plugin> getPluginsInOrder() {
List<Plugin> pluginList = new ArrayList<>(plugins.values());
Collections.sort(pluginList, new OrderComparator());
return pluginList;
}
Aggregations