As you can probably guess from my recent posts here, I am working with transactions, datasets, and web applications.
In Spring there is this concept of "joining a transaction". Basically it works like this: When calling begin() If a transaction is in progress and is the proper type (Write request must be write, Read request may be Read or Write) use it. if a transaction is in progress and is not the proper type (write request with read transaction in progress) throw an exception if no transaction is in progress start one of the proper type. when calling commit() if we joined the transaction do nothing. if we started the transaction commit it. when calling abort()/rollback() if we joined the transaction throw an exception if we created the transaction abort rollback the transaction. In our special case of end() I think we would do something like commit(). I have a class that handles this by wrapping the real dataset and providing this functionality via thread local variables. usage case is something like: In a web service we have a query and a dataset to query against. We want to stream the results to the client without creating the potentially large file locally. Assume a QueryResult object that comprises the result set from a query and the dataset it was run against. 1. service call comes in to a JAX-RS annotated service 2. service starts a READ transaction. 3. execute the query 4. returns a QueryResult (see above) 5. system uses a @Provider annotated class to format the result as per the request. 6. the transaction.end() is called. As you can see the transaction is started in one object and is logically not complete until the end of an second object. If anyone is interested I'll put the class in the jena-commons. -- I like: Like Like - The likeliest place on the web <http://like-like.xenei.com> LinkedIn: http://www.linkedin.com/in/claudewarren
