[
https://issues.apache.org/jira/browse/JCR-1271?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12551834
]
Ard Schrijvers commented on JCR-1271:
-------------------------------------
Wouldn't be enough to replace
public ItemStateReferenceMap() {
super(new ReferenceMap(ReferenceMap.HARD, ReferenceMap.WEAK));
}
with
public ItemStateReferenceMap() {
super(Collections.synchronizedMap(new ReferenceMap(ReferenceMap.HARD,
ReferenceMap.WEAK)));
}
and only make those parts synchronized on the map where we iterate over some
collection of the map? I must be missing something :-)
http://java.sun.com/j2se/1.4.2/docs/api/java/util/Collections.html#synchronizedMap(java.util.Map)
> NullPointerException when iterating over properties
> ---------------------------------------------------
>
> Key: JCR-1271
> URL: https://issues.apache.org/jira/browse/JCR-1271
> Project: Jackrabbit
> Issue Type: Bug
> Components: jackrabbit-core
> Reporter: Marcel Reutegger
> Priority: Minor
> Attachments: JCR-1271.patch, JCR-1271.patch
>
>
> Running ConcurrentReadWriteTest (NUM_NODES=5, NUM_THREADS=3,
> RUN_NUM_SECONDS=120) resulted in a NullPointerException:
> Exception in thread "Thread-11" java.lang.NullPointerException
> at
> org.apache.commons.collections.map.AbstractReferenceMap$ReferenceEntry.getValue(AbstractReferenceMap.java:596)
> at
> org.apache.commons.collections.map.AbstractReferenceMap.containsKey(AbstractReferenceMap.java:204)
> at
> org.apache.jackrabbit.core.state.ItemStateMap.contains(ItemStateMap.java:66)
> at
> org.apache.jackrabbit.core.state.ItemStateReferenceCache.isCached(ItemStateReferenceCache.java:91)
> at
> org.apache.jackrabbit.core.state.LocalItemStateManager.hasItemState(LocalItemStateManager.java:173)
> at
> org.apache.jackrabbit.core.state.XAItemStateManager.hasItemState(XAItemStateManager.java:252)
> at
> org.apache.jackrabbit.core.state.SessionItemStateManager.getItemState(SessionItemStateManager.java:174)
> at
> org.apache.jackrabbit.core.ItemManager.createItemInstance(ItemManager.java:495)
> at org.apache.jackrabbit.core.ItemManager.getItem(ItemManager.java:326)
> at
> org.apache.jackrabbit.core.LazyItemIterator.prefetchNext(LazyItemIterator.java:90)
> at
> org.apache.jackrabbit.core.LazyItemIterator.next(LazyItemIterator.java:203)
> at
> org.apache.jackrabbit.core.LazyItemIterator.nextProperty(LazyItemIterator.java:118)
> at
> org.apache.jackrabbit.core.ConcurrentReadWriteTest$1$1.execute(ConcurrentReadWriteTest.java:64)
> at
> org.apache.jackrabbit.core.AbstractConcurrencyTest$Executor.run(AbstractConcurrencyTest.java:110)
> at java.lang.Thread.run(Thread.java:619)
> The cache is not synchronized and is accessed at the same time by the current
> thread and another thread that notified ItemStates about changes.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.