Search in sources :

Example 46 with LogPosition

use of com.alibaba.otter.canal.protocol.position.LogPosition in project canal by alibaba.

the class MemoryEventStoreWithBuffer method get.

public Events<Event> get(Position start, int batchSize) throws InterruptedException, CanalStoreException {
    final ReentrantLock lock = this.lock;
    lock.lockInterruptibly();
    try {
        try {
            while (!checkUnGetSlotAt((LogPosition) start, batchSize)) notEmpty.await();
        } catch (InterruptedException ie) {
            // propagate to non-interrupted thread
            notEmpty.signal();
            throw ie;
        }
        return doGet(start, batchSize);
    } finally {
        lock.unlock();
    }
}
Also used : ReentrantLock(java.util.concurrent.locks.ReentrantLock) LogPosition(com.alibaba.otter.canal.protocol.position.LogPosition)

Aggregations

LogPosition (com.alibaba.otter.canal.protocol.position.LogPosition)46 EntryPosition (com.alibaba.otter.canal.protocol.position.EntryPosition)24 List (java.util.List)16 InetSocketAddress (java.net.InetSocketAddress)15 Test (org.junit.Test)15 AbstractLogPositionManager (com.alibaba.otter.canal.parse.index.AbstractLogPositionManager)13 CanalSinkException (com.alibaba.otter.canal.sink.exception.CanalSinkException)12 AbstractCanalEventSinkTest (com.alibaba.otter.canal.parse.stub.AbstractCanalEventSinkTest)11 Entry (com.alibaba.otter.canal.protocol.CanalEntry.Entry)11 AtomicLong (java.util.concurrent.atomic.AtomicLong)10 CanalParseException (com.alibaba.otter.canal.parse.exception.CanalParseException)9 TimeoutChecker (com.alibaba.otter.canal.parse.helper.TimeoutChecker)8 CanalEntry (com.alibaba.otter.canal.protocol.CanalEntry)6 IOException (java.io.IOException)6 ClientIdentity (com.alibaba.otter.canal.protocol.ClientIdentity)5 LogIdentity (com.alibaba.otter.canal.protocol.position.LogIdentity)5 ArrayList (java.util.ArrayList)5 Date (java.util.Date)5 CanalInstance (com.alibaba.otter.canal.instance.core.CanalInstance)4 AuthenticationInfo (com.alibaba.otter.canal.parse.support.AuthenticationInfo)4