This commit is contained in:
crusader 2018-04-25 22:48:57 +09:00
parent 5bee7bf4ea
commit 3c4df318af

View File

@ -38,19 +38,19 @@ public class GeneralContainerServer extends ContainerServer {
this.services.put(bean.getClass(), bean);
});
this.execServices(this.services, "initService", Service.OrderedServices, false);
this.execServices(this.services, com.loafle.overflow.core.interfaces.Service.ServiceMethodType.INIT, Service.OrderedServices, false);
}
@Override
protected void onStart() throws Exception {
super.onStart();
this.execServices(this.services, "startService", Service.OrderedServices, false);
this.execServices(this.services, com.loafle.overflow.core.interfaces.Service.ServiceMethodType.START, Service.OrderedServices, false);
}
@Override
protected void onStop() throws Exception {
this.execServices(this.services, "stopService", Service.OrderedServices, true);
this.execServices(this.services, com.loafle.overflow.core.interfaces.Service.ServiceMethodType.STOP, Service.OrderedServices, true);
super.onStop();
@ -58,13 +58,13 @@ public class GeneralContainerServer extends ContainerServer {
@Override
protected void destroy() throws Exception {
this.execServices(this.services, "destroyService", Service.OrderedServices, true);
this.execServices(this.services, com.loafle.overflow.core.interfaces.Service.ServiceMethodType.DESTROY, Service.OrderedServices, true);
super.destroy();
}
private void execServices(Map<Class<?>, Object> services, String methodName, Class<?>[] orderedTypes, boolean reverse) throws Exception {
private void execServices(Map<Class<?>, Object> services, com.loafle.overflow.core.interfaces.Service.ServiceMethodType methodType, Class<?>[] orderedTypes, boolean reverse) throws Exception {
if (null == services || 0 == services.size()) {
return;
}
@ -101,7 +101,7 @@ public class GeneralContainerServer extends ContainerServer {
for (int i = 0; i < orderedServices.size(); i++) {
Object service = orderedServices.get(i);
Class<?> clazz = service.getClass();
Method method = clazz.getMethod(methodName, parameterTypes);
Method method = clazz.getMethod(methodType.toString(), parameterTypes);
if (null == method) {
continue;
}