Enlightensoft's Blog

Helping in your each step

  • Categories

  • Authors

Thread Local

Posted by Pankil Patel on June 3, 2010

How to set & get value in thread specific local?

Step 1:

Create a class like bellow:

Step 2:

Set thread specific value in that.

Like: ABCThreadLocal.set(10);

Step 3:

Get that value in any time during that thread.

Like: ABCThreadLocal.get();

Hureeeeeeeeeeee Ready to use Your Thread Local which persist Object’s ( Integer in this case ) value during the thread execution.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: