public void removeSubscription(final int streamId, final int sessionId) { final StreamInterest streamInterest = streamInterestByIdMap.get(streamId); if (null == streamInterest) { throw new UnknownSubscriptionException("No subscription registered on stream " + streamId); } final SessionInterest sessionInterest = streamInterest.sessionInterestByIdMap.remove(sessionId); if (null != sessionInterest && null != sessionInterest.image) { sessionInterest.image.ifActiveGoInactive(); } streamInterest.subscribedSessionIds.remove(sessionId); if (!streamInterest.isForAllSessions && streamInterest.subscribedSessionIds.isEmpty()) { streamInterestByIdMap.remove(streamId); } }
public void removeSubscription(final int streamId) { final StreamInterest streamInterest = streamInterestByIdMap.get(streamId); if (null == streamInterest) { throw new UnknownSubscriptionException("No subscription registered on stream " + streamId); } for (final int sessionId : streamInterest.sessionInterestByIdMap.keySet()) { final SessionInterest sessionInterest = streamInterest.sessionInterestByIdMap.get(sessionId); if (!streamInterest.subscribedSessionIds.contains(sessionId)) { if (null != sessionInterest.image) { sessionInterest.image.ifActiveGoInactive(); } streamInterest.sessionInterestByIdMap.remove(sessionId); } } streamInterest.isForAllSessions = false; if (streamInterest.subscribedSessionIds.isEmpty()) { streamInterestByIdMap.remove(streamId); } }
@Test public void isEmptyAfterRemovingEqualSet() { addTwoElements(testSet); final HashSet<Integer> equal = new HashSet<>(); addTwoElements(equal); assertTrue(testSet.removeAll(equal)); assertTrue(testSet.isEmpty()); }
@Test public void isEmptyAfterRemovingEqualSetPrimitive() { addTwoElements(testSet); final IntHashSet equal = new IntHashSet(100); addTwoElements(equal); assertTrue(testSet.removeAll(equal)); assertTrue(testSet.isEmpty()); }
public void removeSubscription(final int streamId, final int sessionId) { final StreamInterest streamInterest = streamInterestByIdMap.get(streamId); if (null == streamInterest) { throw new UnknownSubscriptionException("No subscription registered on stream " + streamId); } final SessionInterest sessionInterest = streamInterest.sessionInterestByIdMap.remove(sessionId); if (null != sessionInterest && null != sessionInterest.image) { sessionInterest.image.ifActiveGoInactive(); } streamInterest.subscribedSessionIds.remove(sessionId); if (!streamInterest.isForAllSessions && streamInterest.subscribedSessionIds.isEmpty()) { streamInterestByIdMap.remove(streamId); } }
public void removeSubscription(final int streamId, final int sessionId) { final StreamInterest streamInterest = streamInterestByIdMap.get(streamId); if (null == streamInterest) { throw new UnknownSubscriptionException("No subscription registered on stream " + streamId); } final SessionInterest sessionInterest = streamInterest.sessionInterestByIdMap.remove(sessionId); if (null != sessionInterest && null != sessionInterest.image) { sessionInterest.image.ifActiveGoInactive(); } streamInterest.subscribedSessionIds.remove(sessionId); if (!streamInterest.isForAllSessions && streamInterest.subscribedSessionIds.isEmpty()) { streamInterestByIdMap.remove(streamId); } }
void awaitReady() { while (!trackedSessionIds.isEmpty()) { final IntIterator sessionIdIterator = trackedSessionIds.iterator(); while (sessionIdIterator.hasNext()) { final int sessionId = sessionIdIterator.nextValue(); if (hasRecordingStarted(sessionId)) { sessionIdIterator.remove(); } } idleStrategy.idle(); } idleStrategy.reset(); }
public void removeSubscription(final int streamId) { final StreamInterest streamInterest = streamInterestByIdMap.get(streamId); if (null == streamInterest) { throw new UnknownSubscriptionException("No subscription registered on stream " + streamId); } for (final int sessionId : streamInterest.sessionInterestByIdMap.keySet()) { final SessionInterest sessionInterest = streamInterest.sessionInterestByIdMap.get(sessionId); if (!streamInterest.subscribedSessionIds.contains(sessionId)) { if (null != sessionInterest.image) { sessionInterest.image.ifActiveGoInactive(); } streamInterest.sessionInterestByIdMap.remove(sessionId); } } streamInterest.isForAllSessions = false; if (streamInterest.subscribedSessionIds.isEmpty()) { streamInterestByIdMap.remove(streamId); } }
public void removeSubscription(final int streamId) { final StreamInterest streamInterest = streamInterestByIdMap.get(streamId); if (null == streamInterest) { throw new UnknownSubscriptionException("No subscription registered on stream " + streamId); } for (final int sessionId : streamInterest.sessionInterestByIdMap.keySet()) { final SessionInterest sessionInterest = streamInterest.sessionInterestByIdMap.get(sessionId); if (!streamInterest.subscribedSessionIds.contains(sessionId)) { if (null != sessionInterest.image) { sessionInterest.image.ifActiveGoInactive(); } streamInterest.sessionInterestByIdMap.remove(sessionId); } } streamInterest.isForAllSessions = false; if (streamInterest.subscribedSessionIds.isEmpty()) { streamInterestByIdMap.remove(streamId); } }