org.amino.utility
Interface IEliminationArray

All Known Implementing Classes:
AdaptEliminationArray, EliminationArray

public interface IEliminationArray

A global elimination array interface.

 A Scalable Lock-free Stack Algorithm
 Danny Hendler                Nir Shavit            Lena Yerushalmi
 School of Computer Science Tel-Aviv University & School of Computer Science
  Tel-Aviv University     Sun Microsystems           Tel-Aviv University
  Tel Aviv, Israel 69978      Laboratories          Tel Aviv, Israel 69978
  hendlerd@post.tau.ac.il    shanir@sun.com          lenay@post.tau.ac.il
 

Author:
Zhi Gan (ganzhi@gmail.com)

Method Summary
 boolean tryAdd(java.lang.Object obj, int backOff)
          Try to add element without touching the central data structure.
 java.lang.Object tryRemove(int backOff)
          Try to remove element without touching central data structure.
 

Method Detail

tryAdd

boolean tryAdd(java.lang.Object obj,
               int backOff)
               throws java.lang.InterruptedException
Try to add element without touching the central data structure. If this operation can successfully locate a removing thread, it will succeed. Else, it will sleep for several milliseconds and waiting to be located by removing threads.

Parameters:
obj - the adding object
backOff - time in millisecond for sleeping if match haven't been found immediately.
Returns:
true if match happened between this method and tryRemove(int)
Throws:
java.lang.InterruptedException - throw exception if interrupted

tryRemove

java.lang.Object tryRemove(int backOff)
                           throws java.lang.InterruptedException
Try to remove element without touching central data structure. If this operation can successfully locate a adding thread, it will succeed. Else, it will sleep for several milliseconds and waiting to be located by adding threads.

Parameters:
backOff - time in millisecond for sleeping if match haven't been found immediately.
Returns:
null if no match. Argument to tryAdd() method if successful match
Throws:
java.lang.InterruptedException - throw exception if be interrupted


Copyright © 2008. All Rights Reserved.