author | egahlin |
Wed, 02 Oct 2019 19:26:33 +0200 | |
branch | JEP-349-branch |
changeset 58445 | 1893a674db04 |
parent 58200 | 2d147d680311 |
child 58757 | df9b65cc99e8 |
permissions | -rw-r--r-- |
57604
838f9a7635b6
Cleaner stream reconfiguration + reduced allocation in JFR framework
egahlin
parents:
diff
changeset
|
1 |
/* |
838f9a7635b6
Cleaner stream reconfiguration + reduced allocation in JFR framework
egahlin
parents:
diff
changeset
|
2 |
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. |
838f9a7635b6
Cleaner stream reconfiguration + reduced allocation in JFR framework
egahlin
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
838f9a7635b6
Cleaner stream reconfiguration + reduced allocation in JFR framework
egahlin
parents:
diff
changeset
|
4 |
* |
838f9a7635b6
Cleaner stream reconfiguration + reduced allocation in JFR framework
egahlin
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
838f9a7635b6
Cleaner stream reconfiguration + reduced allocation in JFR framework
egahlin
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
838f9a7635b6
Cleaner stream reconfiguration + reduced allocation in JFR framework
egahlin
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. Oracle designates this |
838f9a7635b6
Cleaner stream reconfiguration + reduced allocation in JFR framework
egahlin
parents:
diff
changeset
|
8 |
* particular file as subject to the "Classpath" exception as provided |
838f9a7635b6
Cleaner stream reconfiguration + reduced allocation in JFR framework
egahlin
parents:
diff
changeset
|
9 |
* by Oracle in the LICENSE file that accompanied this code. |
838f9a7635b6
Cleaner stream reconfiguration + reduced allocation in JFR framework
egahlin
parents:
diff
changeset
|
10 |
* |
838f9a7635b6
Cleaner stream reconfiguration + reduced allocation in JFR framework
egahlin
parents:
diff
changeset
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
838f9a7635b6
Cleaner stream reconfiguration + reduced allocation in JFR framework
egahlin
parents:
diff
changeset
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
838f9a7635b6
Cleaner stream reconfiguration + reduced allocation in JFR framework
egahlin
parents:
diff
changeset
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
838f9a7635b6
Cleaner stream reconfiguration + reduced allocation in JFR framework
egahlin
parents:
diff
changeset
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
838f9a7635b6
Cleaner stream reconfiguration + reduced allocation in JFR framework
egahlin
parents:
diff
changeset
|
15 |
* accompanied this code). |
838f9a7635b6
Cleaner stream reconfiguration + reduced allocation in JFR framework
egahlin
parents:
diff
changeset
|
16 |
* |
838f9a7635b6
Cleaner stream reconfiguration + reduced allocation in JFR framework
egahlin
parents:
diff
changeset
|
17 |
* You should have received a copy of the GNU General Public License version |
838f9a7635b6
Cleaner stream reconfiguration + reduced allocation in JFR framework
egahlin
parents:
diff
changeset
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
838f9a7635b6
Cleaner stream reconfiguration + reduced allocation in JFR framework
egahlin
parents:
diff
changeset
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
838f9a7635b6
Cleaner stream reconfiguration + reduced allocation in JFR framework
egahlin
parents:
diff
changeset
|
20 |
* |
838f9a7635b6
Cleaner stream reconfiguration + reduced allocation in JFR framework
egahlin
parents:
diff
changeset
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
838f9a7635b6
Cleaner stream reconfiguration + reduced allocation in JFR framework
egahlin
parents:
diff
changeset
|
22 |
* or visit www.oracle.com if you need additional information or have any |
838f9a7635b6
Cleaner stream reconfiguration + reduced allocation in JFR framework
egahlin
parents:
diff
changeset
|
23 |
* questions. |
838f9a7635b6
Cleaner stream reconfiguration + reduced allocation in JFR framework
egahlin
parents:
diff
changeset
|
24 |
*/ |
838f9a7635b6
Cleaner stream reconfiguration + reduced allocation in JFR framework
egahlin
parents:
diff
changeset
|
25 |
|
58145
bc54ed8d908a
Move implementation into jdk.jfr.internal.consumer
egahlin
parents:
58129
diff
changeset
|
26 |
package jdk.jfr.internal.consumer; |
57604
838f9a7635b6
Cleaner stream reconfiguration + reduced allocation in JFR framework
egahlin
parents:
diff
changeset
|
27 |
|
838f9a7635b6
Cleaner stream reconfiguration + reduced allocation in JFR framework
egahlin
parents:
diff
changeset
|
28 |
import java.io.IOException; |
838f9a7635b6
Cleaner stream reconfiguration + reduced allocation in JFR framework
egahlin
parents:
diff
changeset
|
29 |
import java.security.AccessControlContext; |
838f9a7635b6
Cleaner stream reconfiguration + reduced allocation in JFR framework
egahlin
parents:
diff
changeset
|
30 |
import java.security.AccessController; |
838f9a7635b6
Cleaner stream reconfiguration + reduced allocation in JFR framework
egahlin
parents:
diff
changeset
|
31 |
import java.security.PrivilegedAction; |
838f9a7635b6
Cleaner stream reconfiguration + reduced allocation in JFR framework
egahlin
parents:
diff
changeset
|
32 |
import java.time.Duration; |
838f9a7635b6
Cleaner stream reconfiguration + reduced allocation in JFR framework
egahlin
parents:
diff
changeset
|
33 |
import java.time.Instant; |
838f9a7635b6
Cleaner stream reconfiguration + reduced allocation in JFR framework
egahlin
parents:
diff
changeset
|
34 |
import java.util.Objects; |
58020
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
35 |
import java.util.concurrent.atomic.AtomicLong; |
57604
838f9a7635b6
Cleaner stream reconfiguration + reduced allocation in JFR framework
egahlin
parents:
diff
changeset
|
36 |
import java.util.function.Consumer; |
838f9a7635b6
Cleaner stream reconfiguration + reduced allocation in JFR framework
egahlin
parents:
diff
changeset
|
37 |
|
58145
bc54ed8d908a
Move implementation into jdk.jfr.internal.consumer
egahlin
parents:
58129
diff
changeset
|
38 |
import jdk.jfr.consumer.EventStream; |
bc54ed8d908a
Move implementation into jdk.jfr.internal.consumer
egahlin
parents:
58129
diff
changeset
|
39 |
import jdk.jfr.consumer.RecordedEvent; |
57614 | 40 |
import jdk.jfr.internal.JVM; |
57604
838f9a7635b6
Cleaner stream reconfiguration + reduced allocation in JFR framework
egahlin
parents:
diff
changeset
|
41 |
import jdk.jfr.internal.LogLevel; |
838f9a7635b6
Cleaner stream reconfiguration + reduced allocation in JFR framework
egahlin
parents:
diff
changeset
|
42 |
import jdk.jfr.internal.LogTag; |
838f9a7635b6
Cleaner stream reconfiguration + reduced allocation in JFR framework
egahlin
parents:
diff
changeset
|
43 |
import jdk.jfr.internal.Logger; |
57985 | 44 |
import jdk.jfr.internal.SecuritySupport; |
57604
838f9a7635b6
Cleaner stream reconfiguration + reduced allocation in JFR framework
egahlin
parents:
diff
changeset
|
45 |
|
838f9a7635b6
Cleaner stream reconfiguration + reduced allocation in JFR framework
egahlin
parents:
diff
changeset
|
46 |
/* |
838f9a7635b6
Cleaner stream reconfiguration + reduced allocation in JFR framework
egahlin
parents:
diff
changeset
|
47 |
* Purpose of this class is to simplify the implementation of |
58200 | 48 |
* an event stream. |
57604
838f9a7635b6
Cleaner stream reconfiguration + reduced allocation in JFR framework
egahlin
parents:
diff
changeset
|
49 |
*/ |
58197 | 50 |
abstract class AbstractEventStream implements EventStream { |
58145
bc54ed8d908a
Move implementation into jdk.jfr.internal.consumer
egahlin
parents:
58129
diff
changeset
|
51 |
private final static AtomicLong counter = new AtomicLong(1); |
57604
838f9a7635b6
Cleaner stream reconfiguration + reduced allocation in JFR framework
egahlin
parents:
diff
changeset
|
52 |
|
58020
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
53 |
private final Object terminated = new Object(); |
57690
9316d02dd4a5
Add EventStream::setEndTime(...) and a first stab at priviliged access to local repository
egahlin
parents:
57628
diff
changeset
|
54 |
private final boolean active; |
58129 | 55 |
private final Runnable flushOperation = () -> dispatcher().runFlushActions(); |
57985 | 56 |
private final AccessControlContext accessControllerContext; |
58129 | 57 |
private final StreamConfiguration configuration = new StreamConfiguration(); |
57861 | 58 |
|
58129 | 59 |
private volatile Thread thread; |
60 |
private Dispatcher dispatcher; |
|
61 |
||
62 |
private volatile boolean closed; |
|
57604
838f9a7635b6
Cleaner stream reconfiguration + reduced allocation in JFR framework
egahlin
parents:
diff
changeset
|
63 |
|
58197 | 64 |
AbstractEventStream(AccessControlContext acc, boolean active) throws IOException { |
57985 | 65 |
this.accessControllerContext = Objects.requireNonNull(acc); |
57690
9316d02dd4a5
Add EventStream::setEndTime(...) and a first stab at priviliged access to local repository
egahlin
parents:
57628
diff
changeset
|
66 |
this.active = active; |
57985 | 67 |
} |
68 |
||
69 |
@Override |
|
70 |
abstract public void start(); |
|
71 |
||
72 |
@Override |
|
73 |
abstract public void startAsync(); |
|
74 |
||
75 |
@Override |
|
76 |
abstract public void close(); |
|
77 |
||
58129 | 78 |
protected final Dispatcher dispatcher() { |
79 |
if (configuration.hasChanged()) { |
|
80 |
synchronized (configuration) { |
|
81 |
dispatcher = new Dispatcher(configuration); |
|
82 |
} |
|
83 |
} |
|
84 |
return dispatcher; |
|
85 |
} |
|
86 |
||
57985 | 87 |
@Override |
88 |
public final void setOrdered(boolean ordered) { |
|
58129 | 89 |
configuration.setOrdered(ordered); |
57985 | 90 |
} |
91 |
||
92 |
@Override |
|
93 |
public final void setReuse(boolean reuse) { |
|
58129 | 94 |
configuration.setReuse(reuse); |
57985 | 95 |
} |
96 |
||
97 |
@Override |
|
98 |
public final void setStartTime(Instant startTime) { |
|
99 |
Objects.nonNull(startTime); |
|
58129 | 100 |
synchronized (configuration) { |
101 |
if (configuration.started) { |
|
57985 | 102 |
throw new IllegalStateException("Stream is already started"); |
103 |
} |
|
104 |
if (startTime.isBefore(Instant.EPOCH)) { |
|
105 |
startTime = Instant.EPOCH; |
|
106 |
} |
|
58129 | 107 |
configuration.setStartTime(startTime); |
57985 | 108 |
} |
109 |
} |
|
110 |
||
111 |
@Override |
|
112 |
public final void setEndTime(Instant endTime) { |
|
113 |
Objects.requireNonNull(endTime); |
|
58129 | 114 |
synchronized (configuration) { |
115 |
if (configuration.started) { |
|
57985 | 116 |
throw new IllegalStateException("Stream is already started"); |
117 |
} |
|
58129 | 118 |
configuration.setEndTime(endTime); |
57985 | 119 |
} |
120 |
} |
|
121 |
||
122 |
@Override |
|
123 |
public final void onEvent(Consumer<RecordedEvent> action) { |
|
124 |
Objects.requireNonNull(action); |
|
58129 | 125 |
configuration.addEventAction(action); |
57985 | 126 |
} |
127 |
||
128 |
@Override |
|
129 |
public final void onEvent(String eventName, Consumer<RecordedEvent> action) { |
|
130 |
Objects.requireNonNull(eventName); |
|
131 |
Objects.requireNonNull(action); |
|
58129 | 132 |
configuration.addEventAction(eventName, action); |
57985 | 133 |
} |
134 |
||
135 |
@Override |
|
136 |
public final void onFlush(Runnable action) { |
|
137 |
Objects.requireNonNull(action); |
|
58129 | 138 |
configuration.addFlushAction(action); |
57985 | 139 |
} |
140 |
||
141 |
@Override |
|
142 |
public final void onClose(Runnable action) { |
|
143 |
Objects.requireNonNull(action); |
|
58129 | 144 |
configuration.addCloseAction(action); |
57985 | 145 |
} |
146 |
||
147 |
@Override |
|
148 |
public final void onError(Consumer<Throwable> action) { |
|
149 |
Objects.requireNonNull(action); |
|
58129 | 150 |
configuration.addErrorAction(action); |
57985 | 151 |
} |
152 |
||
153 |
@Override |
|
154 |
public final boolean remove(Object action) { |
|
155 |
Objects.requireNonNull(action); |
|
58129 | 156 |
return configuration.remove(action); |
57604
838f9a7635b6
Cleaner stream reconfiguration + reduced allocation in JFR framework
egahlin
parents:
diff
changeset
|
157 |
} |
838f9a7635b6
Cleaner stream reconfiguration + reduced allocation in JFR framework
egahlin
parents:
diff
changeset
|
158 |
|
57985 | 159 |
@Override |
58020
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
160 |
public final void awaitTermination() throws InterruptedException { |
57985 | 161 |
awaitTermination(Duration.ofMillis(0)); |
162 |
} |
|
163 |
||
164 |
@Override |
|
58020
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
165 |
public final void awaitTermination(Duration timeout) throws InterruptedException { |
57985 | 166 |
Objects.requireNonNull(timeout); |
58020
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
167 |
if (timeout.isNegative()) { |
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
168 |
throw new IllegalArgumentException("timeout value is negative"); |
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
169 |
} |
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
170 |
|
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
171 |
long base = System.currentTimeMillis(); |
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
172 |
long now = 0; |
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
173 |
|
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
174 |
long millis; |
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
175 |
try { |
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
176 |
millis = Math.multiplyExact(timeout.getSeconds(), 1000); |
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
177 |
} catch (ArithmeticException a) { |
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
178 |
millis = Long.MAX_VALUE; |
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
179 |
} |
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
180 |
int nanos = timeout.toNanosPart(); |
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
181 |
if (nanos == 0 && millis == 0) { |
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
182 |
synchronized (terminated) { |
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
183 |
while (!isClosed()) { |
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
184 |
terminated.wait(0); |
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
185 |
} |
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
186 |
} |
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
187 |
} else { |
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
188 |
while (!isClosed()) { |
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
189 |
long delay = millis - now; |
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
190 |
if (delay <= 0) { |
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
191 |
break; |
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
192 |
} |
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
193 |
synchronized (terminated) { |
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
194 |
terminated.wait(delay, nanos); |
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
195 |
} |
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
196 |
now = System.currentTimeMillis() - base; |
57985 | 197 |
} |
198 |
} |
|
199 |
} |
|
200 |
||
58153 | 201 |
protected abstract void process() throws IOException; |
57985 | 202 |
|
203 |
protected final void setClosed(boolean closed) { |
|
58129 | 204 |
this.closed = closed; |
57985 | 205 |
} |
206 |
||
207 |
protected final boolean isClosed() { |
|
58129 | 208 |
return closed; |
57985 | 209 |
} |
210 |
||
58145
bc54ed8d908a
Move implementation into jdk.jfr.internal.consumer
egahlin
parents:
58129
diff
changeset
|
211 |
public final void startAsync(long startNanos) { |
57985 | 212 |
startInternal(startNanos); |
58020
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
213 |
Runnable r = () -> run(accessControllerContext); |
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
214 |
thread = SecuritySupport.createThreadWitNoPermissions(nextThreadName(), r); |
57985 | 215 |
thread.start(); |
216 |
} |
|
217 |
||
58145
bc54ed8d908a
Move implementation into jdk.jfr.internal.consumer
egahlin
parents:
58129
diff
changeset
|
218 |
public final void start(long startNanos) { |
57985 | 219 |
startInternal(startNanos); |
58020
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
220 |
thread = Thread.currentThread(); |
57985 | 221 |
run(accessControllerContext); |
222 |
} |
|
223 |
||
224 |
protected final Runnable getFlushOperation() { |
|
225 |
return flushOperation; |
|
226 |
} |
|
227 |
||
228 |
private void startInternal(long startNanos) { |
|
58129 | 229 |
synchronized (configuration) { |
230 |
if (configuration.started) { |
|
57985 | 231 |
throw new IllegalStateException("Event stream can only be started once"); |
232 |
} |
|
233 |
if (active) { |
|
58129 | 234 |
configuration.setStartNanos(startNanos); |
57985 | 235 |
} |
58129 | 236 |
configuration.setStarted(true); |
57985 | 237 |
} |
57604
838f9a7635b6
Cleaner stream reconfiguration + reduced allocation in JFR framework
egahlin
parents:
diff
changeset
|
238 |
} |
838f9a7635b6
Cleaner stream reconfiguration + reduced allocation in JFR framework
egahlin
parents:
diff
changeset
|
239 |
|
838f9a7635b6
Cleaner stream reconfiguration + reduced allocation in JFR framework
egahlin
parents:
diff
changeset
|
240 |
private void execute() { |
838f9a7635b6
Cleaner stream reconfiguration + reduced allocation in JFR framework
egahlin
parents:
diff
changeset
|
241 |
try { |
838f9a7635b6
Cleaner stream reconfiguration + reduced allocation in JFR framework
egahlin
parents:
diff
changeset
|
242 |
process(); |
58129 | 243 |
} catch (IOException ioe) { |
244 |
// This can happen if a chunk file is removed, or |
|
245 |
// a file is access that has been closed |
|
246 |
// This is "normal" behavior for streaming and the |
|
58153 | 247 |
// stream will be closed when this happens. |
57604
838f9a7635b6
Cleaner stream reconfiguration + reduced allocation in JFR framework
egahlin
parents:
diff
changeset
|
248 |
} finally { |
838f9a7635b6
Cleaner stream reconfiguration + reduced allocation in JFR framework
egahlin
parents:
diff
changeset
|
249 |
Logger.log(LogTag.JFR_SYSTEM_STREAMING, LogLevel.DEBUG, "Execution of stream ended."); |
58020
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
250 |
try { |
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
251 |
close(); |
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
252 |
} finally { |
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
253 |
synchronized (terminated) { |
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
254 |
terminated.notifyAll(); |
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
255 |
} |
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
256 |
} |
57604
838f9a7635b6
Cleaner stream reconfiguration + reduced allocation in JFR framework
egahlin
parents:
diff
changeset
|
257 |
} |
838f9a7635b6
Cleaner stream reconfiguration + reduced allocation in JFR framework
egahlin
parents:
diff
changeset
|
258 |
} |
838f9a7635b6
Cleaner stream reconfiguration + reduced allocation in JFR framework
egahlin
parents:
diff
changeset
|
259 |
|
58020
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
260 |
private void run(AccessControlContext accessControlContext) { |
57985 | 261 |
AccessController.doPrivileged(new PrivilegedAction<Void>() { |
262 |
@Override |
|
263 |
public Void run() { |
|
264 |
execute(); |
|
265 |
return null; |
|
57604
838f9a7635b6
Cleaner stream reconfiguration + reduced allocation in JFR framework
egahlin
parents:
diff
changeset
|
266 |
} |
58020
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
267 |
}, accessControlContext); |
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
268 |
} |
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
269 |
|
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
270 |
private String nextThreadName() { |
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
271 |
counter.incrementAndGet(); |
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
272 |
return "JFR Event Stream " + counter; |
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
273 |
} |
58180 | 274 |
} |