java - How to determine whether an EJB call is from a remote or local client -
i have interesting problem. have number of ejb's called both local code (via local interface) , client code (via remote interface).
the code runs on weblogic 12c servers , use rmi method invocations.
the system in development many years, , along others implements browser functionality around user defined cursors (a kind of handle result set). there many calls obtain such cursor various data types.
when cursor obtained used subsequently request underlying data (another call).
in our case want know whether call done local code or remote client. want know can preload first n items, , reduce number of calls our server. each call has overhead of 20ms, want avoid.
the remote client code generic (the cursor wrapped in kind of list) , adjusted handle preloaded data.
the local callers call these ejb methods obtain cursor, use other functionality handle cursor (wrapping in iterators, joins, etc). become lot more complex if had handle preloading (and not need it).
so want make interceptor preloading of data in cursor, if call made remote client. far not find way of doing so.
i tried remoteserver.getclienthost() throws exception there no connection.
i searched if sessioncontext extended field/value set caller identify remote client, find doing this. (we have homemade wrapper service interface extended of inserting such information in context).
so question is:
is there generic way find out in ejb interceptor origin of call different system
if remote client uses kind of authentication there should info in security context principal can used differentiate. otherwise, before finding better solution new throwable().getstacktrace() returns array of callers. there must method upstream tell if call local or it's been done via remote call.
Comments
Post a Comment