001    package edu.rice.cs.cunit.record.syncPoints.sync;
002    
003    import edu.rice.cs.cunit.record.graph.LockInfo;
004    import edu.rice.cs.cunit.record.graph.ThreadInfo;
005    import edu.rice.cs.cunit.record.syncPoints.ISyncPointVisitor;
006    import edu.rice.cs.cunit.instrumentors.DoNotInstrument;
007    
008    /**
009     * Synchronization point corresponding to the attempt to enter a synchronized block.
010     *
011     * @author Mathias Ricken
012     */
013    @DoNotInstrument
014    public class SynchronizedTryEnterBlockSyncPoint extends ASynchronizedObjectSyncPoint {
015        /**
016         * Constructor for this synchronization point.
017         * @param object object whose lock is to be acquired.
018         * @param thread thread that acquired the lock
019         */
020        public SynchronizedTryEnterBlockSyncPoint(Object object, Thread thread) {
021            super(object, thread);
022        }
023    
024        /**
025         * Class for translated versions on the monitor side.
026         */
027        public static class Translated extends ASynchronizedObjectSyncPoint.Translated {
028            /**
029             * Constructor for translated version on the monitor side.
030             * @param object info about the object
031             * @param thread info about the thread
032             */
033            public Translated(LockInfo object, ThreadInfo thread) {
034                super(object, thread);
035            }
036    
037            /**
038             * Executes a visitor.
039             *
040             * @param visitor visitor to execute
041             * @param param   visitor-specific parameter
042             *
043             * @return visitor-specific return value
044             */
045            public <R,P> R execute(ISyncPointVisitor<R, P> visitor, P param) {
046                return visitor.synchronizedBlockTryCase(this, param);
047            }
048        }
049    }