Mercurial > hg > Members > nobuyasu > jungle-network
changeset 148:7d248be1d3e4
Modified renewTime
author | Nobuyasu |
---|---|
date | Tue, 28 Jan 2014 10:53:01 +0900 |
parents | 202ea963ec20 |
children | 06cddf529325 |
files | src/main/java/app/bbs/BulletinBoardJungleManager.java src/main/java/app/bbs/codesegment/LogUpdateCodeSegment.java |
diffstat | 2 files changed, 7 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/app/bbs/BulletinBoardJungleManager.java Tue Jan 28 09:16:39 2014 +0900 +++ b/src/main/java/app/bbs/BulletinBoardJungleManager.java Tue Jan 28 10:53:01 2014 +0900 @@ -65,6 +65,10 @@ Either<Error, JungleTreeEditor> either = null; JungleTree tree = jungle.getTreeByName(treeName); + long timestamp = new Date().getTime(); + ByteBuffer tBuffer = ByteBuffer.allocate(16); + DefaultNodePath root = new DefaultNodePath(); + tBuffer.putLong(timestamp); do { JungleTreeEditor editor = tree.getLocalTreeEditor(); /* @@ -75,25 +79,7 @@ if(either.isA()) { throw new IllegalStateException(); } - editor = either.b(); - either = editor.success(); - }while(either.isA()); - - renewBoardTimeStamp(tree); - requestCounter.incrementAndGet(); - return either; - } - - private static void renewBoardTimeStamp(JungleTree tree) { - JungleTreeEditor editor = tree.getLocalTreeEditor(); - DefaultNodePath root = new DefaultNodePath(); - long timestamp = new Date().getTime(); - ByteBuffer tBuffer = ByteBuffer.allocate(16); - tBuffer.putLong(timestamp); - - Either<Error, JungleTreeEditor> either = null; - do { either = editor.putAttribute(root, "renewtime", tBuffer); if(either.isA()) { throw new IllegalStateException(); @@ -101,6 +87,8 @@ editor = either.b(); either = editor.success(); }while(either.isA()); + requestIncrementAndGet(); + return either; } private static int calculatePosition(Node node, long newNodeTimeStamp) {
--- a/src/main/java/app/bbs/codesegment/LogUpdateCodeSegment.java Tue Jan 28 09:16:39 2014 +0900 +++ b/src/main/java/app/bbs/codesegment/LogUpdateCodeSegment.java Tue Jan 28 10:53:01 2014 +0900 @@ -28,7 +28,7 @@ public void run() { int index = log.index; - new LogUpdateCodeSegment(index); + new LogUpdateCodeSegment(); NetworkTreeOperationLog netLog = log.asClass(NetworkTreeOperationLog.class); @SuppressWarnings("unchecked") List<String> list = clist.asClass(List.class);