View | Details | Raw Unified | Return to bug 60643
Collapse All | Expand All

(-)src/core/org/apache/jmeter/reporters/ResultCollector.java (-25 / +28 lines)
Lines 63-69 Link Here
63
 */
63
 */
64
public class ResultCollector extends AbstractListenerElement implements SampleListener, Clearable, Serializable,
64
public class ResultCollector extends AbstractListenerElement implements SampleListener, Clearable, Serializable,
65
        TestStateListener, Remoteable, NoThreadClone {
65
        TestStateListener, Remoteable, NoThreadClone {
66
    /**
67
     * Keep track of the file writer and the configuration,
68
     * as the instance used to close them is not the same as the instance that creates
69
     * them. This means one cannot use the saved PrintWriter or use getSaveConfig()
70
     */
71
    private static class FileEntry{
72
        final PrintWriter pw;
73
        final SampleSaveConfiguration config;
74
        FileEntry(PrintWriter _pw, SampleSaveConfiguration _config){
75
            pw =_pw;
76
            config = _config;
77
        }
78
    }
79
    
80
    private static final class ShutdownHook implements Runnable {
66
81
82
        @Override
83
        public void run() {
84
            log.info("Shutdown hook started");
85
            synchronized (LOCK) {
86
                flushFileOutput();                    
87
            }
88
            log.info("Shutdown hook ended");
89
        }     
90
    }
67
    private static final Logger log = LoggingManager.getLoggerForClass();
91
    private static final Logger log = LoggingManager.getLoggerForClass();
68
92
69
    private static final long serialVersionUID = 233L;
93
    private static final long serialVersionUID = 233L;
Lines 110-128 Link Here
110
    //@GuardedBy("LOCK")
134
    //@GuardedBy("LOCK")
111
    private static Thread shutdownHook;
135
    private static Thread shutdownHook;
112
136
113
    /*
114
     * Keep track of the file writer and the configuration,
115
     * as the instance used to close them is not the same as the instance that creates
116
     * them. This means one cannot use the saved PrintWriter or use getSaveConfig()
117
     */
118
    private static class FileEntry{
119
        final PrintWriter pw;
120
        final SampleSaveConfiguration config;
121
        FileEntry(PrintWriter _pw, SampleSaveConfiguration _config){
122
            pw =_pw;
123
            config = _config;
124
        }
125
    }
126
137
127
    /**
138
    /**
128
     * The instance count is used to keep track of whether any tests are currently running.
139
     * The instance count is used to keep track of whether any tests are currently running.
Lines 137-160 Link Here
137
148
138
    private transient volatile PrintWriter out;
149
    private transient volatile PrintWriter out;
139
150
151
    /**
152
     * Is a test running ?
153
     */
140
    private volatile boolean inTest = false;
154
    private volatile boolean inTest = false;
141
155
142
    private volatile boolean isStats = false;
156
    private volatile boolean isStats = false;
143
157
144
    /** the summarizer to which this result collector will forward the samples */
158
    /** the summarizer to which this result collector will forward the samples */
145
    private volatile Summariser summariser;
159
    private volatile Summariser summariser;
146
147
    private static final class ShutdownHook implements Runnable {
148
149
        @Override
150
        public void run() {
151
            log.info("Shutdown hook started");
152
            synchronized (LOCK) {
153
                flushFileOutput();                    
154
            }
155
            log.info("Shutdown hook ended");
156
        }     
157
    }
158
    
160
    
159
    /**
161
    /**
160
     * No-arg constructor.
162
     * No-arg constructor.
Lines 633-638 Link Here
633
            }
635
            }
634
        }
636
        }
635
        files.clear();
637
        files.clear();
638
        out = null;
636
    }
639
    }
637
640
638
    /**
641
    /**

Return to bug 60643