So if I understand correctly, we need to make sure that any parameters
that are passed through the boundary of River code (e.g. anything that
implements JavaSpace05) need to be marked volatile (can you do that on
parameters) or stored to a volatile variable.  Or there needs to be a
synchronized block that reads the queues.  That sounds moderately
doable.  Is the volatility transitive?  i.e. If I make sure that an
Entry is part of a "happens-before" event, are the fields on the objects
referenced by that entry also published?

Personally, synchronized is the only thing I've ever trusted.  When I
see things like shared, non-synchronized variables, I think "There be
dragons here".  Is there a lot of that in the codebase?

Cheers,

Greg.


On Tue, 2013-06-11 at 08:45, Peter wrote:
> Ok, so we need to make sure we safely publish an Entry to a volatile field 
> after modifications or make an Entry's fields volatile.
> 
> Did you know that JERI uses a multiplexing thread pool core?
> 
> Even when our code appears to be single threaded, once it's exported, it 
> becomes visible to many threads.
> 
> To avoid potential deadlock from dependant tasks executing out of order JERI 
> always creates a new thread if no free threads are available in its internal 
> thread pool.
> 
> Regards,
> 
> Peter.
> 
> ----- Original message -----
> >
> > On Tue, 2013-06-11 at 08:23, Peter wrote:
> > > I've been thinking about how Entry objects are immutable in serialized 
> > > form
> > > and of course how they are not in unserialized form.
> > >
> > > Should Entry fields be final by default?
> > >
> >
> > No.  Javaspaces usage is frequently to take an entry, modify it and then
> > put it back into the space.
> >
> > Greg.
> >
> > > The JMM makes an exception for Serialization, allowing final fields to be
> > > frozen after construction during deserialization, provided it occurs 
> > > before
> > > sharing with other threads. It would allow Entry's to be shared safely 
> > > among
> > > threads, as long as their public fields aren't mutable, eg: an array.
> > >
> > > Regards,
> > >
> > > Peter.
> >
> 

Reply via email to