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:


.: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?

Danish Ahmed said...

Thanks for sharing this article, now you can also check your Admit card & Recuritment 2017 by following below given links...

police si admit card 2017

gpsc medical officer admit card 2017

tamilnadu teacher recuritment 2017

bihar police constable recuritment 2017

gujarat high court recruitment 2017

Habib Malik said...

Karnataka TET Notification 2017-18
Jharkhand TET Notification 2017-18
HTET Notification 2017-18
HP TET Notification 2017-18

adidas nmd said...

nhl jerseys
cheap ray bans
oakley sunglasses wholesale
ralph lauren polo
fitflops sale clearance
nike blazer pas cher
christian louboutin shoes
cheap ray ban sunglasses
oakley sunglasses
nike outlet

Habib Malik said...

Feliz año nuevo 2018 Imágenes

Habib Malik said...

Odisha CHSE Date Sheet 2018
LNMU Date Sheet 2018
Kota University Date Sheet 2018
Allahabad University Date Sheet 2018
RMLAU Time Table 2018
MAHA Board HSC Date Sheet 2018
MAHA Board SSC Date Sheet 2018
Odisha Board HSC Date Sheet 2018

Habib Malik said...

Haryana TET Admit Card 2017
REET Admit Card 2018
Bank of Baroda Specialist Officer Admit Card 2018
JEE Main Admit Card 2018

Unknown said...

airtel ussd code list
idea ussd code list
bsnl ussd code list
aircel ussd code list
vodafone ussd code list
jio ussd code list
telenor ussd code list
docomo ussd code list
airtel phone no check

Unknown said...

docomo balance check codes
telenor balance check codes
airtel phone no check

vodafone balance check code
airtel balance check code

Unknown said...

ussd codes
photographer in gurgaon
graphics card under 100 dollar

Habib Malik said...

महात्मा गांधी राष्ट्रीय ग्रामीण रोजगार गारंटी अधिनियम (मनरेगा / MNREGA)


are raspberries bad for dogs
can i give my dog raspberries
know more
can dogs eat red raspberries
click here

Unknown said...

Vodafone Balance Transfer
Vodafone Unlimited Calling Plan
Vodafone SMS Pack
Voafone Caller Tune
Vodafone Internet settings
Vodafone DND Services
Vodafone Loan Number
Vodafone Customer Care Numbers
Port Vodafone Number

Pooja Sharma said...

Aadhaar Card Download By Name And Date Of Birth
Download Aadhar Card By Name
Aadhar Card Change Address Online
Download Aadhar Card by Enrollment Number
Aadhar Card Photo Change
Aadhar Card Enrollment Status
lost Aadhar Card Number
Aadhar Card Verification Online
Aadhar Card Enrollment Form
Aadhar Card Name Change Online

Freedom Apk said...

home button not working
Click here
iphone 6 home button
iphone 6 home button not working
iphone home button not working

Uttam Simepuruskar said...

thank you for it. keep up the good work.
best of crick

Unknown said...

Mobile USSD Codes
Idea Easy Share
Idea Loan Number
Idea Internet Setting
Idea DND Service
Idea Unlimited Calling Plan

Freedom Apk said...

Best Facebook tips

Unknown said...

just information we only provide information for those who need it cara menggugurkan hamil
A. cara agar cepat hamil setelah selesai haid
B. cara agar cepat hamil
C. cara alami untuk segera mendapat kehamilan
D. makanan dan minuman agar cepat hamil
E. masa subur biar cepat hamil
F. panduan agar cepat hamil


thanks for sharing 082210743003

Obat Aborsi

Obat Telat Bulan

Obat Penggugur

Jual Obat aborsi terbaik

Obat Aborsi Termurah

Obat Aborsi Terpercaya

Obat Aborsi terbaik

jual Obat aborsi termanjur

jual obat aborsi asli

jual obat telat bulan

jual obat aborsi

obat telat bulan

obat telat bulan asli

klinik obat telat bulan

obat telat bulan terbaik

Bigg Boss said...

Bigg Boss 12 Winner
Bigg Boss 12 Winner

bike rent in dehradun said...

bike rental in dehradun
yubikey 4
Defence Jobs in India

Unknown said...

Helplinehub bankhelp axis bank account balance check allahbad bank account balance check andhra bank account blance check airtel payment bank balance check

Sahib Khan said...


Sahib Khan said...

Sandeep Maheshwari
Sandeep Maheshwari Quotes

Renu said...

JioFi Local Html

Admin said...


Admin said...

nice articlelink aadhar to pan

remuk said...

now present in your city cara menggugurkan kandungan

Sharon Wood said...

Lifelock Phone Number
Brother Printers Support
HP Printer Support Number
Canon Printer Help Number

khalifa said...

Very good article. I like it keep posting this kind of post.
This article is very hepful people are also chec
ncert solution class 10 maths
ncert solution class 10 science
ncert solution class 10 english
ncert solution class 10 hindi
Happy Learning!!!

Darren Demers said...

This pattern is a real ThreadLocal killer as it is a way to track state over several calls without widespread ThreadLocal usage. scarf suppliers , ladies wraps and shawls , wholesale shawl suppliers , velvet shawl , new york wholesale , elegant shawl , kashmiri shawls wholesalers , red shawl

Sophie Grace said...

This is my first visit to this website, you have posted valuable content which i like reading.I expect more similar articles from you in future . Go with our site webstagram to download free anything you like on iinstagram.

Anaminka said...

Our client can choose any of them as per their convenient. We are also open to send our angels any other place of your choice.Female Escorts in Mahipalpur are waiting eagerly to meet you. You need to decide whether you want to meet them at home or at any hotel. If you are facing any challenges in arranging any place, let me inform you that we have tie-ups with 3 start hotels as well as 5 start hotels. Check our other services...
Russian Call Girls in Mahipalpur
Russian Escorts in Mahipalpur
Escorts in Aerocity
Escorts Service in Aerocity
Female Escorts in Aerocity
Escorts in Aerocity

Sahib Khan said...

home depot black friday sales
bose black friday headphone deals
built in bbq black friday sale
black friday xbox
automotive parts ordered on black friday vs cyber monda

home depot black friday sales
bose black friday headphone deals
built in bbq black friday sale
black friday xbox
automotive parts ordered on black friday vs cyber monda

Miss Nikita Agarwal said...

Thanks for sharing the article...You write very well...If you need backlinks please reach me on
Call girls in jaipur
Call girls in Jaipur
Call girls in Jaipur
Call girls in Delhi
Call girls in Guwahati
Call girls in Guwahati
Call girls in Guwahati
Call girls in Guwahati
Call girls in Aerocity
Call girls in Lucknow