فهرست منبع

проверил нагрузочку

kpmy 8 سال پیش
والد
کامیت
c4fffdad80
1فایلهای تغییر یافته به همراه14 افزوده شده و 6 حذف شده
  1. 14 6
      src/main/java/in/ocsf/dialij/app/ctrl/DevController.java

+ 14 - 6
src/main/java/in/ocsf/dialij/app/ctrl/DevController.java

@@ -4,6 +4,7 @@ import co.paralleluniverse.fibers.Fiber;
 import co.paralleluniverse.fibers.SuspendExecution;
 import co.paralleluniverse.fibers.SuspendExecution;
 import in.ocsf.dialij.app.obj.Processor;
 import in.ocsf.dialij.app.obj.Processor;
 import in.ocsf.dialij.app.srv.CompilerService;
 import in.ocsf.dialij.app.srv.CompilerService;
+import org.apache.log4j.Logger;
 import org.springframework.http.HttpStatus;
 import org.springframework.http.HttpStatus;
 import org.springframework.http.ResponseEntity;
 import org.springframework.http.ResponseEntity;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -17,17 +18,24 @@ public class DevController {
     @Inject
     @Inject
     private CompilerService compiler;
     private CompilerService compiler;
 
 
+    private Logger log = Logger.getLogger(getClass());
+
     @RequestMapping("/dev/bf")
     @RequestMapping("/dev/bf")
     public ResponseEntity<String> bf() {
     public ResponseEntity<String> bf() {
         Processor pr = compiler.compile("++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++\n" +
         Processor pr = compiler.compile("++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++\n" +
                 " .>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.\n" +
                 " .>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.\n" +
                 " ------.--------.>+.>.");
                 " ------.--------.>+.>.");
-        Fiber<String> fib = new Fiber<String>() {
-            @Override
-            protected String run() throws SuspendExecution, InterruptedException {
-                return pr.process();
-            }
-        }.start();
+
+        for (int i = 0; i < 10000; i++) {
+            new Fiber<String>() {
+                @Override
+                protected String run() throws SuspendExecution, InterruptedException {
+                    String out = pr.process();
+                    log.info(out);
+                    return out;
+                }
+            }.start();
+        }
         return new ResponseEntity<>(HttpStatus.OK);
         return new ResponseEntity<>(HttpStatus.OK);
     }
     }
 }
 }