[Logo] Terracotta Discussion Forums
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
[Expert]
excluding methods from wildcard locks  XML
Forum Index -> Terracotta Platform
Author Message
fanguad

journeyman

Joined: 08/26/2008 06:06:46
Messages: 21
Offline

I have a large set of not-quite-POJOs that I'd like to use terracotta on. In general, I'm going to need locks on all the set* methods, but there are a few exceptions (why they are not-quite-POJOs). Is there any way to specify that I want locks on all set* methods, except for those I explicitly name?
jgalang

master

Joined: 05/24/2006 15:08:59
Messages: 54
Offline

You can use expressions to specify which fields/methods to lock.
See here: http://rubyurl.com/Y1Bp


Want to post to this forum? Please join the Terracotta community: >Sign up

fanguad

journeyman

Joined: 08/26/2008 06:06:46
Messages: 21
Offline

Thanks for the reply, but I was looking for a way to exclude, rather than include.

For example:
I have 100 POJOs in package com.example, each having several setter methods. I want to have autolocks on all but a few of those methods.

It's easy enough to get them all:
* com.example..set*(..)

But if I want to exclude just a few, do I have set up dozens of patterns of the form "* com.example.ClassName.set*(..)"? or can I add something to the catch-all above?
jgalang

master

Joined: 05/24/2006 15:08:59
Messages: 54
Offline

Sorry I misunderstood. Currently there is no way to have something like:

<locks>
<method-expression>...</method-expression>
<excludes>
<exclude>...</exclude>
</excludes>
</locks>

Would it be possible for you to refactor and rename those methods you wish to exclude from locking?


Want to post to this forum? Please join the Terracotta community: >Sign up

jgalang

master

Joined: 05/24/2006 15:08:59
Messages: 54
Offline

I created a feature request JIRA for this:
https://jira.terracotta.org/jira/browse/CDV-884


Want to post to this forum? Please join the Terracotta community: >Sign up

fanguad

journeyman

Joined: 08/26/2008 06:06:46
Messages: 21
Offline

I can work around it, I was just wondering if it could be done. Refactoring probably isn't an option.
 
Forum Index -> Terracotta Platform
Go to:   
Powered by JForum 2.1.7 © JForum Team