Meaningless Drivel is fun!*
The moose likes Servlets and the fly likes why sun people declared config variable as transient in generic class? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "why sun people declared config variable as transient in generic class?" Watch "why sun people declared config variable as transient in generic class?" New topic
Author

why sun people declared config variable as transient in generic class?

ranjithkumar.gendhe kumar
Greenhorn

Joined: Oct 12, 2010
Posts: 19
why sun people declared config variable as transient in generic class?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41096
    
  44
Now that we know the question is about the GenericServlet class, let's slide it back to the servlet forum. The question is still not entirely clear, though: where did you get the notion of the ServletConfig object being transient or not being transient?


Ping & DNS - my free Android networking tools app
ranjithkumar.gendhe kumar
Greenhorn

Joined: Oct 12, 2010
Posts: 19
i noticed this thing in generic servlet class

they declared servletconfig ref variable as transeint in generic servlet. why they are declaring like that.

this class look like

"
public abstract class GenericServlet
implements Servlet, ServletConfig, java.io.Serializable
{

private transient ServletConfig config;

.....
.
.
.
.
}"
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

If I understand correctly, Servlets are serialisable and for example can be deployed to multiple nodes in a cluster. The config is specific to a node in the cluster though, so this prevents the config being moved to another node when it should not be, and allows the next node to set its own configuration.
ranjithkumar.gendhe kumar
Greenhorn

Joined: Oct 12, 2010
Posts: 19
k. thanks for your explanation.

i still have some confusing

could you explain with an example

in which cases it will helpful
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: why sun people declared config variable as transient in generic class?
 
Similar Threads
Transient Variables
generic servlet
transient
about trasient and static variable
config object in GenericServlet class