TimeManager { public void stop() { eventLoop.doNow( () -> { Iterator<Entry<InstanceHandle_t, HeartBeat>> itr = heartbeats.entrySet().iterator(); while(itr.hasNext()) { Entry<InstanceHandle_t, HeartBeat> hb = itr.next(); processNotAliveHeartbeat(hb.getValue().unique_device_identifier, hb.getValue().type); itr.remove(); } if(null != heartbeatTask) { heartbeatTask.cancel(true); heartbeatTask = null; } if(null != hbReader && null != hbReadCond) { eventLoop.removeHandler(hbReadCond); hbReader.delete_readcondition(hbReadCond); hbReadCond = null; } if(null != tsReader && null != tsReadCond) { eventLoop.removeHandler(tsReadCond); tsReader.delete_readcondition(tsReadCond); tsReadCond = null; } if(null != hbWriter && null != hbData && null != hbHandle) { hbWriter.unregister_instance(hbData, hbHandle); hbHandle = null; } if(null != timeSyncHandler) { ice.TimeSyncDataWriter tsWriter = timeSyncHandler.shutdown(); timeSyncHandler = null; publisher.delete_datawriter(tsWriter); } if(null != hbWriter) { publisher.delete_datawriter(hbWriter); hbWriter = null; } if(null != hbReader) { subscriber.delete_datareader(hbReader); hbReader = null; } if(null != tsReader) { subscriber.delete_datareader(tsReader); tsReader = null; } DomainParticipant participant = publisher.get_participant(); if(null != cfHbTopic) { participant.delete_contentfilteredtopic(cfHbTopic); cfHbTopic = null; } if(null != cfTsTopic) { participant.delete_contentfilteredtopic(cfTsTopic); cfTsTopic = null; } if(null != hbTopic) { participant.delete_topic(hbTopic); hbTopic = null; } if(null != tsTopic) { participant.delete_topic(tsTopic); tsTopic = null; } }); } TimeManager(ScheduledExecutorService executor, EventLoop eventLoop, Publisher publisher, Subscriber subscriber, DeviceIdentity deviceIdentifier);  TimeManager(ScheduledExecutorService executor, EventLoop eventLoop, Publisher publisher, Subscriber subscriber, DeviceIdentity deviceIdentifier, String type);  TimeManager(ScheduledExecutorService executor, EventLoop eventLoop, Publisher publisher, Subscriber subscriber, String deviceIdentifier);  TimeManager(ScheduledExecutorService executor, EventLoop eventLoop, Publisher publisher, Subscriber subscriber, String deviceIdentifier, String type); void addListener(TimeManagerListener listener); void removeListener(TimeManagerListener listener); void start(); void stop(); static final String getHostname(ParticipantBuiltinTopicData participantData);  }
@Test public void testDetectNoDevice() throws Exception { waitForSizeOrTimeout(1, DEFAULT_TIMEOUT, () -> assertEquals("device never found", 1, liveUdis1.size())); t1.stop(); waitForSizeOrTimeout(0, DEFAULT_TIMEOUT, () -> assertEquals("device didn't go away", 0, liveUdis1.size())); }