/** * @return * @throws Exception * @see stream.io.Source#read() */ public Data read() throws Exception { return stream.read(); }
/** * @return * @throws Exception * @see stream.io.Source#read() */ public Data read() throws Exception { return stream.read(); }
protected void readDatabase(Stream stream, Map<String, Data> database) throws Exception { Data item = stream.read(); while (item != null) { Serializable value = item.get(key); if (value == null) { log.error("Missing attribute '{}' in item read from URL: {}", key, item); } else { log.debug("Adding item for key '{}': {}", value, item); database.put(value.toString(), item); } item = stream.read(); } log.info("{} items read from source {}.", database.size(), stream); }
/** * @see stream.io.Source#read() */ @Override public Data read() throws Exception { try { Data item = stream.read(); if (item != null) { idx++; } return item; } catch (Exception e) { log.info("Failed to read item {} from stream {}: {}", idx, stream, e.getMessage()); throw e; } }
protected void readDatabase(Stream stream, Map<String, Data> database) throws Exception { Data item = stream.read(); while (item != null) { Serializable value = item.get(key); if (value == null) { log.error("Missing attribute '{}' in item read from URL: {}", key, item); } else { log.debug("Adding item for key '{}': {}", value, item); database.put(value.toString(), item); } item = stream.read(); } log.info("{} items read from source {}.", database.size(), stream); }
/** * @see stream.io.Stream#read() */ @Override public Data readNext() throws Exception { if (process == null) { init(); } return dataStream.read(); }
/** * @see stream.io.Stream#read() */ @Override public Data readNext() throws Exception { int i = this.choose(); return streams.get(i).read(); } }
/** * @see stream.io.Stream#read() */ @Override public Data readNext() throws Exception { int i = this.choose(); return streams.get(i).read(); } }
/** * @see stream.io.Stream#read() */ @Override public Data readNext() throws Exception { if (process == null) { init(); } return dataStream.read(); }
/** * @see stream.io.Stream#read() */ @Override public Data readNext() throws Exception { int i = this.choose(); return streams.get(i).read(); } }
/** * @see stream.io.Stream#read() */ @Override public Data readNext() throws Exception { if (process == null) { init(); } return dataStream.read(); }
protected void readDatabase(Stream stream, Map<String, Data> database) throws Exception { Data item = stream.read(); while (item != null) { Serializable value = item.get(key); if (value == null) { log.error("Missing attribute '{}' in item read from URL: {}", key, item); } else { log.debug("Adding item for key '{}': {}", value, item); database.put(value.toString(), item); } item = stream.read(); } log.info("{} items read from source {}.", database.size(), stream); }
public void run() { while (true) { try { queue.put(stream.read()); } catch (InterruptedException e) { log.error("Interrupted while reading stream: {}", e.getMessage()); if (log.isDebugEnabled()) e.printStackTrace(); } catch (Exception e) { log.error("Error while reading stream: {}", e.getMessage()); if (log.isDebugEnabled()) e.printStackTrace(); } } }
public void run() { while (true) { try { queue.put(stream.read()); } catch (InterruptedException e) { log.error("Interrupted while reading stream: {}", e.getMessage()); if (log.isDebugEnabled()) e.printStackTrace(); } catch (Exception e) { log.error("Error while reading stream: {}", e.getMessage()); if (log.isDebugEnabled()) e.printStackTrace(); } } }
public void run() { while (run) { try { queue.put(stream.read()); } catch (InterruptedException e) { log.error("Interrupted while reading stream: {}", e.getMessage()); if (log.isDebugEnabled()) e.printStackTrace(); } catch (Exception e) { log.error("Error while reading stream: {}", e.getMessage()); if (log.isDebugEnabled()) e.printStackTrace(); } } }
@Override protected Data readNext(Data item, Map<String, Stream> streams) throws Exception { String nextKey = selectNextStream(); if (nextKey == null) { log.debug("No more streams found for selection!"); return null; } Stream stream = streams.get(nextKey); Data nextItem = stream.read(); if (nextItem == null) { streams.remove(nextKey); additionOrder.remove(nextKey); return readNext(item, streams); } return nextItem; } }
public boolean next(IntWritable id, DataWritable writable) throws IOException { try { id.set(currentId++); Data next = stream.read(); if (next == null) return false; writable.set(next); return true; } catch (Exception e) { e.printStackTrace(); } return false; } }
/** * @see org.apache.hadoop.mapred.RecordReader#next(java.lang.Object, * java.lang.Object) */ public boolean next(Key key, Data value) throws IOException { try { Data item = stream.read(); if (item != null) { value.clear(); value.putAll(item); return true; } else { return false; } } catch (Exception e) { throw new IOException(e); } } }
@Override public Data readNext() throws Exception { Data item = DataFactory.create(); boolean stop = true; for (String id : additionOrder) { Stream s = streams.get(id); Data d = s.read(); if (d != null) { item.putAll(d); stop = false; } } if (stop) return null; return item; }
@Override public Data readNext() throws Exception { Data item = DataFactory.create(); boolean stop = true; for (String id : additionOrder) { Stream s = streams.get(id); Data d = s.read(); if (d != null) { item.putAll(d); stop = false; } } if (stop) return null; return item; }