|ServerPushSessions [message #1065105]
||Mon, 24 June 2013 11:40
| Sebastian Habenicht
Registered: January 2013
I implemented a simple short message functionality: Type in a short message and send it to another user. The message is shown on the other user's display immediately. I use ServerPushSessions in this approach:
- when user logs into application the ui session's display is registered in a static context
- a ServerPushSession is started right away
- when another user sends a message, asyncExec is invoked on the registered receiver's display to show the message
- whenui session is destroyed the ServerPushSession is stopped and the display is removed
I wonder if this is what ServerPushSessions have been designed for. I think that probably polling might be more suitable for this functionality, but I found the ServerPushSession approach interesting.
I use ServerPushSessions in background threads to e.g. hide a "Processing your request..." label when the background thread is done - which is afaik a classic use case for ServerPushSessions. When the above mentioned short message functionality is running, other ServerPushSessions are superfluous because there will always be a running ServerPushSession as long as the ui session is active.
So my questions are:
1. Might technical issues arise when every ui session has an active ServerPushSession while it is alive (because the documenation says to stop unused ServerPushSessions in order to free resources related to it)?
2. Would such an implementation lead to a constant loading symbol on mobile devices (as mentioned here: http://www.eclipse.org/forums/index.php/mv/msg/452311/1007319/#msg_1007319)?
3. Any other disadvantages?
Thanks for any thoughts on this.
[Updated on: Mon, 24 June 2013 11:43]
Report message to a moderator
|Re: ServerPushSessions [message #1065277 is a reply to message #1065105]
||Tue, 25 June 2013 08:21
|| Ralf Sternberg
Registered: July 2009
The ApplicationContext is a better place to store the reference to
another user's Display - static means system-wide, i.e. across the VM,
which is more than you need. Moreover, you should think about thread
safety and double check that the reference is cleaned up correctly to
avoid a memory leak.
In contrast to polling, the long-polling approach guarantees an
immediate feedback and spares traffic when there are few updates.
For applications that expect messages at any time, there's no
alternative to starting a global ServerPushSession and keeping it alive.
An active server push leads to a permanent standing request which may
block resources on the server, such as a thread from the servlet
container's thread pool. Whether this is problem probably depends on
your servlet container and maybe network infrastructure. I *think* it
might be problematic for a big number of users, but I've never heard any
complaints so far.
A ServerPush should not lead to a loading icon on mobile devices.
Professional services for RAP and RCP?
Powered by FUDForum
. Page generated in 0.01804 seconds