Commit 27455603 by 房斌

更改时间

parent b0762033
......@@ -13,6 +13,8 @@ import org.apache.dubbo.rpc.Protocol;
import org.apache.dubbo.rpc.model.ApplicationModel;
import org.springframework.beans.factory.annotation.Autowired;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
......@@ -32,8 +34,10 @@ public class DubboCustomerDownHock extends AbstractStop {
try {
//step1 register销毁
LoggerUtil.info(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS").format(new Date())+" step one:dubbo-------------unregister time:"+ StringUtil.line());
AbstractRegistryFactory.destroyAll();
LoggerUtil.info(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS").format(new Date())+" step two:dubbo-------------unregister end time:"+ StringUtil.line());
AbstractRegistryFactory.destroyAll();
//TODO step2 写在阿波罗里,具体数据 以后根据客户端上报的数据配置,目前无详细依据。等待
Thread.sleep(10000);
......@@ -56,7 +60,10 @@ public class DubboCustomerDownHock extends AbstractStop {
if(StringUtil.isNotEmpty(obj.getAddress())&&StringUtil.isNotEmpty(name)){
List<String> check = providerService.findServicesByAddressAndName(obj.getAddress(),name);
if (check != null && check.size() > 0) {
builderStr.append("warn:matrix-monitor off DubboService check service failure" + obj.getUrl() + " already on line after off " + StringUtil.line());
LoggerUtil.info(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS").format(new Date()) +"step three:dubbo check------------- time:"+ obj.getUrl() + " already on line after off " + StringUtil.line());
}
}
}
......
......@@ -7,9 +7,12 @@ import com.secoo.mall.dubbo.monitor.dubbo.model.domain.Provider;
import com.secoo.mall.dubbo.monitor.dubbo.service.ProviderService;
import com.secoo.mall.dubbo.service.ServletConnectShoutDownHock;
import org.apache.catalina.connector.Connector;
import org.apache.dubbo.common.extension.ExtensionLoader;
import org.apache.dubbo.common.utils.NetUtils;
import org.apache.dubbo.config.DubboShutdownHook;
import org.apache.dubbo.config.spring.extension.SpringExtensionFactory;
import org.apache.dubbo.registry.support.AbstractRegistryFactory;
import org.apache.dubbo.rpc.Protocol;
import org.apache.dubbo.rpc.model.ApplicationModel;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -48,10 +51,29 @@ public class GracefullyShoutDown implements CommandLineRunner, ApplicationListen
// ApplicationEventMulticaster multicaster = context.getBean(APPLICATION_EVENT_MULTICASTER_BEAN_NAME, ApplicationEventMulticaster.class);
// multicaster.removeApplicationListener(SpringExtensionFactory.SHUTDOWN_HOOK_LISTENER);
}
// LoggerUtil.info("执行销毁测试------------>begin");
// AbstractRegistryFactory.destroyAll();
// destoryProtocol();
// Thread.sleep(10000);
// LoggerUtil.info("执行销毁测试------------>end");
}
//容器关闭后执行
public void destoryProtocol() {
ExtensionLoader<Protocol> loader = ExtensionLoader.getExtensionLoader(Protocol.class);
for (String protocolName : loader.getLoadedExtensions()) {
try {
Protocol protocol = loader.getLoadedExtension(protocolName);
if (protocol != null) {
protocol.destroy();
}
} catch (Throwable t) {
LoggerUtil.info(t.getMessage());
}
}
}
@Override
public void onApplicationEvent(ContextClosedEvent contextClosedEvent) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment