This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

|Solved| How to throttle requests using standard java?  RSS feed

 
Taariq San
Ranch Hand
Posts: 192
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Users are allowed a variable number of concurrent sessions, which rules out session beans.

I could read a byte from a stream before processing the request and write a byte to it when done processing. On login write a byte for as many requests they're allowed.
I could have a stream like that for each user, there won't be that many of this type, maybe a dozen or 2. Not that it would be such a big deal for the oter thousands but in this particular forum its a more serious consideration.

Anyhat, can you give any other option please?
[ August 17, 2008: Message edited by: Taariq San ]
 
Steve Luke
Bartender
Posts: 4181
22
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What kind of application are we talking about, J2EE? Or Standard?

What is the definition of concurrent sessions? Are they separate user-specific data stores shared along multiple requests or just separate concurrent threads sharing the same data store? Does each request get a new session? How are sessions generated?

What should be the behavior when the user has no more concurrent sessions? Should new requests fail with an error, or should the requests block until a session becomes available?

How are sessions made available?

You may want to look into the java.util.concurrent.Semaphore. It may help you create a general framework, but it is hard to know if it would be applicable to your situation.
 
Taariq San
Ranch Hand
Posts: 192
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Steve, that's just what I'm after.
This fits the bill perfectly so I won't bore you with the details.
Happy coding!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!