[weld-dev] interceptors expected to be implemented via proxying or via subclassing?

Gavin King gavin.king at gmail.com
Sat May 15 19:28:20 EDT 2010


Correct.

On Tue, May 11, 2010 at 8:31 AM, Marius Bogoevici
<marius.bogoevici at gmail.com> wrote:
> Mark,
>
> I asked a similar  question here:
> http://lists.jboss.org/pipermail/weld-dev/2010-April/002485.html
>
> Gurkan answered here:
> http://lists.jboss.org/pipermail/weld-dev/2010-April/002490.html
>
> So based on what I think, and also on my understanding of what Gurkan
> says: one should not expect that invocations to 'this' are
> intercepted/decorated - that doesn't happen in EJB and it is not
> expected to happen for decorators.
>
> Marius
>
> On 10-05-11 2:24 AM, Mark Struberg wrote:
>> Hi!
>>
>> There is a subtle difference between implementing interceptors via proxy or via subclasses.
>>
>> I have the following service which imports data from a legacy system into my db. Since commits are very performance intense, they should get imported in packages of 100. So I'll get 100 'Employees' from my legacy system and then call a @Transactional method to store them in my own database.
>>
>> public void ImportService() {
>>    public void importEmployee() {
>>      List<LegacyEmployee>  les;
>>      while ((les = getNext100EmployeesFromLegacy()) != nul) {
>>        importLegacyEmployees(le);
>>      }
>>    }
>>
>>    @Transactional
>>    protected importLegacyEmployees(List<LegacyEmployee>  les) {
>>      for (LegacyEmployee le: les) {
>>        employeeService.store(le);
>>      }
>>    }
>> }
>>
>> This would actually _not_ work when using proxies for the interceptor handling, because calling a method on an own class doesn't invoke the proxyhandler.
>>
>> So is this expected to work?
>>
>> I remember that the old spec explicitly says that we need to use subclassing, but cannot find this paragraph anymore. So what does the spec require us to do? And what is Weld going to do?
>>
>> txs and LieGrue,
>> strub
>>
>>
>
>>
>> _______________________________________________
>> weld-dev mailing list
>> weld-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/weld-dev
>>
>
> _______________________________________________
> weld-dev mailing list
> weld-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/weld-dev
>



-- 
Gavin King
gavin.king at gmail.com
http://in.relation.to/Bloggers/Gavin
http://hibernate.org
http://seamframework.org



More information about the weld-dev mailing list