use of java.io.UncheckedIOException in project spf4j by zolyfarkas.
the class Threads method dumpToPrintStream.
// jdk printstreams are sync I don't want interleaving.
@SuppressFBWarnings("NOS_NON_OWNED_SYNCHRONIZATION")
public static void dumpToPrintStream(final PrintStream stream) {
synchronized (stream) {
Thread[] threads = getThreads();
StackTraceElement[][] stackTraces = getStackTraces(threads);
for (int i = 0; i < threads.length; i++) {
StackTraceElement[] stackTrace = stackTraces[i];
if (stackTrace != null && stackTrace.length > 0) {
Thread thread = threads[i];
stream.println("Thread " + thread.getName());
try {
Throwables.writeTo(stackTrace, stream, Throwables.PackageDetail.SHORT, true);
} catch (IOException ex) {
throw new UncheckedIOException(ex);
}
}
}
}
}
use of java.io.UncheckedIOException in project spf4j by zolyfarkas.
the class TSDB2ViewJInternalFrame method jButton1ActionPerformed.
// </editor-fold>//GEN-END:initComponents
@SuppressFBWarnings("UP_UNUSED_PARAMETER")
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
// GEN-FIRST:event_jButton1ActionPerformed
TreePath[] selectionPaths = measurementTree.getSelectionPaths();
JPanel content = new JPanel();
content.setLayout(new BoxLayout(content, BoxLayout.Y_AXIS));
chartPannel.setViewportView(content);
try {
Set<String> selectedTables = getSelectedTables(selectionPaths);
for (String tableName : selectedTables) {
addChartToPanel(tableName, content);
}
} catch (IOException ex) {
throw new UncheckedIOException(ex);
}
chartPannel.repaint();
}
use of java.io.UncheckedIOException in project spf4j by zolyfarkas.
the class Explorer method openMenuItemActionPerformed.
// GEN-LAST:event_exitMenuItemActionPerformed
private void openMenuItemActionPerformed(java.awt.event.ActionEvent evt) {
// GEN-FIRST:event_openMenuItemActionPerformed
JFileChooser chooser = new JFileChooser();
chooser.setDialogType(JFileChooser.OPEN_DIALOG);
chooser.setFileFilter(new Spf4jFileFilter());
if (folder != null) {
chooser.setCurrentDirectory(folder);
}
int returnVal = chooser.showOpenDialog(this);
if (returnVal == JFileChooser.APPROVE_OPTION) {
File file = chooser.getSelectedFile();
folder = file.getParentFile();
try {
openFile(file);
} catch (IOException ex) {
throw new UncheckedIOException(ex);
}
}
}
use of java.io.UncheckedIOException in project spf4j by zolyfarkas.
the class JmhProfiler method afterIteration.
@Override
@Nonnull
public Collection<? extends Result> afterIteration(final BenchmarkParams benchmarkParams, final IterationParams iterationParams, final IterationResult ir) {
try {
SAMPLER.stop();
} catch (InterruptedException ex) {
Thread.currentThread().interrupt();
return Collections.EMPTY_LIST;
}
Map<String, SampleNode> c = SAMPLER.getStackCollectionsAndReset();
if (c.isEmpty()) {
return Collections.EMPTY_LIST;
}
SampleNode collected = c.values().iterator().next();
try {
return Arrays.asList(new StackResult(collected, benchmarkParams.id(), true));
} catch (IOException ex) {
throw new UncheckedIOException(ex);
}
}
use of java.io.UncheckedIOException in project spf4j by zolyfarkas.
the class LogRecord method materializeMessage.
public synchronized void materializeMessage() {
if (message == null) {
StringBuilder sb = new StringBuilder(format.length() + arguments.length * 8);
try {
this.startExtra = Slf4jMessageFormatter.format(LogPrinter::exHandle, 0, sb, format, ObjectAppenderSupplier.TO_STRINGER, arguments);
} catch (IOException ex) {
throw new UncheckedIOException(ex);
}
message = sb.toString();
}
}
Aggregations