On 10/6/10 8:55 PM, Jan Ohlsen wrote:
In the constructor

     public SimpleIoProcessorPool(Class<? extends IoProcessor<T>>
processorType, Executor executor, int size)

1) There's the following code:

             // We create at least one processor
             try {
                 try {
                     processorConstructor =
processorType.getConstructor(ExecutorService.class);
                     pool[0] =
processorConstructor.newInstance(this.executor);
                 } catch (NoSuchMethodException e) {
                     // To the next step...
                 }

                 try {
                     processorConstructor =
processorType.getConstructor(Executor.class);
                     pool[0] =
processorConstructor.newInstance(this.executor);
                 } catch (NoSuchMethodException e) {
                     // To the next step...
                 }

                 try {
                     processorConstructor = processorType.getConstructor();
                     usesExecutorArg = false;
                     pool[0] = processorConstructor.newInstance();
                 } catch (NoSuchMethodException e) {
                     // To the next step...
                 }

     Should only attempt the second&  third processorConstructor assignments
if the first one fails etc.?

This piece of code sounds a bit weird to say the least...

We should probably incorporate the code in the following attempts into the catch() part, like :

  try {
    try {
      processorConstructor = 
processorType.getConstructor(ExecutorService.class);
      pool[0] = processorConstructor.newInstance(this.executor);
    } catch (NoSuchMethodException e) {
      // To the next step...
      try {
        processorConstructor = processorType.getConstructor(Executor.class);
        pool[0] = processorConstructor.newInstance(this.executor);
      } catch (NoSuchMethodException e) {
        // To the next step...
        try {
          processorConstructor = processorType.getConstructor();
          usesExecutorArg = false;
          pool[0] = processorConstructor.newInstance();
        } catch (NoSuchMethodException e) {
          // To the next step...
        }
      }
    }
  }


2) The JavaDoc is missing the size parameter

Fixed

Thanks for the report !

PS : It's better to fill a JIRA when you discover such errors, as we probably 
will process it asynchronously. Mail are likely to get buried forever :)

PS2 : It seems that the modified code pass the tests successfully. great !

--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com

Reply via email to