Skip to content

Commit

Permalink
ALPNManager.getProvider no longer allocates an iterator
Browse files Browse the repository at this point in the history
Use an array for more efficient looping.
  • Loading branch information
carterkozak committed May 17, 2018
1 parent 2e17d50 commit 41e8ff4
Showing 1 changed file with 2 additions and 2 deletions.
Expand Up @@ -30,7 +30,7 @@
*/
public class ALPNManager {

private final List<ALPNProvider> alpnProviders;
private final ALPNProvider[] alpnProviders;

public static final ALPNManager INSTANCE = new ALPNManager(ALPNManager.class.getClassLoader());

Expand All @@ -46,7 +46,7 @@ public int compare(ALPNProvider o1, ALPNProvider o2) {
return Integer.compare(o2.getPriority(), o1.getPriority()); //highest first
}
});
this.alpnProviders = Collections.unmodifiableList(provider);
this.alpnProviders = provider.toArray(new ALPNProvider[0]);
}

public ALPNProvider getProvider(SSLEngine engine) {
Expand Down

0 comments on commit 41e8ff4

Please sign in to comment.