[
https://issues.apache.org/jira/browse/CAMEL-5999?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13562343#comment-13562343
]
Amit Patel commented on CAMEL-5999:
-----------------------------------
After I made the following changes to RestletComonent, RestletRestartRouteTest
does not pass.
I updated RestletComonent disconnect method as below. Look like server.stop()
method is not working properly. I need your help to resolve this issue.
public void disconnect(RestletConsumer consumer) throws Exception {
RestletEndpoint endpoint = consumer.getEndpoint();
List<MethodBasedRouter> methodBasedRouters = new
ArrayList<MethodBasedRouter>();
String pattern = decodePattern(endpoint.getUriPattern());
if (pattern != null && !pattern.isEmpty()) {
methodBasedRouters.add(getMethodRouter(pattern));
}
if (endpoint.getRestletUriPatterns() != null) {
for (String uriPattern : endpoint.getRestletUriPatterns()) {
methodBasedRouters.add(getMethodRouter(uriPattern));
}
}
for (MethodBasedRouter methodBasedRouter : methodBasedRouters) {
if (endpoint.getRestletMethods() != null) {
Method[] methods = endpoint.getRestletMethods();
for (Method method : methods) {
methodBasedRouter.removeRoute(method);
}
} else {
methodBasedRouter.removeRoute(endpoint.getRestletMethod());
}
//remove route form routers Map
routers.remove(methodBasedRouter.getUriPattern());
String key = buildKey(endpoint);
Server server = servers.get(key);
component.getServers().remove(server);
server.stop();
servers.remove(key);
if (methodBasedRouter.hasBeenAttached()) {
component.getDefaultHost().detach(consumer.getRestlet());
}
System.out.println("After remove"+ routers.toString());
if (LOG.isDebugEnabled()) {
LOG.debug("Detached restlet uriPattern: {} method: {}",
methodBasedRouter.getUriPattern(),
endpoint.getRestletMethod());
}
}
}
> RestletComponent component is not removing added route from routers list
> although route is removed from Context.
> ----------------------------------------------------------------------------------------------------------------
>
> Key: CAMEL-5999
> URL: https://issues.apache.org/jira/browse/CAMEL-5999
> Project: Camel
> Issue Type: Bug
> Components: camel-restlet
> Affects Versions: 2.10.3
> Reporter: Amit Patel
> Fix For: 2.10.4, 2.11.0
>
>
> In RestletComponent class add entry to instance variable "private final
> Map<String, MethodBasedRouter> routers = new HashMap<String,
> MethodBasedRouter>()" map while invoking getMethodRouter method, but it never
> remove in disconnect method, also disconnect method has local variable with
> same name as instance variable "routes".
> Camel Development Forums
> =========================
> http://camel.465427.n5.nabble.com/Camel-Restlet-2-10-3-RestletComponent-component-does-not-remove-added-route-form-routers-although-ro-td5726000.html
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira