Win a copy of Head First Agile this week in the Agile forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to share temporary, continuously changing data between clients  RSS feed

 
wayne forrest
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all developers,

I need some advice here please, I will try to explain as best I can and be as short as possible:

[How to share temporary, continuously changing data between clients in EJB's]

I need to create a "File server" that collects data on demand from an external URL, each service will fetch live data, and deliver the data to clients.

Each "server instance" will be responsible for collecting live data, and the amount of "server instances" will be one per resource file.
The reason for this is to minimize the network traffic to the external URL's.

External URL File 1--------------------------> [ server instance 1] ---------------------->[ serving clients one two and three]

External URL File 2--------------------------> [ server instance 2]----------------------->[ serving clients four and five]

External URL File 3--------------------------> [ server instance 3]----------------------->[ serving clients 6 to 1000]


I guess the server can not be a servlet, since each request/client gets a new instance;
I am not sure if EJB's behave the same ... I presume the same.

I have searched on "Singletons" but seems that might be problematic too... and server specific, seems Glassfish does offer a singleton EJB.

Any advice please.... What can one use EJB/SERVLETS/etc.








 
Ram Narayan.M
Ranch Hand
Posts: 247
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Stateless Session Bean would do good since on demand data is fetched for each client...

And Servlet can be used with the avoidance of creation of instance variable in servlet class which will be accessible to multiple threads...

On the whole, Servlet as client to Stateless Session bean can be tried...
 
K Abhijit
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i'm sorry i could not get your requirements correct ......

wayne forrest wrote:
I guess the server can not be a servlet, since each request/client gets a new instance;
I am not sure if EJB's behave the same ... I presume the same.



for every request we would be having new Thread, not Servlet new instance...
Servlet specification suppots shared memory concepts through ServletContext /PageContext ....
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!