Simon Nash wrote:
Millies, Sebastian wrote:
<snip>
with concurrent requests. Wouldn't it be nice if there were a way
to declare this component as "non-concurrent" (or whatever)
in its configuration file (the composite.xml) instead of having
to change the code to make it threadsafe? The Tuscany runtime would so be made responsible for blocking concurrent access.

-- Sebastian
 >
You should be able to achieve the same effect by declaring all the
methods of the implementation class as synchronized.  I think it's
the responsibility of the implementation to protect itself in this
case, either by thread-safe code or by using synchronized methods.

  Simon

Sebastian,

Simon hits the nail on the head.

When we considered the specification for composite scoped components, we went through exactly these arguments - but it is clear that any Java class can declare synchronization to make itself thread safe - so why invent some other mechanism in SCA which would in effect mimic this behaviour?

The simple implementation style in SCA is the stateless model - there you don't have to even think about synchronization. Once you move over to composite scope, then you're admitting that multiple clients might be calling the code at the same time - in that case you have to deal with the synchronization issues that are implied.


Yours,  Mike.

Reply via email to