/** * Switch state from WRITE to READ */ @Override public void switchState() { this.state = State.READ; try { this.outputStream.flush(); } catch (IOException e) { throw new GuaguaRuntimeException(e); } }
private String getLocalHostName() { try { return InetAddress.getLocalHost().getHostName(); } catch (Exception e) { throw new GuaguaRuntimeException(e); } }
private String getLocalHostName() { try { return InetAddress.getLocalHost().getHostName(); } catch (Exception e) { throw new GuaguaRuntimeException(e); } }
private static String getLocalHostName() { // TODO use cache?? try { return InetAddress.getLocalHost().getHostName(); } catch (Exception e) { throw new GuaguaRuntimeException(e); } }
private String getLocalHostName() { try { return InetAddress.getLocalHost().getHostName(); } catch (Exception e) { throw new GuaguaRuntimeException(e); } }
private String getLocalHostName() { try { return InetAddress.getLocalHost().getHostName(); } catch (Exception e) { throw new GuaguaRuntimeException(e); } }
/** * Constructor with file name in current working dir. */ public DiskList(String fileName) { try { this.file = new File(fileName); this.outputStream = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(file))); this.inputStream = new DataInputStream(new BufferedInputStream(new FileInputStream(file))); } catch (FileNotFoundException e) { throw new GuaguaRuntimeException(e); } }
@Override public void postApplication(MasterContext<MASTER_RESULT, WORKER_RESULT> context) { if(this.isNeedStartZookeeper) { try { this.fileSystem.delete(new Path(this.getZookeeperServerFolder(context)), true); } catch (IOException e) { throw new GuaguaRuntimeException(e); } } }
@Override public void postApplication(MasterContext<MASTER_RESULT, WORKER_RESULT> context) { if(this.isNeedStartZookeeper) { try { this.fileSystem.delete(new Path(this.getZookeeperServerFolder(context)), true); } catch (IOException e) { throw new GuaguaRuntimeException(e); } } }
@Override public void postApplication(MasterContext<MASTER_RESULT, WORKER_RESULT> context) { if(this.isNeedStartZookeeper) { try { this.fileSystem.delete(new Path(this.getZookeeperServerFolder(context)), true); } catch (IOException e) { throw new GuaguaRuntimeException(e); } } }
@SuppressWarnings("unchecked") @Override public T deserialize(byte[] bytes, Class<?> clazz) { ObjectInputStream input = null; try { ByteArrayInputStream bin = new ByteArrayInputStream(bytes); input = new ObjectInputStream(bin); return (T) input.readObject(); } catch (IOException e) { throw new GuaguaRuntimeException(e); } catch (ClassNotFoundException e) { throw new GuaguaRuntimeException(e); } finally { if(input != null) { try { input.close(); } catch (IOException ignore) { } } } }
/** * Constructor with file name in current working dir, class name and serializer instance. */ public BytableDiskList(String fileName, String className, BytableSerializer<T> serializer) { try { this.file = new File(fileName); this.outputStream = new DataOutputStream(new FileOutputStream(file)); this.inputStream = new DataInputStream(new FileInputStream(file)); } catch (FileNotFoundException e) { throw new GuaguaRuntimeException(e); } this.className = className; this.serializer = serializer; }
@Override public void postApplication(MasterContext<MASTER_RESULT, WORKER_RESULT> context) { if(this.isNeedStartZookeeper) { try { this.fileSystem.delete(new Path(this.getZookeeperServerFolder(context)), true); } catch (IOException e) { throw new GuaguaRuntimeException(e); } } }
@Override public boolean nextKeyValue() throws IOException { try { return this.parquetRecordReader.nextKeyValue(); } catch (InterruptedException e) { throw new GuaguaRuntimeException(e); } }
/** * Re-open stream for iterators. */ public void reOpen() { close(); try { this.inputStream = new DataInputStream(new BufferedInputStream(new FileInputStream(file))); } catch (FileNotFoundException e) { throw new GuaguaRuntimeException(e); } }
@Override public void execute() { try { doExecute(); } catch (InterruptedException e) { // transfer interrupt state to caller thread. Thread.currentThread().interrupt(); } catch (Exception e) { throw new GuaguaRuntimeException(e); } }
/** * Re-open stream for iterators. */ public void reOpen() { close(); try { this.inputStream = new DataInputStream(new FileInputStream(file)); } catch (FileNotFoundException e) { throw new GuaguaRuntimeException(e); } }
@Override public GuaguaWritableAdapter<Tuple> getCurrentValue() { try { return new GuaguaWritableAdapter<Tuple>(this.parquetRecordReader.getCurrentValue()); } catch (IOException e) { throw new GuaguaRuntimeException(e); } catch (InterruptedException e) { throw new GuaguaRuntimeException(e); } }
@Override public int compare(InputSplit o1, InputSplit o2) { try { long len1 = o1.getLength(); long len2 = o2.getLength(); return len1 < len2 ? 1 : (len1 == len2 ? 0 : -1); } catch (IOException ie) { throw new GuaguaRuntimeException(ie); } catch (InterruptedException ie) { throw new GuaguaRuntimeException(ie); } } }
@Override public int compare(InputSplit o1, InputSplit o2) { try { long len1 = o1.getLength(); long len2 = o2.getLength(); return len1 < len2 ? 1 : (len1 == len2 ? 0 : -1); } catch (IOException ie) { throw new GuaguaRuntimeException(ie); } catch (InterruptedException ie) { throw new GuaguaRuntimeException(ie); } } }