changeset 540:97bd6efa6e69 dispose

ods&ids have AliceDeamon
author Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp>
date Mon, 03 Aug 2015 18:39:37 +0900
parents 0832af83583f
children ba9e8b32220d
files src/main/java/alice/codesegment/CodeSegment.java src/main/java/alice/codesegment/InputDataSegment.java src/main/java/alice/codesegment/OutputDataSegment.java src/main/java/alice/daemon/AliceDaemon.java src/main/java/alice/test/codesegment/local/TestLocalAlice.java
diffstat 5 files changed, 17 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/main/java/alice/codesegment/CodeSegment.java	Mon Aug 03 18:31:19 2015 +0900
+++ b/src/main/java/alice/codesegment/CodeSegment.java	Mon Aug 03 18:39:37 2015 +0900
@@ -3,12 +3,14 @@
 import java.util.ArrayList;
 
 import alice.codesegment.InputDataSegment;
+import alice.daemon.AliceDaemon;
 import alice.datasegment.Receiver;
 
 public abstract class CodeSegment implements Runnable {
 
     public InputDataSegment ids = new InputDataSegment(this);
-    public OutputDataSegment ods = new OutputDataSegment();
+    public OutputDataSegment ods = new OutputDataSegment(this);
+    private AliceDaemon aliceDaemon;
     private ArrayList<Receiver> list = new ArrayList<Receiver>();
     private int priority = Thread.NORM_PRIORITY;//?
 
@@ -36,4 +38,8 @@
     public void setPriority(int priority) {
         this.priority = priority;
     }
+
+    public AliceDaemon getAliceDaemon() {
+        return aliceDaemon;
+    }
 }
--- a/src/main/java/alice/codesegment/InputDataSegment.java	Mon Aug 03 18:31:19 2015 +0900
+++ b/src/main/java/alice/codesegment/InputDataSegment.java	Mon Aug 03 18:39:37 2015 +0900
@@ -19,11 +19,13 @@
 public class InputDataSegment {
 
     public CodeSegment cs;
+    private final AliceDaemon alice;
     private AtomicInteger count = new AtomicInteger(1); // 1 for no input data segments
     private AtomicInteger keyCount = new AtomicInteger(0); // number of DataSegments
 
     public InputDataSegment(CodeSegment cs) {
         this.cs = cs;
+        this.alice = cs.getAliceDaemon();
     }
 
     public void init(){
--- a/src/main/java/alice/codesegment/OutputDataSegment.java	Mon Aug 03 18:31:19 2015 +0900
+++ b/src/main/java/alice/codesegment/OutputDataSegment.java	Mon Aug 03 18:39:37 2015 +0900
@@ -9,6 +9,14 @@
 
 public class OutputDataSegment {
 
+    private final CodeSegment cs;
+    private final AliceDaemon alice;
+
+    public OutputDataSegment(CodeSegment cs){
+        this.cs = cs;
+        this.alice = cs.getAliceDaemon();
+    }
+
     /**
      * for local
      */
--- a/src/main/java/alice/daemon/AliceDaemon.java	Mon Aug 03 18:31:19 2015 +0900
+++ b/src/main/java/alice/daemon/AliceDaemon.java	Mon Aug 03 18:39:37 2015 +0900
@@ -26,7 +26,6 @@
     // static
     public static final MessagePack packer = new MessagePack();
     public static DataSegment dataSegment = new DataSegment();
-    //public static CommandType commandType = CommandType.PUT;
     public static HashMap<Integer, CommandType> hash = new HashMap<Integer, CommandType>();//コマンド対応表
     public static int lastId = 0;//コマンドの総数
     public static CodeSegmentManager codeSegmentManager = new CodeSegmentManager();
--- a/src/main/java/alice/test/codesegment/local/TestLocalAlice.java	Mon Aug 03 18:31:19 2015 +0900
+++ b/src/main/java/alice/test/codesegment/local/TestLocalAlice.java	Mon Aug 03 18:39:37 2015 +0900
@@ -5,8 +5,6 @@
 
 public class TestLocalAlice {
     public static void main(String args[]) {
-        //AliceDaemon deamon = new AliceDaemon(new Config(args)); // logger off
-        //deamon.listen();
         new AliceDaemon(new Config(args)).listen();
         new StartCodeSegment().execute();
     }