private void init(int capacity) throws IllegalArgumentException { System.out.println("WaitFreeReadWriteQueue init"); if (capacity <= 0) throw new IllegalArgumentException("maximum cannot be less than or equal to 0"); this.emptySem = new SemHolder(capacity); this.fullSem = new SemHolder(0); this.memArea = ImmortalMemory.instance(); this.theQueue = this.memArea.newObjectArray(capacity + 1); this.queueSize = (capacity + 1); }
/** Return an instance of a DistributedRoundRobinScheduler */ public static DistributedRoundRobinScheduler instance() { if (instance == null) { ImmortalMemory.instance() .enter( new Runnable() { public void run() { instance = new DistributedRoundRobinScheduler(); } }); } return instance; }