jmcnally 02/05/06 12:01:52
Modified: src/java/org/apache/jcs/access GroupCacheAccess.java
Log:
removing keys from the group when appropriate.
Revision Changes Path
1.5 +20 -21
jakarta-turbine-jcs/src/java/org/apache/jcs/access/GroupCacheAccess.java
Index: GroupCacheAccess.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-jcs/src/java/org/apache/jcs/access/GroupCacheAccess.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- GroupCacheAccess.java 30 Apr 2002 04:15:29 -0000 1.4
+++ GroupCacheAccess.java 6 May 2002 19:01:52 -0000 1.5
@@ -164,7 +164,6 @@
{
ICacheElement element
= cacheControl.get( new GroupAttrName( group, name ) );
-
return ( element != null ) ? element.getVal() : null;
}
@@ -326,7 +325,7 @@
}
// unbind object first if any.
- removeAttribute( name, groupName, SET_ATTR_INVOCATION );
+ boolean isPreviousObj = removeAttribute( name, groupName, false);
if (attr == null)
{
@@ -336,37 +335,37 @@
{
put( new GroupAttrName(groupName, name), value, attr );
}
- group.add(name);
+
+ if (!isPreviousObj)
+ {
+ group.add(name);
+ }
}
/** Description of the Method */
public void removeAttribute( Object name, String group )
{
- removeAttribute( name, group, REMOVE_ATTR_INVOCATION );
+ removeAttribute( name, group, true );
}
/** Description of the Method */
- private void removeAttribute( Object name, String group, boolean invocation )
+ private boolean removeAttribute( Object name, String groupName,
+ boolean removeFromGroup )
{
- GroupAttrName key = new GroupAttrName( group, name );
- // Needs to retrive the attribute so as to do object unbinding, if
necessary.
- Serializable val = null;
- //try {
- val = cacheControl.get( key );
- //} catch( ObjectNotFoundException onfe ) {
- // return;
- //}
-
- if ( val == null )
+ GroupAttrName key = new GroupAttrName( groupName, name );
+ // Needs to retrieve the attribute so as to do object unbinding,
+ // if necessary.
+ boolean isPreviousObj = cacheControl.get(key) != null;
+ if (isPreviousObj)
{
- return;
+ cacheControl.remove(key);
}
- if ( invocation == REMOVE_ATTR_INVOCATION )
+ if (removeFromGroup)
{
- // remove attribute - name set taken care of by the session cache.
- cacheControl.remove( key );
+ Set group = getAttributeNameSet(groupName);
+ group.remove(name);
}
- return;
+ return isPreviousObj;
}
/**
@@ -398,7 +397,7 @@
int arS = ar.length;
for ( int i = 0; i < arS; i++ )
{
- removeAttribute( ar[ i ], group );
+ removeAttribute( ar[i], group, false );
}
// get into concurrent modificaiton problems here.
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>