You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by Greg Dritschler <gr...@gmail.com> on 2008/03/18 20:22:06 UTC

Removing definitions

Hi.  I have noticed that there doesn't seem to be a way to remove
definitions (policy sets etc) from the domain.  The specs don't explicitly
say how this would happen, but surely this can't be a one-way process (you
can add but can't delete).  I can only guess that if definitions are added
as part of a contribution, then those definitions should be removed when the
contribution is removed?  There are some interesting issues, like what if
there are other contributions using elements of those definitions.

As an aside, I've noticed that SCADefinitionsImpl doesn't synchronize the
lists of policy sets, intents, etc. that it keeps, so it is exposed to bad
things happening if multiple threads try to add definitions at the same
time.  SCADefinitionsUtil also does clear/addAll operations that need to be
made thread-safe.

Greg

Re: Removing definitions

Posted by Simon Laws <si...@googlemail.com>.
On Mon, Mar 31, 2008 at 1:13 PM, Venkata Krishnan <fo...@gmail.com>
wrote:

> Hi Ramkumar,
>
> Welcome to Tuscany!  Yes, this is a good simple start.  Please go ahead
> and
> create a JIRA for this.  Also would like to see you discuss the
> alternatives
> you have in mind for this.
>
> Thanks
>
> - Venkat
>
>
> On Mon, Mar 31, 2008 at 3:58 PM, Ramkumar R <ra...@gmail.com> wrote:
>
> > On 3/27/08, Greg Dritschler <gr...@gmail.com> wrote:
> > >
> > > >
> > > > I'm not sure I'm getting the multi-threading thing, could you say a
> > bit
> > > > more about it?
> > > >
> > > > --
> > > > Jean-Sebastien
> > > >  <tu...@ws.apache.org>
> > > >
> > >
> > > Thread 1 and thread 2 call ContributionService.contribute.  Each
> > > contribution contains a defintions.xml file so both threads try to add
> > > policy sets etc.  Since SCADefinitions uses unsynchronized ArrayLists
> > this
> > > is exposed to failure.  SCADefinitionsUtil also has some code that
> isn't
> > > thread safe.
> > >
> > > Greg
> > >
> >
> > Hi, I am new to Tuscany Community and trying to catch up.  Right now
> > am going through the code to get a feel of it and this threading issue
> > seems
> > to something simple that I can fix to try a hand with Tuscany.  Can I
> > create
> > a JIRA for the threading issue alone and attach a patch ?
> >
> > --
> > Thanks & Regards,
> > Ramkumar Ramalingam
> >
>

I want to comment again on the original subject that started this thread and
which is recorded in the associated JIRA (
https://issues.apache.org/jira/browse/TUSCANY-2172), i.e. removing
definitions when contributions are removed. Two approaches for managing
contributions in a domain come to mind.

1. Keep a cache of contributions up to date w.r.t additions and deletions
and create a stream of events to modify the live runtimes as the cache
changes in terms of available composites, definitions etc.
2. Keep a cache of contributions up to date w.r.t additions and deletions
and restart the live runtimes when anything in the cache changes.
Calculating from scratch all the policies, reference/service relationships
etc.

While we did think about contribution removal operations in the old
domain/node implementation they didn't really get bottomed out as it started
to get complicated (approach 1) this was replaced with the workspace
(approach 2) so we aren't really dealing with the case where things get
removed. We simply treat the resulting domain as if it were a new domain and
recalculate everything.

Does this help at all?

Regards

Simon

Re: Removing definitions

Posted by Venkata Krishnan <fo...@gmail.com>.
Hi Ramkumar,

Welcome to Tuscany!  Yes, this is a good simple start.  Please go ahead and
create a JIRA for this.  Also would like to see you discuss the alternatives
you have in mind for this.

Thanks

- Venkat


On Mon, Mar 31, 2008 at 3:58 PM, Ramkumar R <ra...@gmail.com> wrote:

> On 3/27/08, Greg Dritschler <gr...@gmail.com> wrote:
> >
> > >
> > > I'm not sure I'm getting the multi-threading thing, could you say a
> bit
> > > more about it?
> > >
> > > --
> > > Jean-Sebastien
> > >  <tu...@ws.apache.org>
> > >
> >
> > Thread 1 and thread 2 call ContributionService.contribute.  Each
> > contribution contains a defintions.xml file so both threads try to add
> > policy sets etc.  Since SCADefinitions uses unsynchronized ArrayLists
> this
> > is exposed to failure.  SCADefinitionsUtil also has some code that isn't
> > thread safe.
> >
> > Greg
> >
>
> Hi, I am new to Tuscany Community and trying to catch up.  Right now
> am going through the code to get a feel of it and this threading issue
> seems
> to something simple that I can fix to try a hand with Tuscany.  Can I
> create
> a JIRA for the threading issue alone and attach a patch ?
>
> --
> Thanks & Regards,
> Ramkumar Ramalingam
>

Re: Removing definitions

Posted by Ramkumar R <ra...@gmail.com>.
On 3/27/08, Greg Dritschler <gr...@gmail.com> wrote:
>
> >
> > I'm not sure I'm getting the multi-threading thing, could you say a bit
> > more about it?
> >
> > --
> > Jean-Sebastien
> >  <tu...@ws.apache.org>
> >
>
> Thread 1 and thread 2 call ContributionService.contribute.  Each
> contribution contains a defintions.xml file so both threads try to add
> policy sets etc.  Since SCADefinitions uses unsynchronized ArrayLists this
> is exposed to failure.  SCADefinitionsUtil also has some code that isn't
> thread safe.
>
> Greg
>

Hi, I am new to Tuscany Community and trying to catch up.  Right now
am going through the code to get a feel of it and this threading issue seems
to something simple that I can fix to try a hand with Tuscany.  Can I create
a JIRA for the threading issue alone and attach a patch ?

-- 
Thanks & Regards,
Ramkumar Ramalingam

Re: Removing definitions

Posted by Greg Dritschler <gr...@gmail.com>.
>
> I'm not sure I'm getting the multi-threading thing, could you say a bit
> more about it?
>
> --
> Jean-Sebastien
>  <tu...@ws.apache.org>
>

Thread 1 and thread 2 call ContributionService.contribute.  Each
contribution contains a defintions.xml file so both threads try to add
policy sets etc.  Since SCADefinitions uses unsynchronized ArrayLists this
is exposed to failure.  SCADefinitionsUtil also has some code that isn't
thread safe.

Greg

Re: Removing definitions

Posted by Jean-Sebastien Delfino <js...@apache.org>.
Mike Edwards wrote:
> Greg Dritschler wrote:
>> Hi.  I have noticed that there doesn't seem to be a way to remove
>> definitions (policy sets etc) from the domain.  The specs don't 
>> explicitly
>> say how this would happen, but surely this can't be a one-way process 
>> (you
>> can add but can't delete).  I can only guess that if definitions are 
>> added
>> as part of a contribution, then those definitions should be removed 
>> when the
>> contribution is removed?  There are some interesting issues, like what if
>> there are other contributions using elements of those definitions.
>>
>> As an aside, I've noticed that SCADefinitionsImpl doesn't synchronize the
>> lists of policy sets, intents, etc. that it keeps, so it is exposed to 
>> bad
>> things happening if multiple threads try to add definitions at the same
>> time.  SCADefinitionsUtil also does clear/addAll operations that need 
>> to be
>> made thread-safe.
>>
>> Greg
>>
> 
> Greg,
> 
> Artifacts arrive in the domain through Contributions being added to the 
> domain.  Those same contributions can be removed from the domain - and 
> this causes the artifacts in the contribution to be removed from the 
> domain.
> 
> This applies to definitions as much as it applies to composites or to 
> Java class files.  It might be wise to keep some forms of definition 
> separate from contributions containing executable code, so that Policy 
> Sets can be changed without the need to redeploy all the contributions 
> in the domain, for example.

Or make deployment of contributions really seamless... For example a 
contribution can be a directory that the domain points to, that 
directory can contain a definitions.xml file, and we shouldn't require a 
special deployment step to tell the code that reads that definitions.xml 
    file that it has changed.

The good news is that it's how it works in Tuscany at the moment :)

The process for updating a policySet is as follows:

1. notepad c:/a-contribution/definitions.xml
2. make changes
3. save
4. restart the nodes
5. they'll get the new updated stuff

> That's how it looks from the SCA spec point of view.
> 
> You make a good point about the SCADefinitionsImpl - sounds like some 
> changes are needed there to handle multi threading.
> 

I'm not sure I'm getting the multi-threading thing, could you say a bit 
more about it?

-- 
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 definitions

Posted by Mike Edwards <mi...@gmail.com>.
Greg Dritschler wrote:
> Hi.  I have noticed that there doesn't seem to be a way to remove
> definitions (policy sets etc) from the domain.  The specs don't explicitly
> say how this would happen, but surely this can't be a one-way process (you
> can add but can't delete).  I can only guess that if definitions are added
> as part of a contribution, then those definitions should be removed when the
> contribution is removed?  There are some interesting issues, like what if
> there are other contributions using elements of those definitions.
> 
> As an aside, I've noticed that SCADefinitionsImpl doesn't synchronize the
> lists of policy sets, intents, etc. that it keeps, so it is exposed to bad
> things happening if multiple threads try to add definitions at the same
> time.  SCADefinitionsUtil also does clear/addAll operations that need to be
> made thread-safe.
> 
> Greg
> 

Greg,

Artifacts arrive in the domain through Contributions being added to the 
domain.  Those same contributions can be removed from the domain - and 
this causes the artifacts in the contribution to be removed from the domain.

This applies to definitions as much as it applies to composites or to 
Java class files.  It might be wise to keep some forms of definition 
separate from contributions containing executable code, so that Policy 
Sets can be changed without the need to redeploy all the contributions 
in the domain, for example.

That's how it looks from the SCA spec point of view.

You make a good point about the SCADefinitionsImpl - sounds like some 
changes are needed there to handle multi threading.


Yours,  Mike.

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