@Override public void init() throws Exception { super.init(); noise = new ColtGaussian(mean, variance, seed); }
@Override public void close() throws Exception { pool.shutdownNow(); super.close(); }
/** * @see stream.io.Stream#read() */ public synchronized Data read() throws Exception { if (closed || (limit > 0 && count >= limit)) return null; Data datum = readNext(); if (datum == null) { log.debug("End-of-stream reached!"); return null; } if (this.id != null) datum.put(SOURCE_KEY, this.id); if (this.sequenceKey != null) { SequenceID next = this.seqId.getAndIncrement(); datum.put(sequenceKey, next); } if (prefix != null && !prefix.trim().isEmpty()) { Data prefixed = DataFactory.create(); for (String key : datum.keySet()) { prefixed.put(prefix + ":" + key, datum.get(key)); } datum = prefixed; } count++; return datum; }
/** * @see stream.io.Stream#read() */ public Data read() throws Exception { if (closed || (limit > 0 && count >= limit)) return null; Data datum = readNext(); if (datum == null) { log.debug("End-of-stream reached!"); return null; } if (this.id != null) datum.put("@stream", this.id); if (this.sequenceKey != null) { SequenceID next = this.seqId.getAndIncrement(); datum.put(sequenceKey, next); } if (prefix != null && !prefix.trim().isEmpty()) { Data prefixed = DataFactory.create(); for (String key : datum.keySet()) { prefixed.put(prefix + ":" + key, datum.get(key)); } datum = prefixed; } count++; return datum; }
/** * @see stream.io.AbstractStream#init() */ @Override public void init() throws Exception { super.init(); this.in = new DataInputStream(getInputStream()); }
/** * @see stream.io.AbstractStream#close() */ @Override public void close() throws Exception { super.close(); process.destroy(); }
/** * @see stream.io.AbstractStream#init() */ @Override public void init() throws Exception { super.init(); this.in = new DataInputStream(getInputStream()); }
/** * @see stream.io.Source#close() */ @Override public void close() throws Exception { if (reader != null) reader.close(); super.close(); }
@Override public void init() throws Exception { super.init(); noise = new ColtGaussian(mean, variance, seed); }
/** * @see stream.io.AbstractStream#close() */ @Override public void close() throws Exception { super.close(); process.destroy(); }
/** * @see stream.io.Stream#init() */ @Override public void init() throws Exception { super.init(); attributes = new LinkedHashMap<String, Class<?>>(); if (encoding != null) reader = new BufferedReader(new InputStreamReader(getInputStream(), encoding)); else reader = new BufferedReader(new InputStreamReader(getInputStream())); }
/** * @see stream.io.Source#close() */ @Override public void close() throws Exception { if (reader != null) reader.close(); super.close(); }
/** * @see stream.io.Stream#init() */ @Override public void init() throws Exception { super.init(); attributes = new LinkedHashMap<String, Class<?>>(); if (encoding != null) reader = new BufferedReader(new InputStreamReader(getInputStream(), encoding)); else reader = new BufferedReader(new InputStreamReader(getInputStream())); }
@Override public void close() throws Exception { pool.shutdownNow(); super.close(); }
@Override public void init() throws Exception { super.init(); if (attributes == null && generators.isEmpty()) { throw new Exception( "Parameter 'attributes' missing! This should be a list of mean,deviation pairs!"); } if (attributes != null) { int cnt = 1; for (int i = 0; i + 1 < attributes.length; i += 2) { setGenerator("x" + cnt, new Gaussian(attributes[i], attributes[i + 1])); cnt++; } } }
@Override public void init() throws Exception { super.init(); if (attributes == null && generators.isEmpty()) { throw new Exception( "Parameter 'attributes' missing! This should be a list of mean,deviation pairs!"); } if (attributes != null) { int cnt = 1; for (int i = 0; i + 1 < attributes.length; i += 2) { setGenerator("x" + cnt, new Gaussian(attributes[i], attributes[i + 1])); cnt++; } } }
/** * @see stream.io.AbstractStream#init() */ @Override public void init() throws Exception { super.init(); for (String path : paths) { for (String probe : vmStats) { File f = new File(path + File.separator + probe); if (f.canExecute()) { vmstat = f; break; } } if (vmstat != null) break; } if (vmstat == null) { throw new Exception("Failed to locate vm_stat/vmstat utility!"); } String cmd = vmstat.getAbsolutePath(); Integer time = Math.max(1, interval.asSeconds().intValue()); process = Runtime.getRuntime().exec( new String[] { cmd, time.toString() }); reader = new BufferedReader(new InputStreamReader( process.getInputStream())); }
/** * @see stream.io.AbstractStream#init() */ @Override public void init() throws Exception { super.init(); for (String path : paths) { for (String probe : vmStats) { File f = new File(path + File.separator + probe); if (f.canExecute()) { vmstat = f; break; } } if (vmstat != null) break; } if (vmstat == null) { throw new Exception("Failed to locate vm_stat/vmstat utility!"); } String cmd = vmstat.getAbsolutePath(); Integer time = Math.max(1, interval.asSeconds().intValue()); process = Runtime.getRuntime().exec( new String[] { cmd, time.toString() }); reader = new BufferedReader(new InputStreamReader( process.getInputStream())); }