Looking at org.drools.common.ConcurrentNodeMemories: What happens if the
rulebase is changed during invocation of resize?
If I understand it well then every node in the rulebase has "slot" in this
class? Can number of nodes in rulebase change while the copying for-cycle is
running? Can in such case BetaMemory end up in place where AlphaMemory was
before? (causing the ClassCastException later).
private void resize( NodeMemory node ) {
try {
this.lock.lock();
if( node.getId() >= this.memories.length() ) {
// adding some buffer for new nodes, so that we reduce array
copies
int size = Math.max( this.rulebase.getNodeCount(),
node.getId() + 32 );
AtomicReferenceArray<Memory> newMem = new
AtomicReferenceArray<Memory>( size );
for ( int i = 0; i < this.memories.length(); i++ ) {
newMem.set( i,
this.memories.get( i ) );
}
this.memories = newMem;
}
} finally {
this.lock.unlock();
}
}
And BTW: this.lock.lock() should be outside of the try block.
--
View this message in context:
http://drools.46999.n3.nabble.com/java-lang-ClassCastException-org-drools...
Sent from the Drools: User forum mailing list archive at
Nabble.com.