use of org.opensmartgridplatform.simulator.protocol.dlms.server.DeviceServer in project open-smart-grid-platform by OSGP.
the class SimulatorThread method run.
/**
* Start running a thread that starts a device simulator, waits for three minutes and then closes
* that simulator.
*/
@Override
public void run() {
final String[] arguments = this.configureSimulatorArguments(this.port, this.logicalId);
final DlmsServer dlmsServer = new DeviceServer().getDlmsServer(arguments);
try {
this.checkStartUp(this.port);
Thread.sleep(SIMULATOR_DELAY);
} catch (final InterruptedException e) {
LOGGER.warn("SimulatorThread was interrupted.", e);
}
try {
dlmsServer.close();
if (this.unregisterPort(this.port)) {
LOGGER.info("Successfully closed DlmsServer, port {} is free for future use.", this.port);
}
} catch (final IOException e) {
LOGGER.warn("Failed to close DlmsServer on port {}", this.port, e);
}
}
Aggregations