Mercurial > hg > Members > shoshi > jungle > jungle-core
changeset 253:67541eebcaac Implementation_of_communication
rename some files
add maven repository for Alice
author | one |
---|---|
date | Thu, 17 Nov 2016 18:23:44 +0900 |
parents | d198a04e9e75 |
children | 28d3a177f540 |
files | build.gradle src/main/java/jp/ac/u_ryukyu/ie/cr/benchMark/persistent/DataReadBenchMark.java src/main/java/jp/ac/u_ryukyu/ie/cr/benchMark/persistent/DataReadBenchmark.java src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/xml/reader/XmlReader.java src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/xml/reader/xmlReader.java |
diffstat | 5 files changed, 125 insertions(+), 123 deletions(-) [+] |
line wrap: on
line diff
--- a/build.gradle Thu Nov 17 17:58:52 2016 +0900 +++ b/build.gradle Thu Nov 17 18:23:44 2016 +0900 @@ -8,19 +8,21 @@ repositories { mavenCentral() maven { url "http://eaio.com/maven2" } - maven { url "http://repo.maven.apache.org/maven2" } + maven { url "http://repo.maven.apache.org/maven2" } + maven { url "http://www.cr.ie.u-ryukyu.ac.jp/hg/maven/raw-file/e6b119647469/"} } dependencies { //compile group: 'org.mongodb', name: 'mongo-java-driver', version: '3.0.0' compile "commons-collections:commons-collections:3.2.1" compile "org.apache.maven.surefire:surefire-junit4:2.13" - //compile "com.google.guava:guava:12.0" + compile "com.google.guava:guava:12.0" compile fileTree(dir: 'lib', include: '*.jar') compile group: 'junit', name: 'junit', version: '4.11' compile group: 'org.eclipse.jetty', name: 'jetty-server', version: '9.2.1.v20140609' compile group: 'org.eclipse.jetty', name: 'jetty-servlet', version:'9.2.1.v20140609' compile group: 'org.msgpack', name: 'msgpack', version: '0.6.12' + compile group: 'cr.ie.u_ryukyu.ac.jp', name: 'Alice', version: '1.1', ext: 'jar' //compile group: 'org.hectorclient', name: 'hector-core', version:'1.1-2' //compile group: 'com.github.stephenc.eaio-uuid', name: 'uuid', version:'3.3.0' //compile group: 'org.apache.cassandra', name: 'cassandra-all', version: '3.9'
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/benchMark/persistent/DataReadBenchMark.java Thu Nov 17 18:23:44 2016 +0900 @@ -0,0 +1,87 @@ +package jp.ac.u_ryukyu.ie.cr.benchMark.persistent; + +import jp.ac.u_ryukyu.ie.cr.jungle.Jungle; +import jp.ac.u_ryukyu.ie.cr.jungle.JungleTree; +import jp.ac.u_ryukyu.ie.cr.jungle.JungleTreeEditor; +import jp.ac.u_ryukyu.ie.cr.jungle.persistent.ChangeList; +import jp.ac.u_ryukyu.ie.cr.jungle.persistent.ChangeListReader; +import jp.ac.u_ryukyu.ie.cr.jungle.store.NodePath; +import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.DefaultTreeEditor; +import jp.ac.u_ryukyu.ie.cr.jungle.traverser.DefaultTraverser; +import jp.ac.u_ryukyu.ie.cr.jungle.util.Either; +import jp.ac.u_ryukyu.ie.cr.jungle.util.Error; +import jp.ac.u_ryukyu.ie.cr.jungleNetwork.operations.NetworkNodePath; +import jp.ac.u_ryukyu.ie.cr.jungleNetwork.persistent.PersistentJournal; +import jp.ac.u_ryukyu.ie.cr.jungleNetwork.persistent.PersistentJungle; +import jp.ac.u_ryukyu.ie.cr.jungleNetwork.transaction.JungleUpdater; +import org.junit.Assert; + +import java.io.*; +import java.nio.ByteBuffer; + +public class DataReadBenchMark { + + static ByteBuffer value = ByteBuffer.wrap("value".getBytes()); + static String key = "key"; + static int pos = 0; + + public static void main(String[] args) throws IOException { + + PersistentJournal journal1 = new PersistentJournal(new File("./log/commit.log")); + Jungle jungle = new PersistentJungle(journal1, "uuid", new DefaultTreeEditor(new DefaultTraverser())); + Jungle jungle2 = new PersistentJungle(journal1, "uuid3", new DefaultTreeEditor(new DefaultTraverser())); + Long t1; + Long t2; + PrintWriter readTimeWriter = new PrintWriter(new BufferedWriter(new FileWriter(new File("./time/readTime")))); + PrintWriter writeTimeWriter = new PrintWriter(new BufferedWriter(new FileWriter(new File("./time/writeTime")))); + for (int i = 1 ; i <= 20 ; i++) { + jungle.createNewTree("hoge" + i); + JungleTree tree1 = jungle.getTreeByName("hoge" + i); + JungleTreeEditor editor; + NetworkNodePath path = new NetworkNodePath(); + t1 = System.currentTimeMillis(); + for (int j = 0; j < 100 * i; j++) { + editor = tree1.getTreeEditor(); + Either<Error, JungleTreeEditor> either = editor.addNewChildAt(path, pos); + NodePath childPath = path.add(pos); + Assert.assertFalse(either.isA()); + editor = either.b(); + either = editor.putAttribute(childPath, key, value); + JungleTreeEditor editor2 = either.b(); + either = editor2.success(); + Assert.assertFalse(either.isA()); + } + t2 = System.currentTimeMillis(); + + writeTimeWriter.println((100 * i) + " " + (t2 - t1)); + System.out.println("write time = " + (t2 - t1)); + + PersistentJournal journal2 = new PersistentJournal(); + journal2.setInputFile(new File("./log/" + journal1.getLogName())); + journal2.setOutputFile(new File("./log/" + journal1.getLogName())); + ChangeListReader reader = journal2.getReader(); + + t1 = System.currentTimeMillis(); + for (ChangeList chList : reader) { + String treeName = chList.getTreeName(); + JungleTree tree2 = jungle2.getTreeByName(treeName); + if (tree2 == null) { + tree2 = jungle2.createNewTree(treeName); + } + JungleTreeEditor editor2 = tree2.getTreeEditor(); + Either<Error, JungleTreeEditor> either2 = JungleUpdater.edit(editor2, chList); + Assert.assertFalse(either2.isA()); + editor2 = either2.b(); + editor2.success(); + } + + t2 = System.currentTimeMillis(); + readTimeWriter.println((100 * i) + " " + (t2 - t1)); + System.out.println("read time = " + (t2 - t1)); + + } + writeTimeWriter.close(); + readTimeWriter.close(); + journal1.close(); + } +}
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/benchMark/persistent/DataReadBenchmark.java Thu Nov 17 17:58:52 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,87 +0,0 @@ -package jp.ac.u_ryukyu.ie.cr.benchMark.persistent; - -import jp.ac.u_ryukyu.ie.cr.jungle.Jungle; -import jp.ac.u_ryukyu.ie.cr.jungle.JungleTree; -import jp.ac.u_ryukyu.ie.cr.jungle.JungleTreeEditor; -import jp.ac.u_ryukyu.ie.cr.jungle.persistent.ChangeList; -import jp.ac.u_ryukyu.ie.cr.jungle.persistent.ChangeListReader; -import jp.ac.u_ryukyu.ie.cr.jungle.store.NodePath; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.DefaultTreeEditor; -import jp.ac.u_ryukyu.ie.cr.jungle.traverser.DefaultTraverser; -import jp.ac.u_ryukyu.ie.cr.jungle.util.Either; -import jp.ac.u_ryukyu.ie.cr.jungle.util.Error; -import jp.ac.u_ryukyu.ie.cr.jungleNetwork.operations.NetworkNodePath; -import jp.ac.u_ryukyu.ie.cr.jungleNetwork.persistent.PersistentJournal; -import jp.ac.u_ryukyu.ie.cr.jungleNetwork.persistent.PersistentJungle; -import jp.ac.u_ryukyu.ie.cr.jungleNetwork.transaction.JungleUpdater; -import org.junit.Assert; - -import java.io.*; -import java.nio.ByteBuffer; - -public class DataReadBenchMark { - - static ByteBuffer value = ByteBuffer.wrap("value".getBytes()); - static String key = "key"; - static int pos = 0; - - public static void main(String[] args) throws IOException { - - PersistentJournal journal1 = new PersistentJournal(new File("./log/commit.log")); - Jungle jungle = new PersistentJungle(journal1, "uuid", new DefaultTreeEditor(new DefaultTraverser())); - Jungle jungle2 = new PersistentJungle(journal1, "uuid3", new DefaultTreeEditor(new DefaultTraverser())); - Long t1; - Long t2; - PrintWriter readTimeWriter = new PrintWriter(new BufferedWriter(new FileWriter(new File("./time/readTime")))); - PrintWriter writeTimeWriter = new PrintWriter(new BufferedWriter(new FileWriter(new File("./time/writeTime")))); - for (int i = 1 ; i <= 20 ; i++) { - jungle.createNewTree("hoge" + i); - JungleTree tree1 = jungle.getTreeByName("hoge" + i); - JungleTreeEditor editor; - NetworkNodePath path = new NetworkNodePath(); - t1 = System.currentTimeMillis(); - for (int j = 0; j < 100 * i; j++) { - editor = tree1.getTreeEditor(); - Either<Error, JungleTreeEditor> either = editor.addNewChildAt(path, pos); - NodePath childPath = path.add(pos); - Assert.assertFalse(either.isA()); - editor = either.b(); - either = editor.putAttribute(childPath, key, value); - JungleTreeEditor editor2 = either.b(); - either = editor2.success(); - Assert.assertFalse(either.isA()); - } - t2 = System.currentTimeMillis(); - - writeTimeWriter.println((100 * i) + " " + (t2 - t1)); - System.out.println("write time = " + (t2 - t1)); - - PersistentJournal journal2 = new PersistentJournal(); - journal2.setInputFile(new File("./log/" + journal1.getLogName())); - journal2.setOutputFile(new File("./log/" + journal1.getLogName())); - ChangeListReader reader = journal2.getReader(); - - t1 = System.currentTimeMillis(); - for (ChangeList chList : reader) { - String treeName = chList.getTreeName(); - JungleTree tree2 = jungle2.getTreeByName(treeName); - if (tree2 == null) { - tree2 = jungle2.createNewTree(treeName); - } - JungleTreeEditor editor2 = tree2.getTreeEditor(); - Either<Error, JungleTreeEditor> either2 = JungleUpdater.edit(editor2, chList); - Assert.assertFalse(either2.isA()); - editor2 = either2.b(); - editor2.success(); - } - - t2 = System.currentTimeMillis(); - readTimeWriter.println((100 * i) + " " + (t2 - t1)); - System.out.println("read time = " + (t2 - t1)); - - } - writeTimeWriter.close(); - readTimeWriter.close(); - journal1.close(); - } -}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/xml/reader/XmlReader.java Thu Nov 17 18:23:44 2016 +0900 @@ -0,0 +1,34 @@ +package jp.ac.u_ryukyu.ie.cr.jungle.xml.reader; + +import jp.ac.u_ryukyu.ie.cr.jungle.DefaultJungle; +import jp.ac.u_ryukyu.ie.cr.jungle.Jungle; +import jp.ac.u_ryukyu.ie.cr.jungle.JungleTree; +import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.DefaultTreeEditor; +import jp.ac.u_ryukyu.ie.cr.jungle.traverser.DefaultTraverser; + +import javax.xml.parsers.SAXParser; +import javax.xml.parsers.SAXParserFactory; +import java.io.FileInputStream; + + +public class XmlReader { + public static void main(String args[]) { + String xmlPath = args[0]; + Jungle jungle = new DefaultJungle(null, "hoge", new DefaultTreeEditor(new DefaultTraverser())); + JungleTree tree = jungle.createNewTree("XMLTEST"); + new XmlReader().start(xmlPath,tree); + } + + public JungleTree start(String xmlPath, JungleTree tree) { + try { + SAXParserFactory saxParserFactory = SAXParserFactory.newInstance(); + SAXParser saxParser = saxParserFactory.newSAXParser(); + ReadXmlHandler readXmlHandler = new ReadXmlHandler(tree); + saxParser.parse(new FileInputStream(xmlPath), readXmlHandler); + return readXmlHandler.getTree(); + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } +} \ No newline at end of file
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/xml/reader/xmlReader.java Thu Nov 17 17:58:52 2016 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ -package jp.ac.u_ryukyu.ie.cr.jungle.xml.reader; - -import jp.ac.u_ryukyu.ie.cr.jungle.DefaultJungle; -import jp.ac.u_ryukyu.ie.cr.jungle.Jungle; -import jp.ac.u_ryukyu.ie.cr.jungle.JungleTree; -import jp.ac.u_ryukyu.ie.cr.jungle.store.impl.DefaultTreeEditor; -import jp.ac.u_ryukyu.ie.cr.jungle.traverser.DefaultTraverser; - -import javax.xml.parsers.SAXParser; -import javax.xml.parsers.SAXParserFactory; -import java.io.FileInputStream; - - -public class XmlReader { - public static void main(String args[]) { - String xmlPath = args[0]; - Jungle jungle = new DefaultJungle(null, "hoge", new DefaultTreeEditor(new DefaultTraverser())); - JungleTree tree = jungle.createNewTree("XMLTEST"); - new XmlReader().start(xmlPath,tree); - } - - public JungleTree start(String xmlPath, JungleTree tree) { - try { - SAXParserFactory saxParserFactory = SAXParserFactory.newInstance(); - SAXParser saxParser = saxParserFactory.newSAXParser(); - ReadXmlHandler readXmlHandler = new ReadXmlHandler(tree); - saxParser.parse(new FileInputStream(xmlPath), readXmlHandler); - return readXmlHandler.getTree(); - } catch (Exception e) { - e.printStackTrace(); - return null; - } - } -} \ No newline at end of file