Mohan Krishnan
Mohan Krishnan

Reputation: 353

How to set a Thread-local in the thread provided by tomcat?

So, Tomcat has its own thread-pool and for each request, it gets a thread (Thread A)from this pool and uses and clears the same after completion.

Is there a way to initialise a thread-local variable when this thread (Thread A) gets initialised?

Purpose here is to calculate the processing time, where I need to set a time on thread creation and will be using this time to calculate the before processing time before sending out to the client.

Upvotes: 1

Views: 226

Answers (1)

Eugène Adell
Eugène Adell

Reputation: 3174

The processing time corresponds to the time-taken field of the Extended Access Log Valve. Maybe you don't need to reinvent the wheel in this case.

Upvotes: 2

Related Questions