use of org.gridkit.jvmtool.event.SimpleErrorEvent in project jvm-tools by aragozin.
the class EventDecoratorTest method verify_error_event.
@Test
public void verify_error_event() {
SimpleErrorEvent ee = new SimpleErrorEvent(new Exception("Boom"));
EventDecorator deco = new EventDecorator();
ErrorEvent c = deco.wrap(ee);
assertThat(c).is(eventEquals(ee));
}
use of org.gridkit.jvmtool.event.SimpleErrorEvent in project jvm-tools by aragozin.
the class ThreadDumpSource method getUnclassifiedReader.
public EventReader<ThreadSnapshotEvent> getUnclassifiedReader() {
if (files == null) {
host.fail("No input files provided, used -f option");
}
final Iterator<String> it = files.iterator();
ChainedEventReader<Event> reader = new ChainedEventReader<Event>() {
@Override
protected EventReader<Event> produceNext() {
return it.hasNext() ? open(it.next()) : null;
}
private EventReader<Event> open(String next) {
try {
return ThreadEventCodec.createEventReader(new FileInputStream(next));
} catch (IOException e) {
return new SingleEventReader<Event>(new SimpleErrorEvent(e));
}
}
};
ShieldedEventReader<ThreadSnapshotEvent> shielderReader = new ShieldedEventReader<ThreadSnapshotEvent>(reader, ThreadSnapshotEvent.class, new ErrorHandler() {
@Override
public void onException(Exception e) {
System.err.println("Stream reader error: " + e);
}
});
return shielderReader;
}
Aggregations