-
Notifications
You must be signed in to change notification settings - Fork 136
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make DiscoveryServer stream ID global
When surfacing V2 and V3 streams alongside each other in envoy-control, DiscoveryServerCallbacks are unable to differentiate between V2 & V3 ADS upon onStreamClose(), onStreamCloseWithError(). This means that any DiscoveryServerCallback that keeps state cannot pivot on stream IDs, since there will be duplicate between V2 & V3. This change creates a global StreamCounter, which ensures stream IDs will be unique across V2 & V3 streams. Signed-off-by: Stephanie Tilden <[email protected]>
- Loading branch information
Stephanie Tilden
committed
Dec 16, 2020
1 parent
ff834cb
commit 91da9e9
Showing
2 changed files
with
12 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
server/src/main/java/io/envoyproxy/controlplane/server/StreamCounter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package io.envoyproxy.controlplane.server; | ||
|
||
import java.util.concurrent.atomic.AtomicLong; | ||
|
||
public final class StreamCounter { | ||
private static final AtomicLong streamCount = new AtomicLong(); | ||
|
||
public static long getAndIncrement() { | ||
return streamCount.getAndIncrement(); | ||
} | ||
} |