use of org.vesalainen.nmea.router.NMEAReader in project NMEAParser by tvesalainen.
the class NetScanner method call.
@Override
public Set<String> call() throws Exception {
try (final ScatteringByteChannel channel = UnconnectedDatagramChannel.open(address, 10110, PortScanner.BUF_SIZE, true, false)) {
NMEAReader reader = new NMEAReader(address, matcher, channel, PortScanner.BUF_SIZE, this::onOk, this::onError);
reader.read();
} finally {
return fingerPrint;
}
}
use of org.vesalainen.nmea.router.NMEAReader in project NMEAParser by tvesalainen.
the class Endpoint method run.
@Override
public void run() {
try {
Integer priority = endpointType.getPriority();
if (priority != null) {
Thread.currentThread().setPriority(priority);
}
config("registerMBean %s", objectName);
ManagementFactory.getPlatformMBeanServer().registerMBean(this, objectName);
onStart();
try (T ch = createChannel()) {
channel = ch;
config("started %s", channel);
reader = new NMEAReader(name, matcher, channel, bufferSize, this::onOk, this::onError);
reader.read();
} finally {
onStop();
if (priority != null) {
Thread.currentThread().setPriority(NORM_PRIORITY);
}
ManagementFactory.getPlatformMBeanServer().unregisterMBean(objectName);
config("unregisterMBean %s", objectName);
}
} catch (Throwable ex) {
log(SEVERE, ex, "%s stopped because of %s", name, ex);
}
}
Aggregations