[Logo]
Forums Register Login
Execution of the fileupload Primefaces multiple with counter
Hello, I m not all secure on the execution of the fileupload Primefaces.

The uploading execution occurs normally, but I would like to have a counter that control's

the received files. The problem is that sending files go by so fast by this method that he

appears to be running in parallel. My question is whether this behavior is normal while sending files.

If it is not, where may be the error. If it is normal what can i do to make the counter really take the right value?

I'm using the scope of the "bean" type of view, but when im trying to run the session the problem also occurs depending on the file size.

If my files are very small, the execution is very fast and I cant follow the counter.

If I clean the code the execution usually occurs no matter the size of the files.



xhtml:



The result on the console for 3 files is:


If I run the code in debug mode on the console this is the result:


Versions: Mojarra 2.1. Primefaces 5.1.15
(1 like)
I am pretty sure that the file uploads are happening in parallel. It makes them more efficient.

Although actually, the client's limit on concurrent requests may keep more that 10 or so of them from actually running at one time.

Bear in mind also that the fileupload listener is going to get a JSF lifecycle request for EACH file uploaded. If you've got parallel requests, make sure that any backing bean resources your listener deals with are thread-safe.
 
Tim Holloway wrote:I am pretty sure that the file uploads are happening in parallel. It makes them more efficient.

Although actually, the client's limit on concurrent requests may keep more that 10 or so of them from actually running at one time.

Bear in mind also that the fileupload listener is going to get a JSF lifecycle request for EACH file uploaded. If you've got parallel requests, make sure that any backing bean resources your listener deals with are thread-safe.



I was thinking that the fact that implementation takes place in parallel. You say: "If you've got parallel requests, make sure that any backing bean resources your listener deals with are thread-safe"
how i'm sure i any backing bean resources listener deals with are thread-safe ?
If you didn't code them thread-safe (synchronized), then they are not thread-safe.

Technically speaking, every JSF backing bean should consider thread safety excepting the (practically-useless) Request Scope beans. However, session/view scope beans are only going to get requests from a single user and most user interaction is done interactively.

Of course, one noteable exception is the old "charge money to my account" function, where it's wise to take precautions against a user double-clicking the "submit" button.
Wink, wink, nudge, nudge, say no more ... https://richsoil.com/cards



All times above are in ranch (not your local) time.
The current ranch time is
Dec 11, 2017 16:33:13.