
1 Mar
2008
1 Mar
'08
8:34 p.m.
Hello, Lets assume I call MDC.put("applicationName","whatever") in the servlet init() method. Can I read this later in the service() method? I'm asking because some weeks ago I noticed that this did not work. I assumed that the threads running service() are not childrens of the thread that runs init(). However, I tried this again today, and this time it worked fine. I was not able to reproduce the problem. But before I do such things now in real web applications, I like to be sure if thats Ok. Can I set MDC variables in init() and read them in service() safely, or does this work only randomly or under special conditions?