private Events<Event> getEvents(CanalEventStore eventStore, Position start, int batchSize, Long timeout,
                                    TimeUnit unit) {
        if (timeout == null) {
            return eventStore.tryGet(start, batchSize);
        } else {
            try {
                if (timeout <= 0) {
                    return eventStore.get(start, batchSize);
                } else {
                    return eventStore.get(start, batchSize, timeout, unit);
                }
            } catch (Exception e) {
                throw new CanalServerException(e);
            }
        }
    }
private Events < Event > getEvents ( CanalEventStore eventStore , Position start , int batchSize , Long timeout , TimeUnit unit ) { if ( timeout == null ) { return eventStore . tryGet ( start , batchSize ) ; } else { try { if ( timeout <= 0 ) { return eventStore . get ( start , batchSize ) ; } else { return eventStore . get ( start , batchSize , timeout , unit ) ; } } catch ( Exception e ) { throw new CanalServerException ( e ) ; } } }
根据不同的参数，选择不同的方式获取数据