There are several way but the common idea is to be able to identify a webapp specific resource and test it is in both classloaders. Then the speed will be a constraint some "caching" - ie keep reference - is doable easily normally.
On the impl side I would remove the type check (just check ClassLoader) then you can quickly check the hashCode (ensure to use a stable version, you can cache it in the constructor) and finally I would try to get in your classloader WEB-INF, if there is any child I would use it to do a getResource() on the other classloader and validate it is the same one (check JarLocation). If there is no child at all - ie the webapp is 100% resources - then using only the hashCode should be fine but using "/" as resource should work also. Hope it makes sense. Romain Manni-Bucau @rmannibucau <https://twitter.com/rmannibucau> | Blog <http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> | LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber <http://www.tomitribe.com> 2015-07-28 0:32 GMT-07:00 Anne Stellingwerf <[email protected]>: > Hi Romain, > > I do see your point. It's good to support the more common case. > > Now given my simple example, how would the custom equals implementation > look > like? > > Kind regards, > Anne Stellingwerf > > > > -- > View this message in context: > http://tomee-openejb.979440.n4.nabble.com/Using-Loaders-with-TomEE-1-7-2-tp4675558p4675623.html > Sent from the TomEE Users mailing list archive at Nabble.com. >
