This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Some errors with my ActiveSessions counter

 
Jenkin Zheng
Greenhorn
Posts: 12
Eclipse IDE Java Opera
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, everyone! I want to count active sessions on server. So I implement javax.servlet.http.HttpSessionListener, Here is a part code of SessionCounter
Here is my test the counter code:
Sometimes, the result is not right, like:[null]active sessions on server.
Why does it show null?I'm a newer!
thanks, everyone!
 
Piyush Joshi
Ranch Hand
Posts: 207
Eclipse IDE Firefox Browser jQuery
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
may be because you are printing it too early..
print it after the if/else block after you set the attribute in your code..
 
syed aq
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Donot use listener, in rare cases listeners are not fired
 
Piyush Joshi
Ranch Hand
Posts: 207
Eclipse IDE Firefox Browser jQuery
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
syed aq wrote:Donot use listener, in rare cases listeners are not fired

Can you please explain what are the cases when listeners will not be fired. (except when the server crashes)
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic