@Test public void testAsyncWritesToBuffer() { GlobalState.BINARY_QUEUE.clear(); Buffer buffer = (Buffer) store; int count = TestData.getScaleCount(); for (int i = 0; i < count; ++i) { Write write = null; while (write == null) { write = TestData.getWriteAdd(); } buffer.insert(write, true); } while (GlobalState.BINARY_QUEUE.size() < count) { continue; } Assert.assertEquals(count, GlobalState.BINARY_QUEUE.size()); GlobalState.BINARY_QUEUE.clear(); }
@Override public boolean insert(Write write, boolean sync) { structure.lock(); try { boolean notify = pages.size() == 2 && currentPage.size == 0; currentPage.append(write, sync); if(notify) { synchronized (transportable) { transportable.notify(); } } return true; } catch (CapacityException e) { addPage(); return insert(write, sync); } finally { structure.unlock(); } }
Buffer extends Limbo implements InventoryTracker { @Override public boolean insert(Write write, boolean sync) { structure.lock(); try { boolean notify = pages.size() == 2 && currentPage.size == 0; currentPage.append(write, sync); if(notify) { synchronized (transportable) { transportable.notify(); } } return true; } catch (CapacityException e) { addPage(); return insert(write, sync); } finally { structure.unlock(); } } }
Buffer extends Limbo implements InventoryTracker { @Override public boolean insert(Write write, boolean sync) { structure.lock(); try { boolean notify = pages.size() == 2 && currentPage.size == 0; currentPage.append(write, sync); if(notify) { synchronized (transportable) { transportable.notify(); } } return true; } catch (CapacityException e) { addPage(); return insert(write, sync); } finally { structure.unlock(); } } Buffer();  Buffer(String directory); }
Buffer extends Limbo implements InventoryTracker { @Override public boolean insert(Write write, boolean sync) { structure.lock(); try { boolean notify = pages.size() == 2 && currentPage.size == 0; currentPage.append(write, sync); if(notify) { synchronized (transportable) { transportable.notify(); } } return true; } catch (CapacityException e) { addPage(); return insert(write, sync); } finally { structure.unlock(); } } Buffer();  Buffer(String directory); static Iterator<Write> onDiskIterator(String location); @Override Map<Long, String> audit(long record); @Override Map<Long, String> audit(String key, long record); @Override Map<TObject, Set<Long>> browse(String key, long timestamp,
            Map<TObject, Set<Long>> context); @Override Map<Long, Set<TObject>> chronologize(String key, long record,
            long start, long end, Map<Long, Set<TObject>> context); @Override boolean contains(long record); @Override Set<String> describe(long record, long timestamp,
            Map<String, Set<TObject>> context); String dump(); @Override Map<Long, Set<TObject>> explore(Map<Long, Set<TObject>> context,
            long timestamp, String key, Operator operator, TObject... values); @Override Set<Long> getAllRecords(); @Restricted String getBackingStore(); @Override int getDesiredTransportSleepTimeInMs(); @Override Inventory getInventory(); @Restricted long getTimeOfLastTransport(); @Override boolean insert(Write write, boolean sync); @Override Iterator<Write> iterator(); @Override Map<String, Set<TObject>> select(long record, long timestamp,
            Map<String, Set<TObject>> context); @Override Set<TObject> select(String key, long record, long timestamp,
            Set<TObject> context); void setEnvironment(String environment); @Restricted void setInventory(Inventory inventory); @Restricted void setThreadNamePrefix(String threadNamePrefix); @Override void start(); @Override void stop(); @Override void sync(); @Override void transport(PermanentStore destination, boolean sync); @Override boolean verify(Write write, long timestamp, boolean exists); @Override TernaryTruth verifyFast(Write write, long timestamp); @Override void waitUntilTransportable(); }
Buffer extends Limbo implements InventoryTracker { @Override public boolean insert(Write write, boolean sync) { structure.lock(); try { boolean notify = pages.size() == 2 && currentPage.size == 0; currentPage.append(write, sync); if(notify) { synchronized (transportable) { transportable.notify(); } } return true; } catch (CapacityException e) { addPage(); return insert(write, sync); } finally { structure.unlock(); } } Buffer();  Buffer(String directory); static Iterator<Write> onDiskIterator(String location); @Override Map<Long, String> audit(long record); @Override Map<Long, String> audit(String key, long record); @Override Map<TObject, Set<Long>> browse(String key, long timestamp,
            Map<TObject, Set<Long>> context); @Override Map<Long, Set<TObject>> chronologize(String key, long record,
            long start, long end, Map<Long, Set<TObject>> context); @Override boolean contains(long record); @Override Set<String> describe(long record, long timestamp,
            Map<String, Set<TObject>> context); String dump(); @Override Map<Long, Set<TObject>> explore(Map<Long, Set<TObject>> context,
            long timestamp, String key, Operator operator, TObject... values); @Override Set<Long> getAllRecords(); @Restricted String getBackingStore(); @Override int getDesiredTransportSleepTimeInMs(); @Override Inventory getInventory(); @Restricted long getTimeOfLastTransport(); @Override boolean insert(Write write, boolean sync); @Override Iterator<Write> iterator(); @Override Map<String, Set<TObject>> select(long record, long timestamp,
            Map<String, Set<TObject>> context); @Override Set<TObject> select(String key, long record, long timestamp,
            Set<TObject> context); void setEnvironment(String environment); @Restricted void setInventory(Inventory inventory); @Restricted void setThreadNamePrefix(String threadNamePrefix); @Override void start(); @Override void stop(); @Override void sync(); @Override void transport(PermanentStore destination, boolean sync); @Override boolean verify(Write write, long timestamp, boolean exists); @Override TernaryTruth verifyFast(Write write, long timestamp); @Override void waitUntilTransportable();  }