@Override public void stop() { LOGGER.info("Stop the simulator."); if (netBidibPortSimulator != null) { LOGGER.info("Stop the port."); netBidibPortSimulator.stop(); if (portWorker != null) { synchronized (portWorker) { try { portWorker.join(5000L); } catch (InterruptedException ex) { LOGGER.warn("Wait for termination of port worker failed.", ex); } portWorker = null; } } isStarted.set(false); netBidibPortSimulator = null; } LOGGER.info("Stop the simulator finished."); }
@Override public void stop() { LOGGER.info("Stop the simulator."); if (netBidibPortSimulator != null) { LOGGER.info("Stop the port."); netBidibPortSimulator.stop(); if (portWorker != null) { synchronized (portWorker) { try { portWorker.join(5000L); } catch (InterruptedException ex) { LOGGER.warn("Wait for termination of port worker failed.", ex); } portWorker = null; } } isStarted.set(false); netBidibPortSimulator = null; } LOGGER.info("Stop the simulator finished."); }
@Override public void close() { LOGGER.info("Close the port."); if (port != null) { LOGGER.info("Stop the port."); port.stop(); if (portWorker != null) { synchronized (portWorker) { try { portWorker.join(5000L); } catch (InterruptedException ex) { LOGGER.warn("Wait for termination of port worker failed.", ex); } portWorker = null; } } port = null; } stopReceiverAndQueues(null); if (getConnectionListener() != null) { getConnectionListener().closed(connectedPortName); } // clear the connectedPortName connectedPortName = null; cleanupAfterClose(null); LOGGER.info("Close the port finished."); }