Aditya, It looks like your code is crashing when trying to access the private field of the nested class (which involves calling an accessor method). My guess is that atomicRef.get() returns null, and when you attempt to get the reference field of that, you get an NPE.
And the reason your atomic reference returns null is because the following code in the AtomicMarkableReference constructor is wrong: atomicRef = new AtomicReference[ReferenceBooleanPair[V]](); atomicRef.newAtomicReference[ReferenceBooleanPair[V]](refPair); The first line invokes the default constructor for AtomicReference, which is actually a no-op, and sets the stored value to null. The second line invokes the correct *static* factory method, but does not store the result. So, what you actually want is atomicRef = AtomicReference.newAtomicReference[ReferenceBooleanPair[V]](refPair); or, more concisely, atomicRef = AtomicReference.newAtomicReference(refPair); (since the type of refPair is already ReferenceBooleanPair[V]). I don't know if there are other problems in your code, but the above should fix the NPE. Hope this helps, Igor Aditya Sriram M <aditya.mattapar...@iiitb.org> wrote on 02/20/2011 05:40:45 AM: > Hi, > > http://pastebin.com/CwFKvXXJ - Test Pgm and partial SkipList implementation. > http://pastebin.com/V6BimYjx - AtomicMarkableReference. > > I initialize the reference of head and tail to null in the constructor. > 1. nextNode(i) = new AtomicMarkableReference[Node](null, false); > > 2. The guide tells "If the field target is null, a NullPointerException is > thrown". > > Is that causing some issues? But I have to initialize the reference part to > null. > How to solve such issues? > > Regards, > Aditya > > -----Original Message----- > From: Aditya Sriram M [mailto:aditya.mattapar...@iiitb.org] > Sent: Saturday, February 19, 2011 9:48 AM > To: x10-users@lists.sourceforge.net > Subject: [X10-users] Facing issues with our first X10 program > > Hi, > > > > We were able to write some X10 code for SkipList. (as per the logic given in > "The Art of Parallel Processing Programming - section 14.4.2" at > https://softwaretrans.svn.sourceforge.net/svnroot/softwaretrans/BenchMarks/S > kipListBenchMark/) > > > > SkipNodeTest.x10 contains the main() code and contains a couple of two > simple statements: > > a. Make an object of Class LockFreeSkipList > > b. Call add() functionality for the same. > > > > It compiled well. However, while running it, instead of pointing errors in > X10 code (NullPointerException), the IDE points to some java files which it > generated. > > > > Could someone help me out with some leads? > > > > Stack trace: > > x10.lang.NullPointerException: null > at AtomicMarkableReference$ReferenceBooleanPair.access$0(AtomicMarkableReference.java:37) > at AtomicMarkableReference.getReference$G(AtomicMarkableReference.java:109) > at LockFreeSkipList.find_1_$_LockFreeSkipList$Node_$_2_$_LockFreeSkipList$Node_$(LockFreeSkipList.java:443) > at LockFreeSkipList.add(LockFreeSkipList.java:219) > at SkipNodeTest.main(SkipNodeTest.java:39) > at SkipNodeTest$Main.runtimeCallback(SkipNodeTest.java:25) > at x10.runtime.impl.java.Runtime$3.apply(Runtime.java:97) > at x10.lang.Runtime$5.apply(Runtime.java:2236) > at x10.lang.Activity.run(Activity.java:566) > at x10.lang.Runtime$Worker$6.apply(Runtime.java:1154) > at x10.runtime.impl.java.Runtime.runAtLocal(Runtime.java:177) > at x10.lang.Runtime$Worker.loop(Runtime.java:1149) > at x10.lang.Runtime$Worker.apply(Runtime.java:950) > at x10.lang.Runtime$Pool.apply(Runtime.java:1480) > at x10.lang.Runtime.start(Runtime.java:2244) > at x10.runtime.impl.java.Runtime.apply(Runtime.java:75) > at x10.runtime.impl.java.Thread$1.run(Thread.java:35) > at java.lang.Thread.run(Unknown Source) > > > > Thanks and Regards, > > ? Aditya Sriram Mattaparthi, > > . International Institute of Information Technology, Bangalore - 100. -- Igor Peshansky (note the spelling change!) IBM T.J. Watson Research Center X10: Parallel Productivity and Performance (http://x10-lang.org/) XJ: No More Pain for XML's Gain (http://www.research.ibm.com/xj/) "I hear and I forget. I see and I remember. I do and I understand" -- Xun Zi ------------------------------------------------------------------------------ The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE: Pinpoint memory and threading errors before they happen. Find and fix more than 250 security defects in the development cycle. Locate bottlenecks in serial and parallel code that limit performance. http://p.sf.net/sfu/intel-dev2devfeb _______________________________________________ X10-users mailing list X10-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/x10-users