MCPcopy
hub / github.com/questdb/questdb / RingQueue

Method RingQueue

core/src/main/java/io/questdb/mp/RingQueue.java:38–58  ·  view source on GitHub ↗
(ObjectFactory<T> factory, int cycle)

Source from the content-addressed store, hash-verified

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) {

Callers

nothing calls this directly

Calls 4

isPow2Method · 0.95
closeMethod · 0.95
callocMethod · 0.95
newInstanceMethod · 0.65

Tested by

no test coverage detected