Skip to content

Commit

Permalink
[Java] Make it clear that the recording is using a stripped down vers…
Browse files Browse the repository at this point in the history
…ion of the channel.
  • Loading branch information
mjpt777 committed Jul 17, 2017
1 parent b3c103c commit 317af37
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@
<field name="mtuLength" id="10" type="int32"/>
<field name="sessionId" id="11" type="int32"/>
<field name="streamId" id="12" type="int32"/>
<data name="channel" id="13" type="varAsciiEncoding"/>
<data name="strippedChannel" id="13" type="varAsciiEncoding"/>
<data name="originalChannel" id="14" type="varAsciiEncoding"/>
<data name="sourceIdentity" id="15" type="varAsciiEncoding"/>
</sbe:message>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,7 @@ void stopRecording(
{
try
{
final String minimalChannel = minimalChannelBuilder(channel).build();
final String key = makeKey(streamId, minimalChannel);
final String key = makeKey(streamId, strippedChannelBuilder(channel).build());
final Subscription oldSubscription = subscriptionMap.remove(key);
if (oldSubscription != null)
{
Expand Down Expand Up @@ -239,13 +238,13 @@ void startRecordingSubscription(
return;
}

final String minimalChannel = minimalChannelBuilder(originalChannel).build();
final String key = makeKey(streamId, minimalChannel);
final String strippedChannel = strippedChannelBuilder(originalChannel).build();
final String key = makeKey(streamId, strippedChannel);
final Subscription oldSubscription = subscriptionMap.get(key);
if (oldSubscription == null)
{
final Subscription subscription = aeron.addSubscription(
minimalChannel,
strippedChannel,
streamId,
image -> startImageRecording(originalChannel, image),
null);
Expand Down Expand Up @@ -361,7 +360,7 @@ Publication newControlPublication(final String channel, final int streamId)
final String controlChannel;
if (!channel.contains(CommonContext.TERM_LENGTH_PARAM_NAME))
{
controlChannel = minimalChannelBuilder(channel)
controlChannel = strippedChannelBuilder(channel)
.termLength(DEFAULT_CONTROL_TERM_LENGTH)
.build();
}
Expand All @@ -378,7 +377,7 @@ private static String makeKey(final int streamId, final String minimalChannel)
return streamId + ':' + minimalChannel;
}

private ChannelUriStringBuilder minimalChannelBuilder(final String channel)
private ChannelUriStringBuilder strippedChannelBuilder(final String channel)
{
final ChannelUri channelUri = ChannelUri.parse(channel);
channelBuilder
Expand Down Expand Up @@ -449,7 +448,7 @@ private ExclusivePublication newReplayPublication(
final int termId = (int)((fromPosition / termBufferLength) + initialTermId);
final int termOffset = (int)(fromPosition % termBufferLength);

final String channel = minimalChannelBuilder(replayChannel)
final String channel = strippedChannelBuilder(replayChannel)
.mtu(mtuLength)
.termLength(termBufferLength)
.initialTermId(initialTermId)
Expand Down
4 changes: 2 additions & 2 deletions aeron-archiver/src/main/java/io/aeron/archiver/Catalog.java
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ static void initDescriptor(
final int mtuLength,
final int sessionId,
final int streamId,
final String channel,
final String strippedChannel,
final String originalChannel,
final String sourceIdentity)
{
Expand All @@ -278,7 +278,7 @@ static void initDescriptor(
.mtuLength(mtuLength)
.sessionId(sessionId)
.streamId(streamId)
.channel(channel)
.strippedChannel(strippedChannel)
.originalChannel(originalChannel)
.sourceIdentity(sourceIdentity);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ private void handleRecordingDescriptor(
recordingDescriptorDecoder.mtuLength(),
recordingDescriptorDecoder.sessionId(),
recordingDescriptorDecoder.streamId(),
recordingDescriptorDecoder.channel(),
recordingDescriptorDecoder.strippedChannel(),
recordingDescriptorDecoder.originalChannel(),
recordingDescriptorDecoder.sourceIdentity());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public interface RecordingDescriptorConsumer
* @param mtuLength for the recorded publication.
* @param sessionId for the recorded publication.
* @param streamId for the recorded publication.
* @param channel for the recorded publication.
* @param strippedChannel for the recorded publication.
* @param originalChannel for the recorded publication.
* @param sourceIdentity for the recorded publication.
*/
Expand All @@ -53,7 +53,7 @@ void onRecordingDescriptor(
int mtuLength,
int sessionId,
int streamId,
String channel,
String strippedChannel,
String originalChannel,
String sourceIdentity);
}
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ public void onRecordingDescriptor(
final int mtuLength,
final int sessionId,
final int streamId,
final String channel,
final String strippedChannel,
final String originalChannel,
final String sourceIdentity)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ private void verifyRecordingForId(
final long id,
final int sessionId,
final int streamId,
final String channel,
final String strippedChannel,
final String sourceIdentity)
throws IOException
{
Expand All @@ -93,8 +93,8 @@ private void verifyRecordingForId(
assertEquals(id, recordingDescriptorDecoder.recordingId());
assertEquals(sessionId, recordingDescriptorDecoder.sessionId());
assertEquals(streamId, recordingDescriptorDecoder.streamId());
assertEquals(channel, recordingDescriptorDecoder.channel());
assertEquals(channel + "?tag=f", recordingDescriptorDecoder.originalChannel());
assertEquals(strippedChannel, recordingDescriptorDecoder.strippedChannel());
assertEquals(strippedChannel + "?tag=f", recordingDescriptorDecoder.originalChannel());
assertEquals(sourceIdentity, recordingDescriptorDecoder.sourceIdentity());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public void onRecordingDescriptor(
final int mtuLength,
final int sessionId,
final int streamId,
final String channel,
final String strippedChannel,
final String originalChannel,
final String sourceIdentity)
{
Expand Down

0 comments on commit 317af37

Please sign in to comment.