[ 
https://issues.apache.org/jira/browse/CAMEL-8940?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14616819#comment-14616819
 ] 

Sarat Khilar commented on CAMEL-8940:
-------------------------------------

The issue found in 2.15.0. The same issue has been fixed in  2.15.1 I beleive . 
I have upgraded to 2.15.2 and the issue is not found. Please close this issue.

Root Cause in 2.15.0 : BeanInfo.java introspect(Class<?> clazz) method
=======================================================
     for (Method source : methods) {
                for (Method target : methods) {
                    // skip ourselves
                    if (ObjectHelper.isOverridingMethod(source, target, true)) {
                        continue;
                    }
                    // skip duplicates which may be assign compatible (favor 
keep first added method when duplicate)
                    if (ObjectHelper.isOverridingMethod(source, target, false)) 
{
                        overrides.add(target);
                    }
                }
            }
            methods.removeAll(overrides);
            overrides.clear();
        }


Fix in 2.15.1
============
 for (Method source : methods) {

                // skip bridge methods in duplicate checks (as the bridge 
method is inserted by the compiler due to type erasure)
                if (source.isBridge()) {                               <==== 
fix this problem
                    continue;
                }

                for (Method target : methods) {
                    // skip ourselves
                    if (ObjectHelper.isOverridingMethod(source, target, true)) {
                        continue;
                    }
                    // skip duplicates which may be assign compatible (favor 
keep first added method when duplicate)
                    if (ObjectHelper.isOverridingMethod(source, target, false)) 
{
                        overrides.add(target);
                    }
                }
            }
            methods.removeAll(overrides);
            overrides.clear();
        }


> Message routing to a method in the bean is not working if generics is used.
> ---------------------------------------------------------------------------
>
>                 Key: CAMEL-8940
>                 URL: https://issues.apache.org/jira/browse/CAMEL-8940
>             Project: Camel
>          Issue Type: Bug
>          Components: bean-integration
>    Affects Versions: 2.15.2
>            Reporter: Sarat Khilar
>
> Message routing is not working if generic method inteface is used.
> I have added the code snippet here.
> Bean component:
> public interface IHandler<T>
> {
>       @Handler
>     public void handle(T data);
> }
> public class EmployeePersistHandler implements IHandler<Employee>
> {
>       public EmployeePersistHandler()
>       {
>           super();
>       }
>       @Override
>       public void handle(Employee data) 
>                 {
>               
>       }
> }
> Routing config:
> public RouteBuilder route() 
>       {
>               return new RouteBuilder() {
>                       
>                       @Override
>                       public void configure() throws Exception 
>                       {
>                               System.out.println("Route builder is called");
>                               ThreadPoolBuilder poolBuilder = new 
> ThreadPoolBuilder(createCamelContext());
>                               ExecutorService customPool = 
> poolBuilder.poolSize(5).maxPoolSize(100).maxQueueSize(-1).build("customPool");
>                               
> from("seda:test").shutdownRunningTask(ShutdownRunningTask.CompleteAllTasks).threads().executorService(customPool).bean(employeePersistHandler);
>                               
>                       }
>               };
>       
>       }



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to