author | egahlin |
Wed, 23 Oct 2019 23:22:27 +0200 | |
branch | JEP-349-branch |
changeset 58769 | db30b6219779 |
parent 58768 | 08fef29ad1cf |
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; |
57604
838f9a7635b6
Cleaner stream reconfiguration + reduced allocation in JFR framework
egahlin
parents:
diff
changeset
|
40 |
import jdk.jfr.internal.LogLevel; |
838f9a7635b6
Cleaner stream reconfiguration + reduced allocation in JFR framework
egahlin
parents:
diff
changeset
|
41 |
import jdk.jfr.internal.LogTag; |
838f9a7635b6
Cleaner stream reconfiguration + reduced allocation in JFR framework
egahlin
parents:
diff
changeset
|
42 |
import jdk.jfr.internal.Logger; |
57985 | 43 |
import jdk.jfr.internal.SecuritySupport; |
57604
838f9a7635b6
Cleaner stream reconfiguration + reduced allocation in JFR framework
egahlin
parents:
diff
changeset
|
44 |
|
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 |
* Purpose of this class is to simplify the implementation of |
58200 | 47 |
* an event stream. |
57604
838f9a7635b6
Cleaner stream reconfiguration + reduced allocation in JFR framework
egahlin
parents:
diff
changeset
|
48 |
*/ |
58197 | 49 |
abstract class AbstractEventStream implements EventStream { |
58145
bc54ed8d908a
Move implementation into jdk.jfr.internal.consumer
egahlin
parents:
58129
diff
changeset
|
50 |
private final static AtomicLong counter = new AtomicLong(1); |
57604
838f9a7635b6
Cleaner stream reconfiguration + reduced allocation in JFR framework
egahlin
parents:
diff
changeset
|
51 |
|
58020
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
52 |
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
|
53 |
private final boolean active; |
58129 | 54 |
private final Runnable flushOperation = () -> dispatcher().runFlushActions(); |
57985 | 55 |
private final AccessControlContext accessControllerContext; |
58129 | 56 |
private final StreamConfiguration configuration = new StreamConfiguration(); |
57861 | 57 |
|
58129 | 58 |
private volatile Thread thread; |
59 |
private Dispatcher dispatcher; |
|
60 |
||
61 |
private volatile boolean closed; |
|
57604
838f9a7635b6
Cleaner stream reconfiguration + reduced allocation in JFR framework
egahlin
parents:
diff
changeset
|
62 |
|
58197 | 63 |
AbstractEventStream(AccessControlContext acc, boolean active) throws IOException { |
57985 | 64 |
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
|
65 |
this.active = active; |
57985 | 66 |
} |
67 |
||
68 |
@Override |
|
69 |
abstract public void start(); |
|
70 |
||
71 |
@Override |
|
72 |
abstract public void startAsync(); |
|
73 |
||
74 |
@Override |
|
75 |
abstract public void close(); |
|
76 |
||
58129 | 77 |
protected final Dispatcher dispatcher() { |
78 |
if (configuration.hasChanged()) { |
|
79 |
synchronized (configuration) { |
|
80 |
dispatcher = new Dispatcher(configuration); |
|
81 |
} |
|
82 |
} |
|
83 |
return dispatcher; |
|
84 |
} |
|
85 |
||
57985 | 86 |
@Override |
87 |
public final void setOrdered(boolean ordered) { |
|
58129 | 88 |
configuration.setOrdered(ordered); |
57985 | 89 |
} |
90 |
||
91 |
@Override |
|
92 |
public final void setReuse(boolean reuse) { |
|
58129 | 93 |
configuration.setReuse(reuse); |
57985 | 94 |
} |
95 |
||
96 |
@Override |
|
97 |
public final void setStartTime(Instant startTime) { |
|
98 |
Objects.nonNull(startTime); |
|
58129 | 99 |
synchronized (configuration) { |
100 |
if (configuration.started) { |
|
57985 | 101 |
throw new IllegalStateException("Stream is already started"); |
102 |
} |
|
103 |
if (startTime.isBefore(Instant.EPOCH)) { |
|
104 |
startTime = Instant.EPOCH; |
|
105 |
} |
|
58129 | 106 |
configuration.setStartTime(startTime); |
57985 | 107 |
} |
108 |
} |
|
109 |
||
110 |
@Override |
|
111 |
public final void setEndTime(Instant endTime) { |
|
112 |
Objects.requireNonNull(endTime); |
|
58129 | 113 |
synchronized (configuration) { |
114 |
if (configuration.started) { |
|
57985 | 115 |
throw new IllegalStateException("Stream is already started"); |
116 |
} |
|
58129 | 117 |
configuration.setEndTime(endTime); |
57985 | 118 |
} |
119 |
} |
|
120 |
||
121 |
@Override |
|
122 |
public final void onEvent(Consumer<RecordedEvent> action) { |
|
123 |
Objects.requireNonNull(action); |
|
58129 | 124 |
configuration.addEventAction(action); |
57985 | 125 |
} |
126 |
||
127 |
@Override |
|
128 |
public final void onEvent(String eventName, Consumer<RecordedEvent> action) { |
|
129 |
Objects.requireNonNull(eventName); |
|
130 |
Objects.requireNonNull(action); |
|
58129 | 131 |
configuration.addEventAction(eventName, action); |
57985 | 132 |
} |
133 |
||
134 |
@Override |
|
135 |
public final void onFlush(Runnable action) { |
|
136 |
Objects.requireNonNull(action); |
|
58129 | 137 |
configuration.addFlushAction(action); |
57985 | 138 |
} |
139 |
||
140 |
@Override |
|
141 |
public final void onClose(Runnable action) { |
|
142 |
Objects.requireNonNull(action); |
|
58129 | 143 |
configuration.addCloseAction(action); |
57985 | 144 |
} |
145 |
||
146 |
@Override |
|
147 |
public final void onError(Consumer<Throwable> action) { |
|
148 |
Objects.requireNonNull(action); |
|
58129 | 149 |
configuration.addErrorAction(action); |
57985 | 150 |
} |
151 |
||
152 |
@Override |
|
153 |
public final boolean remove(Object action) { |
|
154 |
Objects.requireNonNull(action); |
|
58129 | 155 |
return configuration.remove(action); |
57604
838f9a7635b6
Cleaner stream reconfiguration + reduced allocation in JFR framework
egahlin
parents:
diff
changeset
|
156 |
} |
838f9a7635b6
Cleaner stream reconfiguration + reduced allocation in JFR framework
egahlin
parents:
diff
changeset
|
157 |
|
57985 | 158 |
@Override |
58020
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
159 |
public final void awaitTermination() throws InterruptedException { |
57985 | 160 |
awaitTermination(Duration.ofMillis(0)); |
161 |
} |
|
162 |
||
163 |
@Override |
|
58020
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
164 |
public final void awaitTermination(Duration timeout) throws InterruptedException { |
57985 | 165 |
Objects.requireNonNull(timeout); |
58020
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
166 |
if (timeout.isNegative()) { |
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
167 |
throw new IllegalArgumentException("timeout value is negative"); |
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
168 |
} |
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 |
long base = System.currentTimeMillis(); |
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
171 |
long now = 0; |
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
172 |
|
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
173 |
long millis; |
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
174 |
try { |
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
175 |
millis = Math.multiplyExact(timeout.getSeconds(), 1000); |
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
176 |
} catch (ArithmeticException a) { |
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
177 |
millis = Long.MAX_VALUE; |
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
178 |
} |
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
179 |
int nanos = timeout.toNanosPart(); |
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
180 |
if (nanos == 0 && millis == 0) { |
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
181 |
synchronized (terminated) { |
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
182 |
while (!isClosed()) { |
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
183 |
terminated.wait(0); |
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
184 |
} |
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 |
} else { |
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
187 |
while (!isClosed()) { |
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
188 |
long delay = millis - now; |
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
189 |
if (delay <= 0) { |
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
190 |
break; |
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
191 |
} |
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
192 |
synchronized (terminated) { |
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
193 |
terminated.wait(delay, nanos); |
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
194 |
} |
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
195 |
now = System.currentTimeMillis() - base; |
57985 | 196 |
} |
197 |
} |
|
198 |
} |
|
199 |
||
58153 | 200 |
protected abstract void process() throws IOException; |
57985 | 201 |
|
202 |
protected final void setClosed(boolean closed) { |
|
58129 | 203 |
this.closed = closed; |
57985 | 204 |
} |
205 |
||
206 |
protected final boolean isClosed() { |
|
58129 | 207 |
return closed; |
57985 | 208 |
} |
209 |
||
58145
bc54ed8d908a
Move implementation into jdk.jfr.internal.consumer
egahlin
parents:
58129
diff
changeset
|
210 |
public final void startAsync(long startNanos) { |
57985 | 211 |
startInternal(startNanos); |
58020
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
212 |
Runnable r = () -> run(accessControllerContext); |
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
213 |
thread = SecuritySupport.createThreadWitNoPermissions(nextThreadName(), r); |
57985 | 214 |
thread.start(); |
215 |
} |
|
216 |
||
58145
bc54ed8d908a
Move implementation into jdk.jfr.internal.consumer
egahlin
parents:
58129
diff
changeset
|
217 |
public final void start(long startNanos) { |
57985 | 218 |
startInternal(startNanos); |
58020
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
219 |
thread = Thread.currentThread(); |
57985 | 220 |
run(accessControllerContext); |
221 |
} |
|
222 |
||
223 |
protected final Runnable getFlushOperation() { |
|
224 |
return flushOperation; |
|
225 |
} |
|
226 |
||
227 |
private void startInternal(long startNanos) { |
|
58129 | 228 |
synchronized (configuration) { |
229 |
if (configuration.started) { |
|
57985 | 230 |
throw new IllegalStateException("Event stream can only be started once"); |
231 |
} |
|
58757
df9b65cc99e8
Method setStartTime doesn't work with RecordingStream
egahlin
parents:
58445
diff
changeset
|
232 |
if (active && configuration.startTime == null) { |
58129 | 233 |
configuration.setStartNanos(startNanos); |
57985 | 234 |
} |
58129 | 235 |
configuration.setStarted(true); |
57985 | 236 |
} |
57604
838f9a7635b6
Cleaner stream reconfiguration + reduced allocation in JFR framework
egahlin
parents:
diff
changeset
|
237 |
} |
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 |
private void execute() { |
838f9a7635b6
Cleaner stream reconfiguration + reduced allocation in JFR framework
egahlin
parents:
diff
changeset
|
240 |
try { |
838f9a7635b6
Cleaner stream reconfiguration + reduced allocation in JFR framework
egahlin
parents:
diff
changeset
|
241 |
process(); |
58129 | 242 |
} catch (IOException ioe) { |
243 |
// This can happen if a chunk file is removed, or |
|
244 |
// a file is access that has been closed |
|
245 |
// This is "normal" behavior for streaming and the |
|
58153 | 246 |
// stream will be closed when this happens. |
57604
838f9a7635b6
Cleaner stream reconfiguration + reduced allocation in JFR framework
egahlin
parents:
diff
changeset
|
247 |
} finally { |
838f9a7635b6
Cleaner stream reconfiguration + reduced allocation in JFR framework
egahlin
parents:
diff
changeset
|
248 |
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
|
249 |
try { |
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
250 |
close(); |
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
251 |
} finally { |
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
252 |
synchronized (terminated) { |
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
253 |
terminated.notifyAll(); |
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
254 |
} |
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
255 |
} |
57604
838f9a7635b6
Cleaner stream reconfiguration + reduced allocation in JFR framework
egahlin
parents:
diff
changeset
|
256 |
} |
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 |
|
58020
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
259 |
private void run(AccessControlContext accessControlContext) { |
57985 | 260 |
AccessController.doPrivileged(new PrivilegedAction<Void>() { |
261 |
@Override |
|
262 |
public Void run() { |
|
263 |
execute(); |
|
264 |
return null; |
|
57604
838f9a7635b6
Cleaner stream reconfiguration + reduced allocation in JFR framework
egahlin
parents:
diff
changeset
|
265 |
} |
58020
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
266 |
}, accessControlContext); |
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
267 |
} |
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 |
private String nextThreadName() { |
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
270 |
counter.incrementAndGet(); |
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
271 |
return "JFR Event Stream " + counter; |
f082177c5023
Improved handling of Thread.interrupt() + cleanup
egahlin
parents:
57985
diff
changeset
|
272 |
} |
58180 | 273 |
} |