(ObjectFactory<T> factory, int cycle)
| 36 | private long memorySize; |
| 37 | |
| 38 | @SuppressWarnings("unchecked") |
| 39 | public RingQueue(ObjectFactory<T> factory, int cycle) { |
| 40 | // zero queue is allowed for testing |
| 41 | assert cycle == 0 || Numbers.isPow2(cycle); |
| 42 | try { |
| 43 | this.mask = cycle - 1; |
| 44 | this.buf = (T[]) new Object[cycle]; |
| 45 | |
| 46 | for (int i = 0; i < cycle; i++) { |
| 47 | buf[i] = factory.newInstance(); |
| 48 | } |
| 49 | |
| 50 | // heap based queue |
| 51 | this.memory = 0; |
| 52 | this.memorySize = 0; |
| 53 | this.memoryTag = 0; |
| 54 | } catch (Throwable th) { |
| 55 | close(); |
| 56 | throw th; |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | @SuppressWarnings("unchecked") |
| 61 | public RingQueue(DirectObjectFactory<T> factory, long slotSize, int cycle, int memoryTag) { |
nothing calls this directly
no test coverage detected