aspose file tools
The moose likes Servlets and the fly likes Clear servlet thread Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Servlets
Reply Bookmark "Clear servlet thread" Watch "Clear servlet thread" New topic
Author

Clear servlet thread

Dan Parsons
Ranch Hand

Joined: May 30, 2007
Posts: 70
I would like to initialize a Servlet when it is called.
Will this clear any sessions and threads?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56233
    
  13

Completely unnecessary. What are you actually trying to accomplish?


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
Dan Parsons
Ranch Hand

Joined: May 30, 2007
Posts: 70
I am using Servlet as a controller for my form entries.

If I send them to the Servlet with or without sessions it wont show anything after the servlet forwards to a JSP. I am encoding with sun.misc.BASE64Encoder in another Servlet and it seems to be effecting all my Servlets for this webapp. If I take out the sun.misc.BASE64Encoder in the other servlet, the form entries will work in my servlet and show up in the forwarded jsp. I was hoping to somehow clear or eliminate any threads that were created from another Servlet in my webapp that has the sun.misc.BASE64Encoder.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56233
    
  13

I have no idea what's up with all the Base64 encoding (perhaps you can explain that), but there's no such thing as left-over threads that could be affecting other servlet invocations, and therefore need "resetting".

Let's back up a bit, explain why you are Base64 encoding stuff (really? why?), and what makes you think that it's affecting other threads.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Dan Parsons wrote:I am encoding with sun.misc.BASE64Encoder [...]

I never recommend using internal libraries--they're not guaranteed to be present in any JRE.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12271
    
    1
I would like to initialize a Servlet when it is called.


When the init() method is called by the servlet container, this is guaranteed to be before any request has been sent to the servlet so there is no concept of a current request and thus a current session.

Any sessions associated with the web applications would have to be left over from the last time the application was running. The only way they would be used is if the client browser still has a cookie for the sessionid and the session has not been timed out.

Bill


Java Resources at www.wbrogden.com
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Clear servlet thread
 
Similar Threads
nested for loop
Why does GenericServlet implement ServletConfig
JSTL c:forEach tag iteration variable
Delegating to doGet()
calling sub class' method from super class