>From what I understand, you should always synchronize your writes *and* your
reads.

The reasoning behind this is that very rarely is a write an atomic
operation.  As a result, if you read in the middle of a write, you have a
chance of fetching an object in an inconsistent state.

-Cameron


Tom McCallum-4 wrote:
> 
> Hi Everyone,
> 
> Quick question of style really.  I have created an app which has a large  
> amount of interaction between Java and Batik.  I do all my  
> 'setAttributeNS' statements in the updatemanager thread, and  
> 'getAttributeNS' statements outside of this thread.
> 
> Obviously this leads to some situations where the sub-thread with the  
> 'setAttributeNS' statement has not been completely executed at the time of  
> the 'getAttributeNS' statement in the java code.
> 
> I currently can think of two possible solutions:
> 
> Move any code that ever interacts with Batik ( most of my application )  
> into the Batik UpdateManager thread, effectively making everything  
> synchronous - kind of against the whole asynchronous-ness of Batik.
> 
> The only other way I can think is to store the attributes all locally  
> before the 'set' statement gets dispatched and make sure the 'get'  
> statement will retrieve this value and not call 'getAttributeNS', but that  
> seems like a rather silly option to me.
> 
> By the way part of this started because I was merrily setting attributes  
> and the getAttributeNS was returning 'null', and what was happening was  
> the liveAttributeValue table had my latest and correct values in, while  
> the 'attributes' table still had the original basic values in, and the  
> only thing I can think of is that a thread somewhere is causing the  
> listener between the two not to fire - any other suggestions?
> 
> 
> Any thoughts or comments grateful,
> 
> Tom
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Asynchronous-problem-tp15290808p15744409.html
Sent from the Batik - Users mailing list archive at Nabble.com.


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

Reply via email to