提交 40198e97 编写于 作者: W william.liangf

DUBBO-294 将delay缺省设为-1

git-svn-id: http://code.alibabatech.com/svn/dubbo/trunk@1335 1a56cb94-b969-4eaa-88fa-be21384802f2
上级 69b46637
......@@ -27,6 +27,7 @@ import org.springframework.context.ApplicationContextAware;
import org.springframework.context.ApplicationEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.context.support.AbstractApplicationContext;
import com.alibaba.dubbo.config.ApplicationConfig;
import com.alibaba.dubbo.config.MonitorConfig;
......@@ -66,7 +67,18 @@ public class ServiceBean<T> extends ServiceConfig<T> implements InitializingBean
Method method = applicationContext.getClass().getMethod("addApplicationListener", new Class<?>[]{ApplicationListener.class}); // 兼容Spring2.0.1
method.invoke(applicationContext, new Object[] {this});
supportedApplicationListener = true;
} catch (Throwable t) {
} catch (Throwable t) {
if (applicationContext instanceof AbstractApplicationContext) {
try {
Method method = AbstractApplicationContext.class.getDeclaredMethod("addListener", new Class<?>[]{ApplicationListener.class}); // 兼容Spring2.0.1
if (! method.isAccessible()) {
method.setAccessible(true);
}
method.invoke(applicationContext, new Object[] {this});
supportedApplicationListener = true;
} catch (Throwable t2) {
}
}
}
}
}
......@@ -92,7 +104,7 @@ public class ServiceBean<T> extends ServiceConfig<T> implements InitializingBean
if (delay == null && provider != null) {
delay = provider.getDelay();
}
return supportedApplicationListener && delay != null && delay.intValue() == -1;
return supportedApplicationListener && (delay == null || delay.intValue() == -1);
}
@SuppressWarnings({ "unchecked" })
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册