DataOutputStream dosValue = prepareAppendValue(vlen); try { ++errorCount;
private int writePrepWithUnkownLength(Writer writer, int start, int n) throws IOException { for (int i = start; i < (start + n); i++) { DataOutputStream out = writer.prepareAppendKey(-1); String localKey = String.format(localFormatter, i); out.write(localKey.getBytes()); out.close(); String value = "value" + localKey; out = writer.prepareAppendValue(-1); out.write(value.getBytes()); out.close(); } return (start + n); }
public void testFailureKeyTooShort() throws IOException { if (skip) return; DataOutputStream outKey = writer.prepareAppendKey(4); outKey.write("key0".getBytes()); outKey.close(); DataOutputStream outValue = writer.prepareAppendValue(15); try { outValue.write("value0".getBytes()); outValue.close(); Assert.fail("Value is shorter than expected."); } catch (Exception e) { // noop, expecting an exception } finally { } }
public synchronized void writeHistoryData(HistoryDataKey key, byte[] value) throws IOException { DataOutputStream dos = null; try { dos = writer.prepareAppendKey(-1); key.write(dos); } finally { IOUtils.cleanup(LOG, dos); } try { dos = writer.prepareAppendValue(value.length); dos.write(value); } finally { IOUtils.cleanup(LOG, dos); } }
public synchronized void writeHistoryData(HistoryDataKey key, byte[] value) throws IOException { DataOutputStream dos = null; try { dos = writer.prepareAppendKey(-1); key.write(dos); } finally { IOUtils.cleanup(LOG, dos); } try { dos = writer.prepareAppendValue(value.length); dos.write(value); } finally { IOUtils.cleanup(LOG, dos); } }
private int writePrepWithUnkownLength(Writer writer, int start, int n) throws IOException { for (int i = start; i < (start + n); i++) { DataOutputStream out = writer.prepareAppendKey(-1); String localKey = String.format(localFormatter, i); out.write(localKey.getBytes()); out.close(); String value = "value" + localKey; out = writer.prepareAppendValue(-1); out.write(value.getBytes()); out.close(); } return (start + n); }
private int writePrepWithUnkownLength(Writer writer, int start, int n) throws IOException { for (int i = start; i < (start + n); i++) { DataOutputStream out = writer.prepareAppendKey(-1); String localKey = String.format(localFormatter, i); out.write(localKey.getBytes()); out.close(); String value = "value" + localKey; out = writer.prepareAppendValue(-1); out.write(value.getBytes()); out.close(); } return (start + n); }
public synchronized void writeHistoryData(HistoryDataKey key, byte[] value) throws IOException { DataOutputStream dos = null; try { dos = writer.prepareAppendKey(-1); key.write(dos); } finally { IOUtils.cleanupWithLogger(LOG, dos); } try { dos = writer.prepareAppendValue(value.length); dos.write(value); } finally { IOUtils.cleanupWithLogger(LOG, dos); } }
public void append(LogKey logKey, LogValue logValue) throws IOException { Set<File> pendingUploadFiles = logValue.getPendingLogFilesToUploadForThisContainer(); if (pendingUploadFiles.size() == 0) { return; } try (DataOutputStream out = this.writer.prepareAppendKey(-1)) { logKey.write(out); } try (DataOutputStream out = this.writer.prepareAppendValue(-1)) { logValue.write(out, pendingUploadFiles); } }
public void writeApplicationACLs(Map<ApplicationAccessType, String> appAcls) throws IOException { DataOutputStream out = this.writer.prepareAppendKey(-1); APPLICATION_ACL_KEY.write(out); out.close(); out = this.writer.prepareAppendValue(-1); for (Entry<ApplicationAccessType, String> entry : appAcls.entrySet()) { out.writeUTF(entry.getKey().toString()); out.writeUTF(entry.getValue()); } out.close(); }
public void append(LogKey logKey, LogValue logValue) throws IOException { Set<File> pendingUploadFiles = logValue.getPendingLogFilesToUploadForThisContainer(); if (pendingUploadFiles.size() == 0) { return; } try (DataOutputStream out = this.writer.prepareAppendKey(-1)) { logKey.write(out); } try (DataOutputStream out = this.writer.prepareAppendValue(-1)) { logValue.write(out, pendingUploadFiles); } }
public void append(LogKey logKey, LogValue logValue) throws IOException { Set<File> pendingUploadFiles = logValue.getPendingLogFilesToUploadForThisContainer(); if (pendingUploadFiles.size() == 0) { return; } DataOutputStream out = this.writer.prepareAppendKey(-1); logKey.write(out); out.close(); out = this.writer.prepareAppendValue(-1); logValue.write(out, pendingUploadFiles); out.close(); }
public void writeApplicationACLs(Map<ApplicationAccessType, String> appAcls) throws IOException { try (DataOutputStream out = this.writer.prepareAppendKey(-1)) { APPLICATION_ACL_KEY.write(out); } try (DataOutputStream out = this.writer.prepareAppendValue(-1)) { for (Entry<ApplicationAccessType, String> entry : appAcls.entrySet()) { out.writeUTF(entry.getKey().toString()); out.writeUTF(entry.getValue()); } } }
private void writeVersion() throws IOException { DataOutputStream out = this.writer.prepareAppendKey(-1); VERSION_KEY.write(out); out.close(); out = this.writer.prepareAppendValue(-1); out.writeInt(VERSION); out.close(); }
public void writeApplicationOwner(String user) throws IOException { try (DataOutputStream out = this.writer.prepareAppendKey(-1)) { APPLICATION_OWNER_KEY.write(out); } try (DataOutputStream out = this.writer.prepareAppendValue(-1)) { out.writeUTF(user); } }
private void writeVersion() throws IOException { try (DataOutputStream out = this.writer.prepareAppendKey(-1)) { VERSION_KEY.write(out); } try (DataOutputStream out = this.writer.prepareAppendValue(-1)) { out.writeInt(VERSION); } }
public void writeApplicationOwner(String user) throws IOException { DataOutputStream out = this.writer.prepareAppendKey(-1); APPLICATION_OWNER_KEY.write(out); out.close(); out = this.writer.prepareAppendValue(-1); out.writeUTF(user); out.close(); }
public void writeApplicationACLs(Map<ApplicationAccessType, String> appAcls) throws IOException { try (DataOutputStream out = this.writer.prepareAppendKey(-1)) { APPLICATION_ACL_KEY.write(out); } try (DataOutputStream out = this.writer.prepareAppendValue(-1)) { for (Entry<ApplicationAccessType, String> entry : appAcls.entrySet()) { out.writeUTF(entry.getKey().toString()); out.writeUTF(entry.getValue()); } } }
public void writeApplicationOwner(String user) throws IOException { try (DataOutputStream out = this.writer.prepareAppendKey(-1)) { APPLICATION_OWNER_KEY.write(out); } try (DataOutputStream out = this.writer.prepareAppendValue(-1)) { out.writeUTF(user); } }
private void writeVersion() throws IOException { try (DataOutputStream out = this.writer.prepareAppendKey(-1)) { VERSION_KEY.write(out); } try (DataOutputStream out = this.writer.prepareAppendValue(-1)) { out.writeInt(VERSION); } }