[jboss-jira] [JBoss JIRA] Commented: (JBCACHE-1250) Add a Node.clearChildren() functionality

Manik Surtani (JIRA) jira-events at lists.jboss.org
Fri Aug 1 06:08:26 EDT 2008


    [ https://jira.jboss.org/jira/browse/JBCACHE-1250?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12423334#action_12423334 ] 

Manik Surtani commented on JBCACHE-1250:
----------------------------------------

I can see the need for atomicity here, but internally, this would be just as costly as iterating through and loading all children since they would need to be locked for removal.

Also, re: a concurrent insert, this could still happen:

1.  T1 calls cache.getNode("/a/b").clearChildren(), this locks node
2.  if lockParent is false, T2 can still do cache.put("/a/b/newChild") since it won't need to lock /a/b. (MVCC - reads don't block writes)

I think in the end for cases like this you do need to use lockParent. 

> Add a Node.clearChildren() functionality
> ----------------------------------------
>
>                 Key: JBCACHE-1250
>                 URL: https://jira.jboss.org/jira/browse/JBCACHE-1250
>             Project: JBoss Cache
>          Issue Type: Feature Request
>      Security Level: Public(Everyone can see) 
>            Reporter: Brian Stansberry
>            Assignee: Manik Surtani
>             Fix For: 3.0.0.GA
>
>
> For next major API change.
> Equivalent to Node.clearData(), but removes the children.
> Use case is trying to atomically remove everything under some structural node, while leaving the structural node in place. The best that can be done now is either:
> 1) Remove the node and re-add it, but this doesn't work for remote caches with INVALIDATION, since both the removal and the addition propagate as invalidation messages. Remote caches are left w/o the structural node. Plus it's not atomic.
> 2) Query for the children and remove them one by one.  Also not atomic, plus if lockParentForChildInsertRemove is false you have to deal with other threads possibly adding new children while you are removing.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list