【发布时间】:2013-08-10 12:58:37
【问题描述】:
当我从正在运行的组件的主机列表中删除之前添加的 VirtualHost 时,虚拟主机仍会继续使用。
Component component = new Component();
component.getServers().add(Protocol.HTTP, 8080);
component.getDefaultHost().attachDefault(DefaultResource.class);
VirtualHost host = new VirtualHost(new Context());
host.setHostDomain("myhost\\.org");
host.attachDefault(MyHostResource.class);
component.getHosts().add(host);
component.start();
Thread.currentThread().sleep(5000);
System.out.println("Stopping myhost");
component.getHosts().remove(host);
5 秒后,对http://myhost.org 的 GET 查询应该给出 DefaultResource 的输出,但它会一直给出 MyHostResource 的输出,但仅在前 5 秒内提交 GET 之后。好像有一些路由信息保存在缓存中。
我目前正在构建一个动态插入/删除 VirtualHosts 的 OSGi 应用程序。但是,如果虚拟主机没有正确断开连接,我会得到 ServiceUnavailableExeptions。
我应该如何移除虚拟主机并正确更新路由缓存?
谢谢!
【问题讨论】:
标签: restlet