/** * {@inheritDoc} */ public void putAll(final Map<? extends K, ? extends V> map) { for (final Entry<? extends K, ? extends V> entry : map.entrySet()) { put(entry.getKey(), entry.getValue()); } }
public Map<Long, Long> create(final Object... entries) { final Object2ObjectHashMap<Long, Long> map = new Object2ObjectHashMap<>( entries.length * 2, Hashing.DEFAULT_LOAD_FACTOR, false); for (final Object o : entries) { @SuppressWarnings("unchecked") final Map.Entry<Long, Long> e = (Map.Entry<Long, Long>)o; map.put(e.getKey(), e.getValue()); } return map; }
public int hashCode() { return entrySet().hashCode(); }
/** * Compact the backing arrays by rehashing with a capacity just larger than current size * and giving consideration to the load factor. */ public void compact() { final int idealCapacity = (int)Math.round(size() * (1.0d / loadFactor)); rehash(findNextPositivePowerOfTwo(Math.max(MIN_CAPACITY, idealCapacity))); }
private SendChannelEndpoint findExistingSendChannelEndpoint(final UdpChannel udpChannel) { if (udpChannel.hasTag()) { for (final SendChannelEndpoint endpoint : sendChannelEndpointByChannelMap.values()) { final UdpChannel endpointUdpChannel = endpoint.udpChannel(); if (endpointUdpChannel.doesTagMatch(udpChannel)) { return endpoint; } } } return sendChannelEndpointByChannelMap.get(udpChannel.canonicalForm()); }
final String strippedChannel = strippedChannelBuilder(channelUri).build(); final String key = makeKey(streamId, channelUri); final Subscription oldSubscription = recordingSubscriptionMap.get(key); recordingSubscriptionMap.put(key, subscription); controlSession.sendOkResponse(correlationId, subscription.registrationId(), controlResponseProxy);
void stopRecording( final long correlationId, final ControlSession controlSession, final int streamId, final String channel) { try { final String key = makeKey(streamId, ChannelUri.parse(channel)); final Subscription oldSubscription = recordingSubscriptionMap.remove(key); if (oldSubscription != null) { oldSubscription.close(); controlSession.sendOkResponse(correlationId, controlResponseProxy); } else { final String msg = "no recording found for streamId=" + streamId + " channel=" + channel; controlSession.sendErrorResponse(correlationId, UNKNOWN_SUBSCRIPTION, msg, controlResponseProxy); } } catch (final Exception ex) { errorHandler.onError(ex); controlSession.sendErrorResponse(correlationId, ex.getMessage(), controlResponseProxy); } }
SendChannelEndpoint senderChannelEndpoint(final UdpChannel channel) { return sendChannelEndpointByChannelMap.get(channel.canonicalForm()); }
/** * {@inheritDoc} */ public String toString() { if (isEmpty()) { return "{}"; } final EntryIterator entryIterator = new EntryIterator(); entryIterator.reset(); final StringBuilder sb = new StringBuilder().append('{'); while (true) { entryIterator.next(); sb.append(entryIterator.getKey()).append('=').append(unmapNullValue(entryIterator.getValue())); if (!entryIterator.hasNext()) { return sb.append('}').toString(); } sb.append(',').append(' '); } }
final Map<String, String> params = new Object2ObjectHashMap<>(); String media = null; String key = null;
protected void postSessionsClose() { if (!ctx.ownsAeronClient()) { for (final Subscription subscription : recordingSubscriptionMap.values()) { subscription.close(); } CloseHelper.close(localControlSubscription); CloseHelper.close(controlSubscription); CloseHelper.close(recordingEventsProxy); } ctx.close(); }
final String strippedChannel = strippedChannelBuilder(channelUri).build(); final String key = makeKey(streamId, channelUri); final Subscription oldSubscription = recordingSubscriptionMap.get(key); recordingSubscriptionMap.put(key, subscription); controlSession.sendOkResponse(correlationId, subscription.registrationId(), controlResponseProxy);
private ReceiveChannelEndpoint findExistingReceiveChannelEndpoint(final UdpChannel udpChannel) { if (udpChannel.hasTag()) { for (final ReceiveChannelEndpoint endpoint : receiveChannelEndpointByChannelMap.values()) { final UdpChannel endpointUdpChannel = endpoint.udpChannel(); if (endpointUdpChannel.doesTagMatch(udpChannel)) { return endpoint; } } } return receiveChannelEndpointByChannelMap.get(udpChannel.canonicalForm()); }
void cleanupPublication(final NetworkPublication publication) { activeSessionIds.remove(publication.sessionId()); senderProxy.removeNetworkPublication(publication); final SendChannelEndpoint channelEndpoint = publication.channelEndpoint(); if (channelEndpoint.shouldBeClosed()) { channelEndpoint.closeStatusIndicator(); sendChannelEndpointByChannelMap.remove(channelEndpoint.udpChannel().canonicalForm()); senderProxy.closeSendChannelEndpoint(channelEndpoint); } }
ReceiveChannelEndpoint receiverChannelEndpoint(final UdpChannel channel) { return receiveChannelEndpointByChannelMap.get(channel.canonicalForm()); }
/** * Compact the backing arrays by rehashing with a capacity just larger than current size * and giving consideration to the load factor. */ public void compact() { final int idealCapacity = (int)Math.round(size() * (1.0d / loadFactor)); rehash(findNextPositivePowerOfTwo(Math.max(MIN_CAPACITY, idealCapacity))); }
/** * {@inheritDoc} */ public String toString() { if (isEmpty()) { return "{}"; } final EntryIterator entryIterator = new EntryIterator(); entryIterator.reset(); final StringBuilder sb = new StringBuilder().append('{'); while (true) { entryIterator.next(); sb.append(entryIterator.getKey()).append('=').append(unmapNullValue(entryIterator.getValue())); if (!entryIterator.hasNext()) { return sb.append('}').toString(); } sb.append(',').append(' '); } }
final Map<String, String> params = new Object2ObjectHashMap<>(); String media = null; String key = null;
protected void postSessionsClose() { if (!ctx.ownsAeronClient()) { for (final Subscription subscription : recordingSubscriptionMap.values()) { subscription.close(); } CloseHelper.close(localControlSubscription); CloseHelper.close(controlSubscription); CloseHelper.close(recordingEventsProxy); } ctx.close(); }