Search in sources :

Example 1 with JournalDeltaProducer

use of com.questdb.net.ha.producer.JournalDeltaProducer in project questdb by bluestreak01.

the class AbstractJournalTest method setUp.

@Before
public void setUp() throws Exception {
    origin = getFactory().writer(Quote.class, "origin");
    slave = getFactory().writer(Quote.class, "slave");
    master = getFactory().writer(Quote.class, "master");
    journalClientStateProducer = new JournalClientStateProducer();
    journalClientStateConsumer = new JournalClientStateConsumer();
    this.masterReader = getFactory().reader(Quote.class, "master");
    journalDeltaProducer = new JournalDeltaProducer(masterReader);
    journalDeltaConsumer = new JournalDeltaConsumer(slave);
    channel = new MockByteChannel();
}
Also used : Quote(com.questdb.model.Quote) JournalClientStateProducer(com.questdb.net.ha.producer.JournalClientStateProducer) JournalDeltaProducer(com.questdb.net.ha.producer.JournalDeltaProducer) JournalDeltaConsumer(com.questdb.net.ha.comsumer.JournalDeltaConsumer) JournalClientStateConsumer(com.questdb.net.ha.comsumer.JournalClientStateConsumer) Before(org.junit.Before)

Example 2 with JournalDeltaProducer

use of com.questdb.net.ha.producer.JournalDeltaProducer in project questdb by bluestreak01.

the class JournalServerAgent method createReader.

private <T> void createReader(int index, JournalKey<T> key) throws JournalException {
    Journal journal = readers.getQuiet(index);
    if (journal == null) {
        readers.extendAndSet(index, journal = server.getFactory().reader(key));
    }
    JournalDeltaProducer producer = producers.getQuiet(index);
    if (producer == null) {
        producers.extendAndSet(index, new JournalDeltaProducer(journal));
    }
}
Also used : JournalDeltaProducer(com.questdb.net.ha.producer.JournalDeltaProducer) Journal(com.questdb.store.Journal)

Example 3 with JournalDeltaProducer

use of com.questdb.net.ha.producer.JournalDeltaProducer in project questdb by bluestreak01.

the class JournalServerAgent method removeReader.

private void removeReader(int index) {
    Journal journal = readers.getQuiet(index);
    if (journal != null) {
        journal.close();
        if (index < readers.size()) {
            readers.setQuick(index, null);
        }
    }
    JournalDeltaProducer producer = producers.getQuiet(index);
    if (producer != null) {
        producer.free();
        if (index < producers.size()) {
            producers.setQuick(index, null);
        }
    }
}
Also used : JournalDeltaProducer(com.questdb.net.ha.producer.JournalDeltaProducer) Journal(com.questdb.store.Journal)

Aggregations

JournalDeltaProducer (com.questdb.net.ha.producer.JournalDeltaProducer)3 Journal (com.questdb.store.Journal)2 Quote (com.questdb.model.Quote)1 JournalClientStateConsumer (com.questdb.net.ha.comsumer.JournalClientStateConsumer)1 JournalDeltaConsumer (com.questdb.net.ha.comsumer.JournalDeltaConsumer)1 JournalClientStateProducer (com.questdb.net.ha.producer.JournalClientStateProducer)1 Before (org.junit.Before)1