Hi,

I just checked in the first cut under r628163: http://svn.apache.org/viewvc?rev=628163&view=rev. The key changes are:

1) Add an optional PassByValueAware SPI
2) Have invokers for reference bindings and implementations to implement this SPI to express their capability to support pass-by-reference 3) Make the PassByValueInterceptor honor the allowsPassByReference by invokers

I haven't refactored the PassByValueInterceptor into a utility yet. Ideally, the client side of the invocation chain should decide if it needs to call the PassByValueUtil to copy the data before it dispatches to the invocation chain. The client can be the JDKInvocationHandler (proxy), the reference binding dispatcher or the service binding listener. This is the next TODO. Please feel free to jump in if you're interested.

Thanks,
Raymond

----- Original Message ----- From: "Jean-Sebastien Delfino" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Friday, February 08, 2008 3:51 PM
Subject: Re: Bypassing unnecessary transforms by Tuscany databinding framework


Raymond Feng wrote:
+1 on the proposal.

The interceptor could just return the flag based on its capability without asking the next one. And the runtime can query it from the head in the invocation chain and stop when it gets a true.


It could, but that would be making an assumption on the behavior of the interceptor - assuming that it always calls next.invoke(message).

Here's an example showing that:

Message invoke(Message message) {
  // example implementation
  if (someCondition) {
    return next.invoke(message);
  } else {
    // do something else
    return message;
  }
}

Imagining that the next interceptor always returns false, hardwired invocation chain walking logic will return false (incorrect) instead of true.

Without hardwired logic in the core runtime, the interceptor can simply implement allowsPassByReference() like this:

boolean allowsPassByReference() {
  // example implementation
  if (someCondition) {
    return next.allowsPassByReference();
  } else {
    return true;
  }
}

and return the correct value.

In general, I think that more control and hardwired rules in the core runtime (leaving less flexibility to the extensions) eventually cause further complications... when the hardwired rules get in the way and we then have to pile yet another mechanism or rule on top to work around them :)
--
Jean-Sebastien

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to