Monday, August 17, 2009

Pattern: InvocationContext Propagation

Another good name for this pattern might be ThreadLocal Encapsulation.

This pattern is a real ThreadLocal killer as it is a way to track state over several calls without widespread ThreadLocal usage.

Internally in OpenEJB we have managed to boil all our ThreadLocal usage down to this sort of "one to rule them all" approach. When attempting to describe it to a user I started using the javax.interceptor.InvocationContext as an example. The result was an ejb3 design pattern that is too cool not to share.

Add the following Interceptor as a global interceptor at the beginning of the interceptor stack.
The Interceptor uses a private ThreadLocal to propagate invocation state by linking the InvocationContext objects together. The result is that you can do an infinite amount of state tracking as well as write some pretty impressive diagnostic tools.

Anyone downstream of this interceptor can make a call like this to get access the an infinite amout of state up the stack. You can move specific state forward for quick access. You can also look infinitely back the invocation chain for state set in a previous InvocationContext. Or perhaps more elegantly as a recursive method. A JavaDoc'ed and ASL licensed version here: http://gist.github.com/168153

42 comments:

.:raPHa:. said...

Hi David, I am implementing an auditor for EJBs methods and need a solution like this to record the call stack between methods in enterprise application.
This mechanism is safe for concurrent calls?

Narender Godara said...

Packers and movers Raipur
Packers and movers Rajkot
Packers and movers Shimla
Packers and movers Surat

amine lahragui said...

Your work is very good and I appreciate you and hopping for some more informative posts. happy new year 2016 new year 2016 bonne année 2016 happy new year 2016 images feliz año nuevo 2016 imagenes de año nuevo 2016 feliz año 2016

Hosting Coupons&Discounts said...

new year 2016
diwali wishes 2015
diwali quotes 2015
diwali images 2015
new year 2016 wishes
new year 2016 sms
new year 2016 quotes
new year 2016 messages
new year 2016 poems
new year 2016 fb status
new year 2016 whatsapp status
new year hindi wishes
new year 2016 french
new year 2016 spanish

Abu sigly Ahlussunnah waljamaah said...

thank u friend
cara cepat menjadi orang pintar
Khasiat ayat kursi
resep ceker goreng tepung kryspy
polisi tangkap dua anggota TRA
sebab akibat serangan teror diparis
keajaiban air zam zam
alasan paling kuat kenapa alien belum ditemukan

Mary Brown said...

Java EE article is practical oriented and real time examples. How Java EE address the enterprise development is very important. for that you need a practical orieneted Java Training you need.

Online Java Training
Online Java Training from India
Java Training Institutes in Chennai
Java Training in Chennai
Java Training

Abu sigly Ahlussunnah waljamaah said...

Baca juga

mkasih sobat semua,salam sukses
manfaat berjalan kaki
Kekejaman nasrani
sembahlah Allah Tuhanku dan tuhanmu
penampakan ufo

prem chand said...

Republic Day 2016
Republic Day 2016 Images
Valentines Day 2016
Happy Valentines Day images
Happy Holi 2016 images
Happy Holi 2016
Happy Lohri images
Happy Lohri Messages Sms

Ranveer Patil said...

This blog is a great source of information which is very useful for me.
ICC cricket World Cup 2016 Time table Released
T20 World Cup 2016 Streaming Live

Infomatric - Information Time said...

business smartphone
business phone
business phones
business mobile phones
best smartphone for business

Infomatric - Information Time said...

26 january republic day
republic day 2016
republic day in hindi
republic day images pictures
26 january republic day images
indian republic day quotes
greetings of republic day
26 january republic day images
image of republic day
republic day photo
indian republic day
speech on republic day
republic day pictures
26 january republic day
republic day greetings
republic day greetings
republic day images
republic day photos
republic day pic
about republic day in hindi
happy republic day image
republic day speech
republic day sms
republic day message
republic day wishes
short speech on republic day
happy republic day quotes
republic day in hindi

Infomatric - Information Time said...

images of republic day
republic day of india
indian republic day
happy republic day 2014
republic day quotes
speech for republic day
indian republic day 2014
january 26 republic day

xiaomi redmi note 2 prime flipkart

prem chand said...

Hello sir your article or work is so nice and full informative with each and singal point and i loved to reading that kind article which is available in your website so thanks and yes keep updating more stuff on this topic. Below check some stuff,
Happy Valentines Day 2016 , Valentines Day 2016 images , Happy Valentines Day Sms , Valentines Day 2016 Messages , Happy Holi 2016 Messages , Happy Holi 2016 Sms , Happy Holi 2016 Quotes , Happy Chocolate Day 2016 , Chocolate Day 2016 images , Happy Chocolate Day Sms , Chocolate Day 2016 Messages , Happy Hug Day 2016 , Hug Day 2016 images , Happy Hug Day Sms , Hug Day 2016 Messages , Happy Kiss Day Sms , Kiss Day 2016 Messages , Happy Kiss Day 2016 , Kiss Day 2016 images , Republic Day Speech in Hindi and English , Republic Day 2016 Messages and Sms , Happy Holi 2016 images , Happy Holi 2016 Messages , Happy Holi 2016 Sms , Happy Holi 2016 Quotes

Valentines Day Quotes said...

valentines day images 2016
Valentines Day 2016 Shayaries
happy Valentines Day Quotes 2016
happy Valentines Day 2016
Valentines Day 2016 Wishes
Valentines Day 2016 Messages

Valentines Day Quotes said...

valentines day images 2016
Valentines Day 2016 Shayaries
happy Valentines Day Quotes 2016
happy Valentines Day 2016
Valentines Day 2016 Wishes
Valentines Day 2016 Messages

Jawad Zaib said...

Your Site Is Very Good and The Post is Well On Topic, Thanks for Sharing it with us.

New Songs 2016
see how the biometric verification
China Start Collaboration in Space
Samsung Curvier S6 Edge Plus
apple iphone 7 price and specs
Lahore Qalandars Pakistan Super League 2016
poetry in urdu sad 2016
New Love Songs 2016
free copyright free music for youtube 2016

Arjun Rishi said...

Nice post. Thanks for sharing.
html course in chennai

asds said...


Happy fathers Day
Happy father's Day
Happy fathers Day 2016
Happy father's Day 2016
fathers Day 2016
father's Day 2016

Apply Govt jobs said...

Apply Govt Jobs
Latest Govt Jobs
New Govt Jobs
Indian Govt Jobs

Watch Movies Online Live
Watch Movies Online
Watch Free Movies Online

Happy Holi Image 2016
Happy Holi Images
Happy Holi sms 2016
Happy Holi cards 2016
Happy Holi wishes sms
Holi 2016 images

Happy Holi 2016
Holi 2016
Happy Holi sms
Happy Holi messages

prem chand said...

Nice article is provided by you admin, thanks for this article becoze it helped me lot and below we have some stuff which our topic to write article so please checkout them.
Happy Holi 2016
Holi Messages Wishes Sms , Holi 2016 , Happy Holi , Facebook Whatsapp Status , Holi 2016 Images ,

Holi
Happy Holi Images , Happy Holi Pictures , Happy Holi Greeting , Happy Holi Wallpapers , Happy Holi Wishes , Happy Holi Sms , Happy Holi Quotes , Happy Holi Messages , Happy Holi Song ,

Happy Holi 2016 , Happy Holi 2016 Messages , Happy Holi 2016 Sms , Happy Holi 2016 Pics HD Images Ecards , Happy Holi 2016 Messages Msg Hindi Quotes Sms

jooo said...

holi

happy holi

holi images

holi image

gudi padwa

jooo said...

holi one

when is holi

holi wishes

happy holi images

holi festival of colours

holi quotes

nag panchami

color festival

jooo said...

festival of colors

holi greetings

holi video

holi messages

holi pics

jooo said...

buddha purnima

holi india

holi photo

holi pictures

holi party

holi photos

colour festival

jooo said...

holi picture

what is holi

holi colors

happy holi image

holi date

holi shayari

holi festival india

Lopez Alexander said...

This is a really super post. Must admit that you are amid the best writer I have read. I appreciate your making the effort to discuss this class of article.

- usps tracking
- iphone 7 release date
- Netflix

Linda Rose said...

This is also a very good post which I really enjoyed reading. It is not everyday that I have the possibility to see something
Descargar Geometry Dash |Descargar Geometry Dash 2.0 |Geometry Dash|Geometry Dash 2.0 |

Rahul Singh said...


Happy mothers day

Mother's day

mothers day

when is mothers day

mothers day quotes

happy mothers day images

mothers day date

mother day

mothers day poems

happy mothers day quotes

happy mother's day

mothers day messages



mothers day messages

happy mother's day

happy mothers day quotes

mothers day poems

mother day

mothers day date

happy mothers day images

mothers day quotes

when is mothers day

mothers day

Mother's day

Happy mothers day

36

Rahul Singh said...

Happy fathers day
fathers day 2016
Happy fathers day 2016
fathers day Quotes
fathers day images
father's day
fathers day wishes
fathers day pictures
fathers day sms
fathers day cards
fathers day gift ideas
fathers day 2016 images


Happy memorial day
memorial day
memorial day wishes
memorial day cards
memorial day 2016 wishes
memorial day images
memorial day speech
memorial day pictures
memorial day 2016
eid
eid mubarak 2016
eid mubarak images
eid al fitr
eid celebration
eid mubarak 2016 images

Sham Bahadur said...

Earth Day
Earth Day 2016
Happy Earth Day
Happy Earth Day 2016
Earth Day Quotes Wishes Images Photos Poster
Earth Day Wishes
Earth Day Messages
Earth Day Quotes
Earth Day Saying
Earth Day Images
Earth Day Posters
Earth Day Banners
Earth Day Images Pictures Posters for Facebook abd Whatsapp

Mothers Day
Mothers Day 2016
Happy Mothers Day
Mother’s Day
Mother’s Day 2016
Mothers Day Quotes with Images
Mothers Day Wishes
Mothers Day Messages
Mothers Day Quotes
Mothers Day Saying
Mothers Day Images
Mothers Day Poems

Mothers Day
Mothers Day 2016
Happy Mothers Day
Mother’s Day
Mother’s Day 2016
Mothers Day Wishes Quotes with Images
Mothers Day Wishes
Mothers Day Messages
Mothers Day Quotes
Mothers Day Saying
Mothers Day Images
Mothers Day Poems

pankaj mishra said...

ANZAC 2016 POSTER IMAGES
WHO IS THE WINNER OF BOSTON MARATHON 2016
EARTH DAY COVER PICS
MOTHER DAY HD GREETING CARDS
THE VOICE SEASON 10 WINNER PREDICTIONS

prem chand said...

Memorial Day
Memorial Day 2016
Happy Memorial Day
Memorial Day Images
Memorial Day Quotes

Fathers Day
Fathers Day 2016
Happy Fathers Day
Fathers Day Images
Fathers Day Quotes

Ramadan Mubarak
Ramadan Mubarak 2016
Ramadan Mubarak Images
Ramadan Mubarak Wishes
Ramadan Mubarak Quotes Sms

Ramadan Mubarak
Ramadan Mubarak 2016
Ramadan Mubarak Images
Ramadan Mubarak Wishes
Ramadan Mubarak Quotes Messages

Eid 2016
Happy Eid
Eid Mubarak
Eid Mubarak Images
Eid Mubarak Wishes
Eid Mubarak Quotes

pankaj mishra said...

ANZAC DAY IMAGES
BOSTON MARATHON 2016
EARTH DAY IMAGES PICTURES
GREETING CARD MOTHER'S DAY
THE VOICE SEASON 10

Love KidsTV said...

Thanks for the best blog.it was very useful for me.keep sharing such ideas in the future as well. Thanks for giving me the useful information. I think I need it!
Happy Wheels , FNAF World , Five Nights At Freddy's

Itz Imran said...

state bank of india po books
sbi po book by kiran publication
sbi po books 2016
sbi po exam preparation books
sbi po exam books pdf

Infomatric - Information Time said...

Memorial Day Best celebration ideas
Memorial Day Oath of Soldier speech 1997
Memorial Day Honour speech for died soldiers
Soldier boys what gave us USA Memorial day 2016
Memorial Day deals veterans day 2016
Why we celebrate memorial Day kids 2016
Happy Memorial day images and quotes
Memorial day weekend
History of memorial day
Memorial day sms
Memorial day Messages
Memorial day Wishes
Memorial day Pictures free download


Father's day gifts ideas
Father's day gifts ideas 2016
Father's day gifts ideas diy
Father day gifts ideas pinterest
Father's day gifts ideas south africa


Fathers day images download free
Father's day pic download
happy fathers day images download
Father's day special images download
Fathers day images and quotes download

Shaun S said...

Memorial Day Wishes
Memorial Day Quotes
Memorial Day Messages
Happy Memorial Day Wishes
Happy Memorial Day Quotes

Akshi Sharma said...

Happy Father's Day
FREE PRINTABLE FATHERS DAY CARDS
Fathers Day 2016 Quotes


best fathers day 2016 facebook timeline covers
fathers day shayari in hindi 2016
fathers day poems from daughter 2016


fathers day 2016 quotes pictures, images and photos
Fathers Day 2016 SMS
fathers day quotes messages images wishes


happy fathers day 2016 quotes sayings in english
happy fathers day greetings 2016 from wife to husbands
happy fathers day 2016 messages, quotes and wishes


Fathers day picture
top 10 fathers day wallpapers quotes images 2016
Fathers Day Poems from Kids


best fathers day messages from daughter
fathers day messages from wife to husband
short father's day quotes 2016

one liner fathers day slogans in english
fathers day slogans in english
fathers day quotes from daughter hindi

best father's day quotes 2016
happy father's day quotes 2016 in hindi and english
fathers day quotes in hindi best hindi shayari



french open final live streaming
french open fin al 2016 live
french open live stream








http://www.fathersday2014s.com/2014/05/fathers-day-messages.html
http://www.fathersday2014s.com/
http://www.fathersday2014s.com/2014/05/fathers-day-greetings.html
http://www.fathersday2014s.com/2014/05/fathers-day-quotes.html
http://www.fathersday2014s.com/2016/05/fathers-day-images.html
http://www.fathersday2014s.com/2016/05/fathers-day-pictures.html

Olivia Adam said...

Happy Father’s Day Messages
Happy Fathers Day Messages
Fathers Day Quotes
Happy Father’s Day Images
Fathers Day Gifts Ideas

Ajay Kumar said...

Your article is written nice and we are also representing much celebration if anyone interested checkout below the line
Happy Canada Day
Happy Canada Day 2016
Happy 4th of July Images
Happy 4th of July 2016 Images
Happy Daughters Day
Happy Daughters Day 2016
Happy Parents Day
Happy Parents Day 2016
Happy Grandparents Day
Happy Grandparents Day 2016

Free Happy Canada Day Ecards
Happy Canada Day Cards
Happy Canada Day Cards Images Pics

Himanshu Grewal said...

Download Fathers Day quotes from bible
Fathers Day verses from angel in heaven
Happy Fathers Day hand print card from children
Fathers Day nice quotes latest cards for whatsapp
Fathers Day free events ideas 2016
father’s day poem 2016


Fathers Day Thank you card from son
Fathers Day handmade card
Fathers Day Top 12 cards saying images from wife
Fathers Day online e cards from wife
Fathers Day special cake
father’s day quotes and images


happy on this Fathers Day 2016
Fathers Day quotes for this 19th June 2016
Download free gift hamper images for this 2016 Fathers Day
Funny Father's day ideas 2016
How to make your Dad impress on this 19th June 2016
Father's day greeting cards

Himanshu Grewal said...

happy father's day gift ideas
father's day 2016 free gifts
happy father's day gift baskets
Father's day wallpapers
happy fathers day gift bag
Father's day date ideas
creative free father's day gifts
father's day gifts for free
free printable gifts for father's day
free father's day gifts ideas