Null element in the Vector
roman.mandeleil1 Nov 21, 2009 4:32 PMI am chasing after a strange issue in pojo cache:
There is a Vector that I am using it as a queue
one Thread is pushing things into the tail and
the other poping the head of the Vector.
The Vector is being aspectize with the following
configuration (pojocache-aop.xml):
<?xml version="1.0" encoding="UTF-8"?> <!-- This is a variant of jboss-aop.xml. --> <aop> <!-- If a POJO has a Replicable annotation, it will be asepectized. --> <!-- Supports inheritance and polymorphism. It can either be a concrete class or an interface. All sub-classes or interface implementors will be instrumeneted. --> <prepare expr="field(* $instanceof {@org.jboss.cache.pojo.annotation.Replicable}->*)" /> <!-- Work around that ensures annotated classes which do not access fields are instrumented --> <introduction expr="class($instanceof {@org.jboss.cache.pojo.annotation.Replicable})"/> <!-- Array support --> <!-- Comment entire section to disable --> <arrayreplacement expr="class($instanceof {@org.jboss.cache.pojo.annotation.Replicable})"/> <interceptor name="pojocache-array" class="org.jboss.cache.pojo.interceptors.dynamic.ArrayInterceptor"/> <introduction expr="class($instanceof {@org.jboss.cache.pojo.annotation.Replicable})"> <interfaces>org.jboss.cache.pojo.impl.ArrayInterceptable</interfaces> </introduction> <arraybind name="pojocache-array" type="READ_WRITE"> <interceptor-ref name="pojocache-array"/> </arraybind> </aop>
I have tried different cache configurations, the last one is like this:
Configuration config = new Configuration(); config.setTransactionManagerLookupClass( JBossTransactionManagerLookup.class.getName() ); config.setIsolationLevel(IsolationLevel.SERIALIZABLE); config.setCacheMode(CacheMode.REPL_SYNC); config.setLockAcquisitionTimeout(30000); config.setClusterName("DefaultPartition"); config.setConcurrencyLevel(5000); config.setNodeLockingScheme(NodeLockingScheme.PESSIMISTIC);
The vector is placed inside the pojo cache on JBoss 5.1.0 GA.
And then I see the following problem happens from time to time:
I see null elements apears inside the vector when I have cirtanly
no code that puts it there and by inspecting the logs I see
that it happens when there is concurrent activity on the Vector.
Before I am going to open a bug on it, I would like to know if
there is someone else that has similar expirience and maybe know
about any work around to prevent this behavior.
Regards
Roman