-
1. Re: Node locking question
genman Apr 20, 2007 5:48 PM (in response to darose)There used to be a Node.putAll(Map map, boolean erase) method.
The thread safe way (at the moment) is to use a transaction. -
2. Re: Node locking question
darose Apr 20, 2007 5:57 PM (in response to darose)"genman" wrote:
There used to be a Node.putAll(Map map, boolean erase) method.
The thread safe way (at the moment) is to use a transaction.
But ... I thought that transactioning was automatic and completely hidden away from the user. Is that incorrect? If so, how would I go about wrapping a transaction around my calls to clearData() and putAll()? -
-
4. Re: Node locking question
darose Apr 23, 2007 12:26 PM (in response to darose)What about in 2.0 beta? I didn't seem that say passage in the 2.0 documents.
Plus, the doc is a bit vague. Seems like I'm supposed to use one if I'm using the JBoss app server (which I'm not), and use the dummy one if I'm using JBoss cache standalone (which I am) - except that the dummy one is not meant for production use?!?!?!?
I have to say, explicit transactioning seems a bit kludgey here.
Can anyone explain a bit more clearly what it is I'm supposed to do here to over-write a node's data atomically? -
5. Re: Node locking question
genman Apr 23, 2007 6:49 PM (in response to darose)
Although there could easily be an API for handling atomic data clear/put, there is none and will be none for many other similar situations, such as bulk put or bulk remove. So, your best bet is to learn to like transactions.
Manik s. (who often haunts these forums) came up with the documentation.
I would say the DummyTransactionManager is suitable for these sorts of things, so I don't see why it's not production ready. Certainly, it would not be suitable for distributed transaction cases or durable transaction processing. And so the DummyTransactionManager really should be renamed. Maybe it should be called the "MemoryTM" or "NonDurableTM" as it does confuse users.
I'll file an issue to clarify this. -
-
7. Re: Node locking question
darose Apr 23, 2007 8:49 PM (in response to darose)"genman" wrote:
Although there could easily be an API for handling atomic data clear/put, there is none and will be none for many other similar situations, such as bulk put or bulk remove. So, your best bet is to learn to like transactions."genman" wrote:
I would say the DummyTransactionManager is suitable for these sorts of things, so I don't see why it's not production ready. Certainly, it would not be suitable for distributed transaction cases or durable transaction processing. And so the DummyTransactionManager really should be renamed. Maybe it should be called the "MemoryTM" or "NonDurableTM" as it does confuse users.
I'll file an issue to clarify this.
OK, I'll use that, then. Thanks much for the clarification and filing the issue. -
8. Re: Node locking question
brian.stansberry Apr 24, 2007 8:03 AM (in response to darose)The differently named version already exists -- see http://wiki.jboss.org/wiki/Wiki.jsp?page=BatchModeTransactionManager.
DummyTransactionManager is a unit testing tool, and one of the things it does is when you retrieve the singleton instance, it registers itself in JNDI as java:/TransactionManager. Not likely something you want it to do in a production system. -
9. Re: Node locking question
genman Apr 24, 2007 1:49 PM (in response to darose)I forgot about that JNDI bind part. Any reason why unit tests don't use BatchModeTransactionManager instead?
-
10. Re: Node locking question
brian.stansberry Apr 24, 2007 2:34 PM (in response to darose)Probably no good reason; i.e. BatchModeTransactionManager is relatively newer so the habit was to use Dummy.
-
11. Re: Node locking question
darose Apr 24, 2007 11:25 PM (in response to darose)Can someone please confirm:
Would this then the correct usage of BatchModeTransactionManager in the context I mentioned?BatchModeTransactionManager txMgr = BatchModeTransactionManager.getInstance(); txMgr.begin(); child.clearData(); child.putAll(recordVals.getValues()); txMgr.commit();