1 46 47 50 51 52 56 57 58 package sample.blocks.stream.graph; 59 60 import java.io.DataOutputStream ; 61 import org.mr.api.blocks.MantaOutputStream; 62 63 64 public class GraphFeeder { 65 66 public static void main(String [] args) throws Exception { 67 MantaOutputStream out = new MantaOutputStream(4); 68 out.connect("graph", MantaOutputStream.TOPIC); 69 DataOutputStream dos = new DataOutputStream (out); 70 int currentStatus = 0; 71 for(int rounds =0 ;rounds<30000;rounds++ ){ 72 int rand =(int) (System.currentTimeMillis()%777); 73 if(rand%2 ==0){ 74 currentStatus++; 75 }else{ 76 currentStatus--; 77 } 78 dos.writeInt(currentStatus); 79 80 Thread.sleep(rand/3); 81 82 } 83 Thread.sleep(100000); 84 } 85 } | Popular Tags |