for (int i = 0; i < tstat.length; i++) { try { filterStatus.add(TStatus.valueOf(tstat[i])); } catch (IllegalArgumentException iae) { System.out.printf("Invalid transaction status name: %s%n", tstat[i]);
@Override public long create() { while (true) { try { // looking at the code for SecureRandom, it appears to be thread safe long tid = idgenerator.nextLong() & 0x7fffffffffffffffL; zk.putPersistentData(getTXPath(tid), TStatus.NEW.name().getBytes(UTF_8), NodeExistsPolicy.FAIL); return tid; } catch (NodeExistsException nee) { // exist, so just try another random # } catch (Exception e) { throw new RuntimeException(e); } } }
for (int i = 0; i < tstat.length; i++) { try { filterStatus.add(TStatus.valueOf(tstat[i])); } catch (IllegalArgumentException iae) { System.out.printf("Invalid transaction status name: %s%n", tstat[i]);
.valueOf(new String(zk.getData(path + "/" + txdir, null), UTF_8)); if (status == TStatus.IN_PROGRESS || status == TStatus.FAILED_IN_PROGRESS) { return tid;
@Override public long create() { while (true) { try { // looking at the code for SecureRandom, it appears to be thread safe long tid = idgenerator.nextLong() & 0x7fffffffffffffffl; zk.putPersistentData(getTXPath(tid), TStatus.NEW.name().getBytes(UTF_8), NodeExistsPolicy.FAIL); return tid; } catch (NodeExistsException nee) { // exist, so just try another random # } catch (Exception e) { throw new RuntimeException(e); } } }
@Override public void setStatus(long tid, TStatus status) { verifyReserved(tid); try { zk.putPersistentData(getTXPath(tid), status.name().getBytes(UTF_8), NodeExistsPolicy.OVERWRITE); } catch (Exception e) { throw new RuntimeException(e); } synchronized (this) { statusChangeEvents++; } }
private TStatus _getStatus(long tid) { try { return TStatus.valueOf(new String(zk.getData(getTXPath(tid), null), UTF_8)); } catch (NoNodeException nne) { return TStatus.UNKNOWN; } catch (Exception e) { throw new RuntimeException(e); } }
.valueOf(new String(zk.getData(path + "/" + txdir, null), UTF_8)); if (status == TStatus.IN_PROGRESS || status == TStatus.FAILED_IN_PROGRESS) { return tid;
@Override public void setStatus(long tid, TStatus status) { verifyReserved(tid); try { zk.putPersistentData(getTXPath(tid), status.name().getBytes(UTF_8), NodeExistsPolicy.OVERWRITE); } catch (Exception e) { throw new RuntimeException(e); } synchronized (this) { statusChangeEvents++; } }
private TStatus _getStatus(long tid) { try { return TStatus.valueOf(new String(zk.getData(getTXPath(tid), null), UTF_8)); } catch (NoNodeException nne) { return TStatus.UNKNOWN; } catch (Exception e) { throw new RuntimeException(e); } }