You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by Raymond Feng <en...@gmail.com> on 2007/05/12 08:35:15 UTC

Removing WorkContext

Hi,

The WorkContext was defined to carry some context such as the conversation 
id, http session id and callback path over the thread local. And the usages 
are so messy in the code and nobody can really understand how it should be 
used.

As part of the final push for clean SPIs, I propose that we remove the 
WorkContext and work out a better context propagation story.

There are three cases that involves context propagations:

1) For Invokers on the invocation chain, the context should be exposed by 
the Message SPI. We need to add things such as ConverstationID, To and From 
to the Message.

2) For an inbound service, the service binding provider (will be responsible 
for retrieving the context data from the protocol/transport layer and makes 
them available in the Message when it dispatches to the promoted component.

3) Component implementation invokers should be responsible for passing the 
context from the incoming Message to the implementation logic and the proxy 
or invoker for the references. The propagation should be local to the 
component implementation types and we could provide some utilities such as a 
ThreadLocal if it helps.

4) For an outbound reference, the reference binding provider should take the 
context from the Message and marshal them into the protocol/transport layer.

I did the first cut to remove the WorkContext and use ThreadLocal to pass 
the context (used by callback at this moment) and the build is successful 
with all modules, samples and itests.

Thoughts?

If there are no objections, I will check them in ASAP and use it as a base 
for improvement.

Thanks,
Raymond 


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


Re: Removing WorkContext

Posted by Simon Laws <si...@googlemail.com>.
yep - looks good for me too. Thanks all.

Re: Removing WorkContext

Posted by Jean-Sebastien Delfino <js...@apache.org>.
Raymond Feng wrote:
> Hi, Sebastien.
>
> It was the file I missed in the commit. Thank you for fixing it and 
> I'm sorry for the break.
>
> Thanks,
> Raymond
>
> ----- Original Message ----- From: "Jean-Sebastien Delfino" 
> <js...@apache.org>
> To: <tu...@ws.apache.org>
> Sent: Sunday, May 13, 2007 9:28 AM
> Subject: Re: Removing WorkContext
>
>
>> Simon Laws wrote:
>>> I, ahem, invented the missing
>>> org.apache.tuscany.sca.interfacedef.ConversationSequence class
>>>
>>> public class ConversationSequence {
>>>    public static ConversationSequence CONVERSATION_NONE     = null;
>>>    public static ConversationSequence CONVERSATION_START    = new
>>> ConversationSequence();
>>>    public static ConversationSequence CONVERSATION_END      = new
>>> ConversationSequence();
>>>    public static ConversationSequence CONVERSATION_CONTINUE = new
>>> ConversationSequence();
>>> }
>>>
>>> Now getting a prob in JSONrpc binding...
>>>
>>> testJSONRPCBinding(org.apache.tuscany.binding.jsonrpc.JSONRPCServiceTestCase) 
>>>
>>> T
>>> ime elapsed: 5.327 sec  <<< ERROR!
>>> java.util.NoSuchElementException: JSONObject["result"] not found.
>>>        at org.json.JSONObject.get(JSONObject.java:220)
>>>        at org.json.JSONObject.getString(JSONObject.java:363)
>>>        at
>>> org.apache.tuscany.binding.jsonrpc.JSONRPCServiceTestCase.testJSONRPC
>>> Binding(JSONRPCServiceTestCase.java:59)
>>>
>>> Simon
>>>
>>
>> Raymond may just have missed an svn add on this file in his previous 
>> commit. I just committed a ConversationSequence enum.
>>
>> Raymond could you please check that it's equivalent to the one you 
>> intended to commit?
>>
>> -- 
>> Jean-Sebastien
>>
>>

No problem, revision r537614 now builds successfully for me, including 
the JSONRPC binding.

-- 
Jean-Sebastien


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


Re: Removing WorkContext

Posted by Raymond Feng <en...@gmail.com>.
Hi, Sebastien.

It was the file I missed in the commit. Thank you for fixing it and I'm 
sorry for the break.

Thanks,
Raymond

----- Original Message ----- 
From: "Jean-Sebastien Delfino" <js...@apache.org>
To: <tu...@ws.apache.org>
Sent: Sunday, May 13, 2007 9:28 AM
Subject: Re: Removing WorkContext


> Simon Laws wrote:
>> I, ahem, invented the missing
>> org.apache.tuscany.sca.interfacedef.ConversationSequence class
>>
>> public class ConversationSequence {
>>    public static ConversationSequence CONVERSATION_NONE     = null;
>>    public static ConversationSequence CONVERSATION_START    = new
>> ConversationSequence();
>>    public static ConversationSequence CONVERSATION_END      = new
>> ConversationSequence();
>>    public static ConversationSequence CONVERSATION_CONTINUE = new
>> ConversationSequence();
>> }
>>
>> Now getting a prob in JSONrpc binding...
>>
>> testJSONRPCBinding(org.apache.tuscany.binding.jsonrpc.JSONRPCServiceTestCase)
>> T
>> ime elapsed: 5.327 sec  <<< ERROR!
>> java.util.NoSuchElementException: JSONObject["result"] not found.
>>        at org.json.JSONObject.get(JSONObject.java:220)
>>        at org.json.JSONObject.getString(JSONObject.java:363)
>>        at
>> org.apache.tuscany.binding.jsonrpc.JSONRPCServiceTestCase.testJSONRPC
>> Binding(JSONRPCServiceTestCase.java:59)
>>
>> Simon
>>
>
> Raymond may just have missed an svn add on this file in his previous 
> commit. I just committed a ConversationSequence enum.
>
> Raymond could you please check that it's equivalent to the one you 
> intended to commit?
>
> -- 
> Jean-Sebastien
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-dev-help@ws.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


Re: Removing WorkContext

Posted by Jean-Sebastien Delfino <js...@apache.org>.
Simon Laws wrote:
> I, ahem, invented the missing
> org.apache.tuscany.sca.interfacedef.ConversationSequence class
>
> public class ConversationSequence {
>    public static ConversationSequence CONVERSATION_NONE     = null;
>    public static ConversationSequence CONVERSATION_START    = new
> ConversationSequence();
>    public static ConversationSequence CONVERSATION_END      = new
> ConversationSequence();
>    public static ConversationSequence CONVERSATION_CONTINUE = new
> ConversationSequence();
> }
>
> Now getting a prob in JSONrpc binding...
>
> testJSONRPCBinding(org.apache.tuscany.binding.jsonrpc.JSONRPCServiceTestCase) 
>
> T
> ime elapsed: 5.327 sec  <<< ERROR!
> java.util.NoSuchElementException: JSONObject["result"] not found.
>        at org.json.JSONObject.get(JSONObject.java:220)
>        at org.json.JSONObject.getString(JSONObject.java:363)
>        at
> org.apache.tuscany.binding.jsonrpc.JSONRPCServiceTestCase.testJSONRPC
> Binding(JSONRPCServiceTestCase.java:59)
>
> Simon
>

Raymond may just have missed an svn add on this file in his previous 
commit. I just committed a ConversationSequence enum.

Raymond could you please check that it's equivalent to the one you 
intended to commit?

-- 
Jean-Sebastien


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


Re: Removing WorkContext

Posted by Simon Laws <si...@googlemail.com>.
I, ahem, invented the missing
org.apache.tuscany.sca.interfacedef.ConversationSequence class

public class ConversationSequence {
    public static ConversationSequence CONVERSATION_NONE     = null;
    public static ConversationSequence CONVERSATION_START    = new
ConversationSequence();
    public static ConversationSequence CONVERSATION_END      = new
ConversationSequence();
    public static ConversationSequence CONVERSATION_CONTINUE = new
ConversationSequence();
}

Now getting a prob in JSONrpc binding...

testJSONRPCBinding(org.apache.tuscany.binding.jsonrpc.JSONRPCServiceTestCase)
T
ime elapsed: 5.327 sec  <<< ERROR!
java.util.NoSuchElementException: JSONObject["result"] not found.
        at org.json.JSONObject.get(JSONObject.java:220)
        at org.json.JSONObject.getString(JSONObject.java:363)
        at
org.apache.tuscany.binding.jsonrpc.JSONRPCServiceTestCase.testJSONRPC
Binding(JSONRPCServiceTestCase.java:59)

Simon

Re: Removing WorkContext

Posted by ant elder <an...@gmail.com>.
On 5/13/07, Simon Laws <si...@googlemail.com> wrote:
>
> I'm having problems with the latest check in. On a fresh update and mvn
> from
> the top level I get
>
> ---
> [INFO] Building Apache Tuscany Interface Model
> [INFO]    task-segment: [install]
> [INFO]
> -------------------------------------------------------------------------
> ---
> [INFO] artifact org.apache.maven.plugins:maven-resources-plugin: checking
> for up
> dates from apache.incubator
> [INFO] artifact org.apache.maven.plugins:maven-resources-plugin: checking
> for up
> dates from codehaus-snapshot
> [INFO] [resources:resources]
> [INFO] Using default encoding to copy filtered resources.
> [INFO] [compiler:compile]
> [INFO] Compiling 21 source files to
> C:\simon\Projects\Tuscany\java\java-head\sca
> \modules\interface\target\classes
> [INFO]
> ------------------------------------------------------------------------
> [ERROR] BUILD FAILURE
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Compilation failure
>
>
> C:\simon\Projects\Tuscany\java\java-head\sca\modules\interface\src\main\java\org
> \apache\tuscany\sca\interfacedef\Operation.java:[110,4] cannot find symbol
> symbol  : class ConversationSequence
> location: interface org.apache.tuscany.sca.interfacedef.Operation
>
> etc.
>
> It looks like there are a set of files missing as there is a dependency on
>
> org.apache.tuscany.sca.interfacedef.Conversation...
>
> That doesn't appear to be in svn. Be useful to know if it's just me.


Its not just you, i see the same.

   ...ant

Re: Removing WorkContext

Posted by Simon Laws <si...@googlemail.com>.
I'm having problems with the latest check in. On a fresh update and mvn from
the top level I get

---
[INFO] Building Apache Tuscany Interface Model
[INFO]    task-segment: [install]
[INFO]
-------------------------------------------------------------------------
---
[INFO] artifact org.apache.maven.plugins:maven-resources-plugin: checking
for up
dates from apache.incubator
[INFO] artifact org.apache.maven.plugins:maven-resources-plugin: checking
for up
dates from codehaus-snapshot
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:compile]
[INFO] Compiling 21 source files to
C:\simon\Projects\Tuscany\java\java-head\sca
\modules\interface\target\classes
[INFO]
------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO]
------------------------------------------------------------------------
[INFO] Compilation failure

C:\simon\Projects\Tuscany\java\java-head\sca\modules\interface\src\main\java\org
\apache\tuscany\sca\interfacedef\Operation.java:[110,4] cannot find symbol
symbol  : class ConversationSequence
location: interface org.apache.tuscany.sca.interfacedef.Operation

etc.

It looks like there are a set of files missing as there is a dependency on

org.apache.tuscany.sca.interfacedef.Conversation...

That doesn't appear to be in svn. Be useful to know if it's just me.

simon.

Re: Removing WorkContext

Posted by Venkata Krishnan <fo...@gmail.com>.
+1 from me as it seems to be much cleaner to me.

Thanks

- Venkat

On 5/12/07, Raymond Feng <en...@gmail.com> wrote:
>
> Hi,
>
> The WorkContext was defined to carry some context such as the conversation
> id, http session id and callback path over the thread local. And the
> usages
> are so messy in the code and nobody can really understand how it should be
> used.
>
> As part of the final push for clean SPIs, I propose that we remove the
> WorkContext and work out a better context propagation story.
>
> There are three cases that involves context propagations:
>
> 1) For Invokers on the invocation chain, the context should be exposed by
> the Message SPI. We need to add things such as ConverstationID, To and
> From
> to the Message.
>
> 2) For an inbound service, the service binding provider (will be
> responsible
> for retrieving the context data from the protocol/transport layer and
> makes
> them available in the Message when it dispatches to the promoted
> component.
>
> 3) Component implementation invokers should be responsible for passing the
> context from the incoming Message to the implementation logic and the
> proxy
> or invoker for the references. The propagation should be local to the
> component implementation types and we could provide some utilities such as
> a
> ThreadLocal if it helps.
>
> 4) For an outbound reference, the reference binding provider should take
> the
> context from the Message and marshal them into the protocol/transport
> layer.
>
> I did the first cut to remove the WorkContext and use ThreadLocal to pass
> the context (used by callback at this moment) and the build is successful
> with all modules, samples and itests.
>
> Thoughts?
>
> If there are no objections, I will check them in ASAP and use it as a base
> for improvement.
>
> Thanks,
> Raymond
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-dev-help@ws.apache.org
>
>

Re: Removing WorkContext

Posted by Raymond Feng <en...@gmail.com>.
Hi,

The first cut is now in under r537483.

Thanks,
Raymond

----- Original Message ----- 
From: "ant elder" <an...@gmail.com>
To: <tu...@ws.apache.org>
Sent: Saturday, May 12, 2007 12:40 AM
Subject: Re: Removing WorkContext


> Yes +1 from me, that would be really good to get done.
>
>   ...ant
>
> On 5/12/07, Raymond Feng <en...@gmail.com> wrote:
>>
>> Hi,
>>
>> The WorkContext was defined to carry some context such as the 
>> conversation
>> id, http session id and callback path over the thread local. And the
>> usages
>> are so messy in the code and nobody can really understand how it should 
>> be
>> used.
>>
>> As part of the final push for clean SPIs, I propose that we remove the
>> WorkContext and work out a better context propagation story.
>>
>> There are three cases that involves context propagations:
>>
>> 1) For Invokers on the invocation chain, the context should be exposed by
>> the Message SPI. We need to add things such as ConverstationID, To and
>> From
>> to the Message.
>>
>> 2) For an inbound service, the service binding provider (will be
>> responsible
>> for retrieving the context data from the protocol/transport layer and
>> makes
>> them available in the Message when it dispatches to the promoted
>> component.
>>
>> 3) Component implementation invokers should be responsible for passing 
>> the
>> context from the incoming Message to the implementation logic and the
>> proxy
>> or invoker for the references. The propagation should be local to the
>> component implementation types and we could provide some utilities such 
>> as
>> a
>> ThreadLocal if it helps.
>>
>> 4) For an outbound reference, the reference binding provider should take
>> the
>> context from the Message and marshal them into the protocol/transport
>> layer.
>>
>> I did the first cut to remove the WorkContext and use ThreadLocal to pass
>> the context (used by callback at this moment) and the build is successful
>> with all modules, samples and itests.
>>
>> Thoughts?
>>
>> If there are no objections, I will check them in ASAP and use it as a 
>> base
>> for improvement.
>>
>> Thanks,
>> Raymond
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
>> For additional commands, e-mail: tuscany-dev-help@ws.apache.org
>>
>>
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


Re: Removing WorkContext

Posted by ant elder <an...@gmail.com>.
Yes +1 from me, that would be really good to get done.

   ...ant

On 5/12/07, Raymond Feng <en...@gmail.com> wrote:
>
> Hi,
>
> The WorkContext was defined to carry some context such as the conversation
> id, http session id and callback path over the thread local. And the
> usages
> are so messy in the code and nobody can really understand how it should be
> used.
>
> As part of the final push for clean SPIs, I propose that we remove the
> WorkContext and work out a better context propagation story.
>
> There are three cases that involves context propagations:
>
> 1) For Invokers on the invocation chain, the context should be exposed by
> the Message SPI. We need to add things such as ConverstationID, To and
> From
> to the Message.
>
> 2) For an inbound service, the service binding provider (will be
> responsible
> for retrieving the context data from the protocol/transport layer and
> makes
> them available in the Message when it dispatches to the promoted
> component.
>
> 3) Component implementation invokers should be responsible for passing the
> context from the incoming Message to the implementation logic and the
> proxy
> or invoker for the references. The propagation should be local to the
> component implementation types and we could provide some utilities such as
> a
> ThreadLocal if it helps.
>
> 4) For an outbound reference, the reference binding provider should take
> the
> context from the Message and marshal them into the protocol/transport
> layer.
>
> I did the first cut to remove the WorkContext and use ThreadLocal to pass
> the context (used by callback at this moment) and the build is successful
> with all modules, samples and itests.
>
> Thoughts?
>
> If there are no objections, I will check them in ASAP and use it as a base
> for improvement.
>
> Thanks,
> Raymond
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-dev-help@ws.apache.org
>
>