[proxy] InvocationRecorder?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[proxy] InvocationRecorder?

James Carman
What do you folks think about a new addition to Proxy which basically
allows you to record invocations made on proxy objects, similar to how
EasyMock does it.  Here's the idea...

public class InvocationRecorder
{
  public List<RecordedInvocation> getRecordedInvocations();
  public <T> proxy(Class<T> type);
}

public class RecordedInvocation
{
  public Method getInvokedMethod();
  public Object[] getArguments();
}

The Wicket folks are doing something similar to build up their
bindings for form components
(https://issues.apache.org/jira/browse/WICKET-1327):

SafePropertyModel<Person> p = new SafePropertyModel<Person>(new Person());
TextField field = new TextField("name", p.bind(p.property().getFirstName()));

With this addition to Proxy, we can handle all the "recording" for
them.  They just have to figure out what to do with the recorded
invocations.

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [proxy] InvocationRecorder?

Jörg Schaible
Hi James,

James Carman wrote:

> What do you folks think about a new addition to Proxy which basically
> allows you to record invocations made on proxy objects, similar to how
> EasyMock does it.  Here's the idea...
>
> public class InvocationRecorder
> {
>   public List<RecordedInvocation> getRecordedInvocations();
>   public <T> proxy(Class<T> type);
> }
>
> public class RecordedInvocation
> {
>   public Method getInvokedMethod();
>   public Object[] getArguments();
> }
>
> The Wicket folks are doing something similar to build up their
> bindings for form components
> (https://issues.apache.org/jira/browse/WICKET-1327):
>
> SafePropertyModel<Person> p = new SafePropertyModel<Person>(new Person());
> TextField field = new TextField("name",
> p.bind(p.property().getFirstName()));
>
> With this addition to Proxy, we can handle all the "recording" for
> them.  They just have to figure out what to do with the recorded
> invocations.

Pico folks do this for years in their web layer. More or less done in
ProxyToys technology. They use it also to assemble the components available
for each incoming request. However, the interesting part is the replay
action. That way the expensive part with all the reflection magic to search
the matching components is replaced the second time simply with the
recordings of the proxy.

- Jörg



---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [proxy] InvocationRecorder?

James Carman
On Sat, Apr 5, 2008 at 4:28 PM, Jörg Schaible <[hidden email]> wrote:
>  Pico folks do this for years in their web layer. More or less done in
>  ProxyToys technology. They use it also to assemble the components available
>  for each incoming request. However, the interesting part is the replay
>  action. That way the expensive part with all the reflection magic to search
>  the matching components is replaced the second time simply with the
>  recordings of the proxy.

That's exactly what we're looking at here, but the thought is that the
recording piece is common enough that it could be put into proxy.
What the application actually does with the recorded invocations is up
to it.  For instance, we're thinking of generating a class at runtime
that makes the calls using Javassist.

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

RE: [proxy] InvocationRecorder?

Jörg Schaible-2
[hidden email] wrote:

> On Sat, Apr 5, 2008 at 4:28 PM, Jörg Schaible
> <[hidden email]> wrote:
>>  Pico folks do this for years in their web layer. More or less done
>>  in ProxyToys technology. They use it also to assemble the
>>  components available for each incoming request. However, the
>>  interesting part is the replay action. That way the expensive part
>>  with all the reflection magic to search the matching components is
>>  replaced the second time simply with the recordings of the proxy.
>
> That's exactly what we're looking at here, but the thought is that the
> recording piece is common enough that it could be put into proxy.

Yep. Definitely +1. I simply gave an example for an existing use case :)

> What the application actually does with the recorded invocations is up
> to it.  For instance, we're thinking of generating a class at runtime
> that makes the calls using Javassist.

That apporach would even be faster than the implementation used in Pico/Nano.

- Jörg

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]