@Override public <T> ModelInput<T> openInput( DataDefinition<T> definition, DirectInputFragment fragment, Counter counter) throws IOException, InterruptedException { return core.openInput(definition, fragment, counter); }
private ModelInput<T> prepare() throws IOException { if (fragments.hasNext()) { DirectInputFragment f = fragments.next(); try { return dataSource.openInput(definition, f, counter); } catch (InterruptedException e) { throw (IOException) new InterruptedIOException().initCause(e); } } else { return null; } }
@Override public <T> ModelInput<T> openInput( DataDefinition<T> definition, DirectInputFragment fragment, Counter counter) throws IOException, InterruptedException { ModelInput<T> input = entity.openInput(definition, fragment, counter); return new WrappedModelInput<>(input, heartbeat, counter); }
@Override public boolean readTo(T model) throws IOException { while (true) { if (current == null) { if (iterator.hasNext() == false) { return false; } DirectInputFragment fragment = iterator.next(); try { current = dataSource.openInput(definition, fragment, counter); } catch (InterruptedException e) { throw (IOException) new InterruptedIOException( "interrupted").initCause(e); //$NON-NLS-1$ } } assert current != null; if (current.readTo(model)) { return true; } current.close(); current = null; } }
private <T> ModelInput<T> createInput( TaskAttemptContext context, String containerPath, DataDefinition<T> definition, Counter counter, DirectInputFragment fragment) throws IOException, InterruptedException { assert context != null; assert containerPath != null; assert definition != null; assert counter != null; assert fragment != null; DirectDataSourceRepository repo = getDataSourceRepository(context); DirectDataSource ds = repo.getRelatedDataSource(containerPath); return ds.openInput(definition, fragment, counter); }