@SuppressWarnings("unchecked") private boolean readFromQueue() throws IOException, InterruptedException { KeyValuePair<KEYIN, VALUEIN> kv = null; // wait for input on queue kv = inputQueue.dequeue(); if (kv.endOfInput) { return false; } key = (KEYIN) ReflectionUtils.newInstance(keyClass, conf); value = (VALUEIN) ReflectionUtils.newInstance(valueClass, conf); ReflectionUtils.copy(conf, kv.key, this.key); ReflectionUtils.copy(conf, kv.value, this.value); return true; }
@SuppressWarnings("unchecked") private void writeToQueue(KEYOUT key, VALUEOUT value) throws IOException, InterruptedException { this.keyout = (KEYOUT) ReflectionUtils.newInstance(keyClass, conf); this.valueout = (VALUEOUT) ReflectionUtils.newInstance(valueClass, conf); ReflectionUtils.copy(conf, key, this.keyout); ReflectionUtils.copy(conf, value, this.valueout); // wait to write output to queuue outputQueue.enqueue(new KeyValuePair<KEYOUT, VALUEOUT>(keyout, valueout)); }
private synchronized void interruptAllThreads() { for (Thread th : threads) { th.interrupt(); } for (ChainBlockingQueue<?> queue : blockingQueues) { queue.interrupt(); } }
@SuppressWarnings("unchecked") private boolean readFromQueue() throws IOException, InterruptedException { KeyValuePair<KEYIN, VALUEIN> kv = null; // wait for input on queue kv = inputQueue.dequeue(); if (kv.endOfInput) { return false; } key = (KEYIN) ReflectionUtils.newInstance(keyClass, conf); value = (VALUEIN) ReflectionUtils.newInstance(valueClass, conf); ReflectionUtils.copy(conf, kv.key, this.key); ReflectionUtils.copy(conf, kv.value, this.value); return true; }
/** * Close this <code>RecordWriter</code> to future operations. * * @param context * the context of the task * @throws IOException */ public void close(TaskAttemptContext context) throws IOException, InterruptedException { if (outputQueue != null) { // write end of input outputQueue.enqueue(new KeyValuePair<KEYOUT, VALUEOUT>(true)); } }
@SuppressWarnings("unchecked") private boolean readFromQueue() throws IOException, InterruptedException { KeyValuePair<KEYIN, VALUEIN> kv = null; // wait for input on queue kv = inputQueue.dequeue(); if (kv.endOfInput) { return false; } key = (KEYIN) ReflectionUtils.newInstance(keyClass, conf); value = (VALUEIN) ReflectionUtils.newInstance(valueClass, conf); ReflectionUtils.copy(conf, kv.key, this.key); ReflectionUtils.copy(conf, kv.value, this.value); return true; }
@SuppressWarnings("unchecked") private boolean readFromQueue() throws IOException, InterruptedException { KeyValuePair<KEYIN, VALUEIN> kv = null; // wait for input on queue kv = inputQueue.dequeue(); if (kv.endOfInput) { return false; } key = (KEYIN) ReflectionUtils.newInstance(keyClass, conf); value = (VALUEIN) ReflectionUtils.newInstance(valueClass, conf); ReflectionUtils.copy(conf, kv.key, this.key); ReflectionUtils.copy(conf, kv.value, this.value); return true; }
@SuppressWarnings("unchecked") private boolean readFromQueue() throws IOException, InterruptedException { KeyValuePair<KEYIN, VALUEIN> kv = null; // wait for input on queue kv = inputQueue.dequeue(); if (kv.endOfInput) { return false; } key = (KEYIN) ReflectionUtils.newInstance(keyClass, conf); value = (VALUEIN) ReflectionUtils.newInstance(valueClass, conf); ReflectionUtils.copy(conf, kv.key, this.key); ReflectionUtils.copy(conf, kv.value, this.value); return true; }
/** * Close this <code>RecordWriter</code> to future operations. * * @param context * the context of the task * @throws IOException */ public void close(TaskAttemptContext context) throws IOException, InterruptedException { if (outputQueue != null) { // write end of input outputQueue.enqueue(new KeyValuePair<KEYOUT, VALUEOUT>(true)); } }
/** * Creates a ChainBlockingQueue with KeyValuePair as element * * @return the ChainBlockingQueue */ ChainBlockingQueue<KeyValuePair<?, ?>> createBlockingQueue() { return new ChainBlockingQueue<KeyValuePair<?, ?>>(); }
/** * Close this <code>RecordWriter</code> to future operations. * * @param context * the context of the task * @throws IOException */ public void close(TaskAttemptContext context) throws IOException, InterruptedException { if (outputQueue != null) { // write end of input outputQueue.enqueue(new KeyValuePair<KEYOUT, VALUEOUT>(true)); } }
private synchronized void interruptAllThreads() { for (Thread th : threads) { th.interrupt(); } for (ChainBlockingQueue<?> queue : blockingQueues) { queue.interrupt(); } }
/** * Close this <code>RecordWriter</code> to future operations. * * @param context * the context of the task * @throws IOException */ public void close(TaskAttemptContext context) throws IOException, InterruptedException { if (outputQueue != null) { // write end of input outputQueue.enqueue(new KeyValuePair<KEYOUT, VALUEOUT>(true)); } }
/** * Close this <code>RecordWriter</code> to future operations. * * @param context * the context of the task * @throws IOException */ public void close(TaskAttemptContext context) throws IOException, InterruptedException { if (outputQueue != null) { // write end of input outputQueue.enqueue(new KeyValuePair<KEYOUT, VALUEOUT>(true)); } }
@SuppressWarnings("unchecked") private void writeToQueue(KEYOUT key, VALUEOUT value) throws IOException, InterruptedException { this.keyout = (KEYOUT) ReflectionUtils.newInstance(keyClass, conf); this.valueout = (VALUEOUT) ReflectionUtils.newInstance(valueClass, conf); ReflectionUtils.copy(conf, key, this.keyout); ReflectionUtils.copy(conf, value, this.valueout); // wait to write output to queuue outputQueue.enqueue(new KeyValuePair<KEYOUT, VALUEOUT>(keyout, valueout)); }
@SuppressWarnings("unchecked") private void writeToQueue(KEYOUT key, VALUEOUT value) throws IOException, InterruptedException { this.keyout = (KEYOUT) ReflectionUtils.newInstance(keyClass, conf); this.valueout = (VALUEOUT) ReflectionUtils.newInstance(valueClass, conf); ReflectionUtils.copy(conf, key, this.keyout); ReflectionUtils.copy(conf, value, this.valueout); // wait to write output to queuue outputQueue.enqueue(new KeyValuePair<KEYOUT, VALUEOUT>(keyout, valueout)); }
@SuppressWarnings("unchecked") private void writeToQueue(KEYOUT key, VALUEOUT value) throws IOException, InterruptedException { this.keyout = (KEYOUT) ReflectionUtils.newInstance(keyClass, conf); this.valueout = (VALUEOUT) ReflectionUtils.newInstance(valueClass, conf); ReflectionUtils.copy(conf, key, this.keyout); ReflectionUtils.copy(conf, value, this.valueout); // wait to write output to queuue outputQueue.enqueue(new KeyValuePair<KEYOUT, VALUEOUT>(keyout, valueout)); }
private synchronized void interruptAllThreads() { for (Thread th : threads) { th.interrupt(); } for (ChainBlockingQueue<?> queue : blockingQueues) { queue.interrupt(); } }
@SuppressWarnings("unchecked") private void writeToQueue(KEYOUT key, VALUEOUT value) throws IOException, InterruptedException { this.keyout = (KEYOUT) ReflectionUtils.newInstance(keyClass, conf); this.valueout = (VALUEOUT) ReflectionUtils.newInstance(valueClass, conf); ReflectionUtils.copy(conf, key, this.keyout); ReflectionUtils.copy(conf, value, this.valueout); // wait to write output to queuue outputQueue.enqueue(new KeyValuePair<KEYOUT, VALUEOUT>(keyout, valueout)); }
/** * Creates a ChainBlockingQueue with KeyValuePair as element * * @return the ChainBlockingQueue */ ChainBlockingQueue<KeyValuePair<?, ?>> createBlockingQueue() { return new ChainBlockingQueue<KeyValuePair<?, ?>>(); }