Re: What is the proper way to start a secondary process in Wicket 6

2015-01-05 Thread Ernesto Reinaldo Barreiro
De rien! 2015-01-05 9:54 GMT+00:00 Francois Meillet : > Thanks Ernesto ! > > François Meillet > > > > > Le 5 janv. 2015 à 10:38, Ernesto Reinaldo Barreiro a > écrit : > > > Martin > > -- Regards - Ernesto Reinaldo Barreiro

Re: What is the proper way to start a secondary process in Wicket 6

2015-01-05 Thread Francois Meillet
Thanks Ernesto ! François Meillet Le 5 janv. 2015 à 10:38, Ernesto Reinaldo Barreiro a écrit : > Martin

Re: What is the proper way to start a secondary process in Wicket 6

2015-01-05 Thread Ernesto Reinaldo Barreiro
Dear All, With the invaluable help of Martin Grigorov, I have summarized the discussion on this thread on a small Wicket in Action article [1]. The complete sample project can be found at [2]. 1- http://wicketinaction.com/2014/07/working-with-background-jobs/ 2-https://github.com/reiern70/antilia

Re: What is the proper way to start a secondary process in Wicket 6

2014-11-24 Thread Ernesto Reinaldo Barreiro
@Martin, Many thanks! I will try to have a look today at the PR and see if I find the time to write the blogs article during this week. Thanks again! On Mon, Nov 24, 2014 at 5:46 PM, Martin Grigorov wrote: > Hi Ernesto, > > See https://github.com/reiern70/antilia-bits/pull/1 > I've moved the c

Re: What is the proper way to start a secondary process in Wicket 6

2014-11-24 Thread Martin Grigorov
Hi Ernesto, See https://github.com/reiern70/antilia-bits/pull/1 I've moved the code that exports the Application thread local to TasksRunnable. This way it is possible to export the Session too. The code looks good (after removing all annoying whitespaces :-) ). Now it needs some explanation (i.e

Re: What is the proper way to start a secondary process in Wicket 6

2014-11-22 Thread Ernesto Reinaldo Barreiro
Warren, ThreadContext.detach(); seems to be more proper than... ThreadContext.setApplication(null); I will update demo. On Sat, Nov 22, 2014 at 10:58 PM, Warren Bell wrote: > Ernesto, > > That’s kind of what I ended up doing except with a different > ThreadPoolExecutor implementation. > > Execu

Re: What is the proper way to start a secondary process in Wicket 6

2014-11-22 Thread Warren Bell
Ernesto, That’s kind of what I ended up doing except with a different ThreadPoolExecutor implementation. ExecutorService executorService = new ScheduledThreadPoolExecutor(20) { @Override protected void beforeExecute(Thread t, Runnable r) { ThreadCo

Re: What is the proper way to start a secondary process in Wicket 6

2014-11-22 Thread Ernesto Reinaldo Barreiro
pushed a new version including injecting a Guice managed service class On Sat, Nov 22, 2014 at 8:08 PM, Ernesto Reinaldo Barreiro < reier...@gmail.com> wrote: > Warren, > > Something like: > > ExecutorService executorService = new ThreadPoolExecutor(10, 10, > 0L, TimeUnit.MILLISECOND

Re: What is the proper way to start a secondary process in Wicket 6

2014-11-22 Thread Ernesto Reinaldo Barreiro
Warren, Something like: ExecutorService executorService = new ThreadPoolExecutor(10, 10, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue()) { @Override protected void beforeExecute(final Thread t, final Runnable r) { ThreadContext.setApplication(BgProc

Re: What is the proper way to start a secondary process in Wicket 6

2014-11-21 Thread Ernesto Reinaldo Barreiro
Warren, Service holder will be created in a WEB thread, so WebApplication will be in context as a thread local. Mind that cosntructor of servce holder will cal Injector.get().inject... too inject the services. After that unless you need it for something else... you no longer need WebApplicatiion.

Re: What is the proper way to start a secondary process in Wicket 6

2014-11-21 Thread Warren Bell
Ernesto, I am not sure that creating a service holder will do the trick without still attaching the app to the new thread. I am currently injecting a service into your ExecutionBridge class that is instantiated in the request thread. All is good until that ExecutionBridge gets passed to the new

Re: What is the proper way to start a secondary process in Wicket 6

2014-11-21 Thread Ernesto Reinaldo Barreiro
@Warren, Apologies for the extra t on your name: texting on a mobile phone is a pain... I will update de demo to include a service. Just one question: the app not in context is when you try to inject that service? Or because you are using something else from WEB layer? On Fri, Nov 21, 2014 at 11:

Re: What is the proper way to start a secondary process in Wicket 6

2014-11-21 Thread Ernesto Reinaldo Barreiro
Thanks for your answer! There is no hurry. I will add a service to the mix to cover Warrent use case. Eg using Guice integration. On 21 Nov 2014 09:34, "Martin Grigorov" wrote: > > Hi Ernesto, > > I'm traveling now. I'll be able to take a look at Sunday. > On Nov 20, 2014 3:48 PM, "Ernesto Rein

Re: What is the proper way to start a secondary process in Wicket 6

2014-11-21 Thread Martin Grigorov
Hi Ernesto, I'm traveling now. I'll be able to take a look at Sunday. On Nov 20, 2014 3:48 PM, "Ernesto Reinaldo Barreiro" wrote: > Martin, > > I have created > > https://github.com/reiern70/antilia-bits/tree/master/bgprocess > > My only caveats are > > > https://github.com/reiern70/antilia-bits

Re: What is the proper way to start a secondary process in Wicket 6

2014-11-20 Thread Ernesto Reinaldo Barreiro
I do not see a problem with the approach bellow But I normally op for the solution I posted before. On Thu, Nov 20, 2014 at 9:33 PM, Warren Bell wrote: > After doing a little digging, I found the ThreadContext class. > > ExecutorService executorService = new ScheduledThreadPoolExecutor(20) >

Re: What is the proper way to start a secondary process in Wicket 6

2014-11-20 Thread Ernesto Reinaldo Barreiro
Warren. I just realized that part was missing... Look that when you create an ExecutionBridge you do in in a WEB thread. So you could do something like. class ServcesHolder { @Inject private MyService service; public ServicesHolder() { Injector.get().inject(this); } // setter enad getter. }

Re: What is the proper way to start a secondary process in Wicket 6

2014-11-20 Thread Warren Bell
After doing a little digging, I found the ThreadContext class. ExecutorService executorService = new ScheduledThreadPoolExecutor(20) { @Override protected void beforeExecute(Thread t, Runnable r) { ThreadContext.setApplication(app); }

Re: What is the proper way to start a secondary process in Wicket 6

2014-11-20 Thread Warren Bell
I have seen this from a 2010 post: final Application app = Application.get(); final ExecutorService service = new ScheduledThreadPoolExecutor(1) { @Override protected void beforeExecute(final Thread t, final Runnable r) { Application.set(app);

Re: What is the proper way to start a secondary process in Wicket 6

2014-11-20 Thread Warren Bell
Ernesto, great job putting all that code together so quickly. I cloned your project and cherry picked out the code that I needed, I don’t need all the process progress code you have. I don’t really care what the process progress is or even if it completes ok, just don’t want it holding up my res

Re: What is the proper way to start a secondary process in Wicket 6

2014-11-20 Thread Ernesto Reinaldo Barreiro
Martin, I have created https://github.com/reiern70/antilia-bits/tree/master/bgprocess My only caveats are https://github.com/reiern70/antilia-bits/blob/master/bgprocess/src/main/java/com/antilia/panel/TasksListPanel.java#L50 and https://github.com/reiern70/antilia-bits/blob/master/bgprocess/s

Re: What is the proper way to start a secondary process in Wicket 6

2014-11-20 Thread Ernesto Reinaldo Barreiro
Ok. Let me see what I can do this weekend while I wait for my son to finish he's shower after he's football match ;-) On Thu, Nov 20, 2014 at 8:30 AM, Martin Grigorov wrote: > Sure! Thanks! > It could be as fancy as you wish. > > Martin Grigorov > Wicket Training and Consulting > https://twitte

Re: What is the proper way to start a secondary process in Wicket 6

2014-11-20 Thread Martin Grigorov
Sure! Thanks! It could be as fancy as you wish. Martin Grigorov Wicket Training and Consulting https://twitter.com/mtgrigorov On Thu, Nov 20, 2014 at 10:17 AM, Ernesto Reinaldo Barreiro < reier...@gmail.com> wrote: > Can I give it a try? Something event showing some progress at client side? > >

Re: What is the proper way to start a secondary process in Wicket 6

2014-11-20 Thread Ernesto Reinaldo Barreiro
Can I give it a try? Something event showing some progress at client side? On Thu, Nov 20, 2014 at 7:54 AM, Martin Grigorov wrote: > Hi, > > Someday I'll write a blog (with a demo) about this at > http://wicketinaction.com. > The question is being asked regularly. > > Actually anyone can send a

Re: What is the proper way to start a secondary process in Wicket 6

2014-11-19 Thread Martin Grigorov
Hi, Someday I'll write a blog (with a demo) about this at http://wicketinaction.com. The question is being asked regularly. Actually anyone can send a Pull Request at https://github.com/dashorst/wicketinaction.com with such article. Martin Grigorov Wicket Training and Consulting https://twitter.

Re: What is the proper way to start a secondary process in Wicket 6

2014-11-19 Thread Ernesto Reinaldo Barreiro
Hi Warren, On Thu, Nov 20, 2014 at 12:46 AM, Warren Bell wrote: > I am using Wicket 6 REST annotations and want to asynchronously start a > process that writes some logging data to a db. I don’t need the response to > wait for this process. I have tried using threads, but I get the “App not > a

What is the proper way to start a secondary process in Wicket 6

2014-11-19 Thread Warren Bell
I am using Wicket 6 REST annotations and want to asynchronously start a process that writes some logging data to a db. I don’t need the response to wait for this process. I have tried using threads, but I get the “App not attached to this thread” exception when I try to use an injected service.