I assume that means we can't store non-serializable objects in the 
session? This is sounding like a serious deficiency in Wicket's 
architecture...




From:   Francois Meillet <francois.meil...@gmail.com>
To:     users@wicket.apache.org
Date:   05/06/2014 08:48 AM
Subject:        Re: Application Scope



sessions are serialised

François Meillet
Formation Wicket - Développement Wicket





Le 6 mai 2014 à 15:28, Richard W. Adams <rwada...@up.com> a écrit :

> One more question: Since each task is associated with a single user, 
would 
> it make more sense to create a task map in Session scope? Or will Wicket 

> try to serialize a map we put into the session?
> 
> 
> 
> 
> From:   Martin Grigorov <mgrigo...@apache.org>
> To:     "users@wicket.apache.org" <users@wicket.apache.org>
> Date:   05/06/2014 08:06 AM
> Subject:        Re: Application Scope
> 
> 
> 
> Please don't change the thread subject for all your answers. This 
confuses
> the threading support in some mail clients.
> 
> I meant *My*Application, i.e. *Your*Application.
> Add this method and map/associate all tasks that your run to some 
id/key.
> Serialize the key and later get a reference to the FutureTask with
> something like:
> YourApp.get().getTasks().get(theKey).isDone()/.isCanceled()/...
> 
> Martin Grigorov
> Wicket Training and Consulting
> 
> 
> On Tue, May 6, 2014 at 2:50 PM, Richard W. Adams <rwada...@up.com> 
wrote:
> 
>> Are you referring to org.apache.wicket.Application? I don't see a
>> getTasksMap() method there.  We use Wicket 1.4.17 & our company will 
not
>> allow us to upgrade to newer versions). If getTasksMap() is unavailable 

> in
>> 1.4.17, could Application.getSharedResources() be used in a similar 
way?
>> 
>> 
>> 
>> 
>> From:   Martin Grigorov <mgrigo...@apache.org>
>> To:     "users@wicket.apache.org" <users@wicket.apache.org>
>> Date:   05/06/2014 07:26 AM
>> Subject:        Re: Background Threading
>> 
>> 
>> 
>> Hi,
>> 
>> You can put the tasks in an application scoped structure (e.g.
>> MyApplication.get().getTasksMap()) and use a serializable key.
>> 
>> Martin Grigorov
>> Wicket Training and Consulting
>> 
>> 
>> On Tue, May 6, 2014 at 2:11 PM, Richard W. Adams <rwada...@up.com> 
> wrote:
>> 
>>> Interesting approach. Our use case is more complex, as it runs a
>>> background task in a separate thread. Our task has three basic
>>> requirements. It must:
>>> 
>>> 1. Be cancellable.
>>> 
>>> 2. Report its outcome (success/failure/warning).
>>> 
>>> 3. Report incremental progress.
>>> 
>>> Our fundamental problem is not how to display the progress bar, it's 
> how
>>> to determine the outcome of the background thread. That's an
>> unexpectedly
>>> a tough nut to crack. The vast majority of examples we've seen use the
>>> Runnable interface (which doesn't help us, as it can't be canceled or
>>> return a value), rather than Callable interface (which meets our 
> needs,
>>> but doesn't seem to play well with Wicket)
>>> 
>>> 
>>> 
>>> 
>>> From:   Colin Rogers <colin.rog...@objectconsulting.com.au>
>>> To:     "users@wicket.apache.org" <users@wicket.apache.org>
>>> Date:   05/05/2014 08:14 PM
>>> Subject:        RE: Progress Bar
>>> 
>>> 
>>> 
>>> There is a pretty nifty, jquery based progress bar, in 
> wicket-jquery-ui
>>> library...
>>> 
>>> 
>> 
> 
http://www.7thweb.net/wicket-jquery-ui/progressbar/DefaultProgressBarPage
>>> 
>>> Cheers,
>>> Col.
>>> 
>>> -----Original Message-----
>>> From: Richard W. Adams [mailto:rwada...@up.com]
>>> Sent: Tuesday, 6 May 2014 3:19 AM
>>> To: users@wicket.apache.org
>>> Subject: Progress Bar
>>> 
>>> We have a requirement to implement a progress bar for long-running
>> server
>>> operations. We can't use the code at
>>> https://github.com/wicketstuff/core/wiki/Progressbar, because it 
> doesn't
>>> meet our corporate user interface look-and-feel standards.
>>> 
>>> So, we started our own implementation. Our test page contains these
>>> methods below (the TestExecutor below class implements
>>> Callable<ExecutorResult>).
>>> 
>>> 
>>> 
>> 
>> 
> 
//----------------------------------------------------------------------------------------------
>>> private Component createButton() {
>>>        return new AjaxButton("start-button") {
>>>                private static final long serialVersionUID = -1;
>>> 
>>>                @Override protected void onSubmit(final
>> AjaxRequestTarget
>>> ajax, final Form<?> form) {
>>> 
>>>                        final ExecutorService service = Executors.
>>> newSingleThreadExecutor();
>>>                        try {
>>>                                final ProgressBarTestPage page =
>>> ProgressBarTestPage.this;
>>>                                final TransactionData data = new
>>> TransactionData (page.getId(), false);
>>>                                final TestExecutor executor = new
>>> TestExecutor(data, getPermissions());
>>> 
>>>                                executor.addListener(page);     //
>> Request
>>> notification when done
>>>                                future = service.submit(executor); //
>>> Begin execution
>>>                                progressBarUpdater.start(ajax,
>> executor);
>>> // Start polling for progress
>>> 
>>>                        } catch (final Exception ex) {
>>>                                throw new RuntimeException(ex);
>>>                        }
>>>                        service.shutdown();     // Terminate 
> gracefully
>>> (VM probably
>>>                }               //      won't exit if we fail to do
>> this)
>>>        };
>>> }
>>> 
>>> 
>> 
>> 
> 
//----------------------------------------------------------------------------------------------
>>> /**
>>>   Observer Pattern method to let us know when the task is done so we
>> can
>>> check how things went.
>>> */
>>> @Override public void executionComplete(final EnmCallableExecutor
>>> executor) {
>>> 
>>>        try {
>>>                if (!future.isCancelled()) { //
>>> Unless execution was canceled
>>>                        final ExecutorResult result = future.get(); //
>>> Get the outcome
>>>                        System.out.println(result);
>>>                        /*
>>>                         * TODO: Show success or error message
>>>                         */
>>>                }
>>>        } catch (final Exception ex) {
>>>                ex.printStackTrace();
>>>        }
>>> }
>>> 
>>> The ProgessBarUpdater class has this method:
>>> 
>>> 
>>> 
>> 
>> 
> 
//----------------------------------------------------------------------------------------------
>>> /**
>>> * Displays the progress bar &amp; begins the polling. We don't start
>> the
>>> polling until
>>> * explicitly told to do, for efficiency purposes.
>>> * @param ajax The Ajax request wrapper.
>>> * @param reporter The object to query for progress data.
>>> */
>>> public void start(final AjaxRequestTarget ajax, final ProgressReporter
>>> reporter) {
>>> 
>>>        add(new AjaxSelfUpdatingTimerBehavior(Duration.seconds(2)) {
>>>                private static final long serialVersionUID = 1L;
>>> 
>>>                @Override protected void onPostProcessTarget(final
>>> AjaxRequestTarget ajax) {
>>> 
>>>                        final Progress progress =
>> reporter.getProgress();
>>>                        final String script =                   // 
> Build
>>> script to update
>>>                                ProgressScript.build(progress);  //
>>> progress bar
>>>                        ajax.appendJavascript(script);
>>>                        if (progress == null) {                 // If
>>> operation is finished
>>>                                final ProgressBarUpdater updater =
>>>                                        ProgressBarUpdater.this;
>>>                                updater.remove(this); //
>>> Stop timer to prevent
>>>                                ajax.addComponent(updater);  //
>> pointless
>>> polling
>>>                        }
>>>                }
>>>        });
>>>        ajax.addComponent(this);
>>> }
>>> 
>>> The page also contains a Future object so we can check the result 
> after
>>> the thread finishes:
>>> 
>>>        private Future<ExecutorResult> future;
>>> 
>>> __________________________________________
>>> 
>>> Having said all that, here's the problem: When I click the page's
>> button,
>>> Wicket throws this error:
>>> 
>>>        Unable to serialize class: java.util.concurrent.FutureTask
>>> 
>>> The FutureTask object, I believe, is coming from the service.submit 
> call
>>> whose return value we store in our Future variable.
>>> 
>>> Does anyone know how to get around this roadblock?
>>> 
>>> 
>>> 
>>> **
>>> 
>>> This email and any attachments may contain information that is
>>> confidential and/or privileged for the sole use of the intended
>> recipient.
>>> Any use, review, disclosure, copying, distribution or reliance by
>> others,
>>> and any forwarding of this email or its contents, without the express
>>> permission of the sender is strictly prohibited by law.  If you are 
> not
>>> the intended recipient, please contact the sender immediately, delete
>> the
>>> e-mail and destroy all copies.
>>> **
>>> EMAIL DISCLAIMER This email message and its attachments are 
> confidential
>>> and may also contain copyright or privileged material. If you are not
>> the
>>> intended recipient, you may not forward the email or disclose or use 
> the
>>> information contained in it. If you have received this email message 
> in
>>> error, please advise the sender immediately by replying to this email
>> and
>>> delete the message and any associated attachments. Any views, 
> opinions,
>>> conclusions, advice or statements expressed in this email message are
>>> those of the individual sender and should not be relied upon as the
>>> considered view, opinion, conclusions, advice or statement of this
>> company
>>> except where the sender expressly, and with authority, states them to 
> be
>>> the considered view, opinion, conclusions, advice or statement of this
>>> company. Every care is taken but we recommend that you scan any
>>> attachments for viruses.
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>> 
>>> 
>>> 
>>> 
>>> **
>>> 
>>> This email and any attachments may contain information that is
>>> confidential and/or privileged for the sole use of the intended
>> recipient.
>>> Any use, review, disclosure, copying, distribution or reliance by
>> others,
>>> and any forwarding of this email or its contents, without the express
>>> permission of the sender is strictly prohibited by law.  If you are 
> not
>> the
>>> intended recipient, please contact the sender immediately, delete the
>>> e-mail and destroy all copies.
>>> **
>>> 
>> 
>> 
>> 
>> **
>> 
>> This email and any attachments may contain information that is
>> confidential and/or privileged for the sole use of the intended 
> recipient.
>> Any use, review, disclosure, copying, distribution or reliance by 
> others,
>> and any forwarding of this email or its contents, without the express
>> permission of the sender is strictly prohibited by law.  If you are not 

> the
>> intended recipient, please contact the sender immediately, delete the
>> e-mail and destroy all copies.
>> **
>> 
> 
> 
> 
> **
> 
> This email and any attachments may contain information that is 
confidential and/or privileged for the sole use of the intended recipient. 
 Any use, review, disclosure, copying, distribution or reliance by others, 
and any forwarding of this email or its contents, without the express 
permission of the sender is strictly prohibited by law.  If you are not 
the intended recipient, please contact the sender immediately, delete the 
e-mail and destroy all copies.
> **




**

This email and any attachments may contain information that is confidential 
and/or privileged for the sole use of the intended recipient.  Any use, review, 
disclosure, copying, distribution or reliance by others, and any forwarding of 
this email or its contents, without the express permission of the sender is 
strictly prohibited by law.  If you are not the intended recipient, please 
contact the sender immediately, delete the e-mail and destroy all copies.
**

Reply via email to