You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Nathan Quirynen <na...@pensionarchitects.be> on 2015/11/19 16:07:55 UTC

Exceptions with ParallelExecutor

Hi,

When using the ParallelExecutor exceptions thrown seem to be ignored in 
some way? The invokable just stops when there's an error somewhere, but 
no exception is being logged, making it hard to find the problem.
How can I get exceptions happening in the invokable getting logged?

Simple example page:


public class TestPage {

         @Inject
         private ParallelExecutor parallelExecutor;

         void setupRender() {
             parallelExecutor.invoke(new Invokable<String>() {
                 @Override
                 public String invoke() {
                     throw new RuntimeException("TEST EXCEPTION");
                 }
             });
         }

}



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Exceptions with ParallelExecutor

Posted by Ilya Obshadko <il...@gmail.com>.
Yes, that's basically it. Background thread exceptions are not being caught by Tapestry application, so you need to take care of the logging yourself.




(Also, do not forget to do thread cleanup).



—
Sent from Mailbox

On Fri, Nov 20, 2015 at 12:30 PM, Nathan Quirynen
<na...@pensionarchitects.be> wrote:

> Or do you mean I should just surround everything with a try catch to 
> catch any exception and then use the logger to log it?
> On 20/11/15 11:22, Nathan Quirynen wrote:
>> Hey Ilya,
>>
>> Hmm I'm not sure what you mean. It does log everything, but no 
>> exceptions:
>>
>> public class TestPage {
>>
>>     @Inject
>>     private ParallelExecutor parallelExecutor;
>>
>>     void setupRender() {
>>         parallelExecutor.invoke(new SomeBackgroundTask());
>>     }
>>
>>     public class SomeBackgroundTask implements Invokable<String> {
>>
>>         private final Logger log = 
>> LoggerFactory.getLogger(SomeBackgroundTask.class);
>>
>>         @Override
>>         public String invoke() {
>>             System.out.println("SYSOUT TEST");  // --> is outputted to 
>> console
>>             log.debug("LOG TEST"); // --> is outputted to console
>>             throw new RuntimeException("EXCEPTION TEST"); // --> is 
>> NOT outputted to console
>>         }
>>
>>     }
>>
>> }
>>
>> What am I supposed to do exactly?
>>
>> Thanks,
>> Nathan
>>
>> On 20/11/15 09:53, Ilya Obshadko wrote:
>>> You may pass injected Logger instance to parallel execution, just 
>>> like you
>>> do normally.
>>>
>>> On Thu, Nov 19, 2015 at 5:07 PM, Nathan Quirynen <
>>> nathan@pensionarchitects.be> wrote:
>>>
>>>> Hi,
>>>>
>>>> When using the ParallelExecutor exceptions thrown seem to be ignored in
>>>> some way? The invokable just stops when there's an error somewhere, 
>>>> but no
>>>> exception is being logged, making it hard to find the problem.
>>>> How can I get exceptions happening in the invokable getting logged?
>>>>
>>>> Simple example page:
>>>>
>>>>
>>>> public class TestPage {
>>>>
>>>>          @Inject
>>>>          private ParallelExecutor parallelExecutor;
>>>>
>>>>          void setupRender() {
>>>>              parallelExecutor.invoke(new Invokable<String>() {
>>>>                  @Override
>>>>                  public String invoke() {
>>>>                      throw new RuntimeException("TEST EXCEPTION");
>>>>                  }
>>>>              });
>>>>          }
>>>>
>>>> }
>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>>
>>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
> -- 
> Een klare kijk op aanvullende pensioenen
> *Nathan Quirynen*
> 03 340 04 60
> nathan@pensionarchitects.be <ma...@pensionarchitects.be>

Re: Exceptions with ParallelExecutor

Posted by Nathan Quirynen <na...@pensionarchitects.be>.
Or do you mean I should just surround everything with a try catch to 
catch any exception and then use the logger to log it?

On 20/11/15 11:22, Nathan Quirynen wrote:
> Hey Ilya,
>
> Hmm I'm not sure what you mean. It does log everything, but no 
> exceptions:
>
> public class TestPage {
>
>     @Inject
>     private ParallelExecutor parallelExecutor;
>
>     void setupRender() {
>         parallelExecutor.invoke(new SomeBackgroundTask());
>     }
>
>     public class SomeBackgroundTask implements Invokable<String> {
>
>         private final Logger log = 
> LoggerFactory.getLogger(SomeBackgroundTask.class);
>
>         @Override
>         public String invoke() {
>             System.out.println("SYSOUT TEST");  // --> is outputted to 
> console
>             log.debug("LOG TEST"); // --> is outputted to console
>             throw new RuntimeException("EXCEPTION TEST"); // --> is 
> NOT outputted to console
>         }
>
>     }
>
> }
>
> What am I supposed to do exactly?
>
> Thanks,
> Nathan
>
> On 20/11/15 09:53, Ilya Obshadko wrote:
>> You may pass injected Logger instance to parallel execution, just 
>> like you
>> do normally.
>>
>> On Thu, Nov 19, 2015 at 5:07 PM, Nathan Quirynen <
>> nathan@pensionarchitects.be> wrote:
>>
>>> Hi,
>>>
>>> When using the ParallelExecutor exceptions thrown seem to be ignored in
>>> some way? The invokable just stops when there's an error somewhere, 
>>> but no
>>> exception is being logged, making it hard to find the problem.
>>> How can I get exceptions happening in the invokable getting logged?
>>>
>>> Simple example page:
>>>
>>>
>>> public class TestPage {
>>>
>>>          @Inject
>>>          private ParallelExecutor parallelExecutor;
>>>
>>>          void setupRender() {
>>>              parallelExecutor.invoke(new Invokable<String>() {
>>>                  @Override
>>>                  public String invoke() {
>>>                      throw new RuntimeException("TEST EXCEPTION");
>>>                  }
>>>              });
>>>          }
>>>
>>> }
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 


Een klare kijk op aanvullende pensioenen

*Nathan Quirynen*
03 340 04 60
nathan@pensionarchitects.be <ma...@pensionarchitects.be>


Re: Exceptions with ParallelExecutor

Posted by Nathan Quirynen <na...@pensionarchitects.be>.
Hey Ilya,

Hmm I'm not sure what you mean. It does log everything, but no exceptions:

public class TestPage {

     @Inject
     private ParallelExecutor parallelExecutor;

     void setupRender() {
         parallelExecutor.invoke(new SomeBackgroundTask());
     }

     public class SomeBackgroundTask implements Invokable<String> {

         private final Logger log = 
LoggerFactory.getLogger(SomeBackgroundTask.class);

         @Override
         public String invoke() {
             System.out.println("SYSOUT TEST");  // --> is outputted to 
console
             log.debug("LOG TEST"); // --> is outputted to console
             throw new RuntimeException("EXCEPTION TEST"); // --> is NOT 
outputted to console
         }

     }

}

What am I supposed to do exactly?

Thanks,
Nathan

On 20/11/15 09:53, Ilya Obshadko wrote:
> You may pass injected Logger instance to parallel execution, just like you
> do normally.
>
> On Thu, Nov 19, 2015 at 5:07 PM, Nathan Quirynen <
> nathan@pensionarchitects.be> wrote:
>
>> Hi,
>>
>> When using the ParallelExecutor exceptions thrown seem to be ignored in
>> some way? The invokable just stops when there's an error somewhere, but no
>> exception is being logged, making it hard to find the problem.
>> How can I get exceptions happening in the invokable getting logged?
>>
>> Simple example page:
>>
>>
>> public class TestPage {
>>
>>          @Inject
>>          private ParallelExecutor parallelExecutor;
>>
>>          void setupRender() {
>>              parallelExecutor.invoke(new Invokable<String>() {
>>                  @Override
>>                  public String invoke() {
>>                      throw new RuntimeException("TEST EXCEPTION");
>>                  }
>>              });
>>          }
>>
>> }
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Exceptions with ParallelExecutor

Posted by Ilya Obshadko <il...@gmail.com>.
You may pass injected Logger instance to parallel execution, just like you
do normally.

On Thu, Nov 19, 2015 at 5:07 PM, Nathan Quirynen <
nathan@pensionarchitects.be> wrote:

> Hi,
>
> When using the ParallelExecutor exceptions thrown seem to be ignored in
> some way? The invokable just stops when there's an error somewhere, but no
> exception is being logged, making it hard to find the problem.
> How can I get exceptions happening in the invokable getting logged?
>
> Simple example page:
>
>
> public class TestPage {
>
>         @Inject
>         private ParallelExecutor parallelExecutor;
>
>         void setupRender() {
>             parallelExecutor.invoke(new Invokable<String>() {
>                 @Override
>                 public String invoke() {
>                     throw new RuntimeException("TEST EXCEPTION");
>                 }
>             });
>         }
>
> }
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
Ilya Obshadko