diff --git a/org.ntlab.traceCollector/src/org/ntlab/traceCollector/tracer/MyPrintStream.java b/org.ntlab.traceCollector/src/org/ntlab/traceCollector/tracer/MyPrintStream.java index 3732c3d..10872bd 100644 --- a/org.ntlab.traceCollector/src/org/ntlab/traceCollector/tracer/MyPrintStream.java +++ b/org.ntlab.traceCollector/src/org/ntlab/traceCollector/tracer/MyPrintStream.java @@ -1,8 +1,7 @@ package org.ntlab.traceCollector.tracer; import java.io.PrintStream; -import java.util.ArrayList; -import java.util.LinkedList; +import java.util.concurrent.ConcurrentLinkedQueue; /** * �g���[�X�o�͗p���[�e�B���e�B @@ -12,19 +11,16 @@ */ public class MyPrintStream extends Thread { private static MyPrintStream theInstance; - private static LinkedList output; + private static ConcurrentLinkedQueue output; private static String s = null; private static PrintStream sysout = null; -// private static boolean bFlushed = false; -// private static int count = 0; private static MyPrintStream getInstance() { if (theInstance == null) { theInstance = new MyPrintStream(); - output = new LinkedList(); + output = new ConcurrentLinkedQueue(); sysout = System.out; Runtime.getRuntime().addShutdownHook(theInstance); // �V���b�g�_�E���p -// theInstance.start(); } return theInstance; } @@ -46,31 +42,10 @@ } public void run() { -// if (count == 0) { -// // �ʏ�̃g���[�X�o�� -// count++; -// String s; -// Runtime.getRuntime().addShutdownHook(new MyPrintStream()); // �V���b�g�_�E���p�ɂ����ЂƂƒC���X�^���X���쐬���� -// while(!bFlushed) { -// try { -// Thread.sleep(10); -// if (output.size() > 0) { -// synchronized (output) { -// s = output.remove(0); -// } -// System.out.println(s); -// } -// } catch (InterruptedException e) { -// e.printStackTrace(); -// } -// } -// } else { - // �V���b�g�_�E�����Ƀo�b�t�@�Ɏc�����g���[�X���o�͂��؂� -// bFlushed = true; - for (String s: output) { - sysout.println(s); - } -// } + // �V���b�g�_�E����A�g���[�X���o�͂��� + for (String s: output) { + sysout.println(s); + } } private synchronized void _print(int n) {