Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply Optimize Java 8 Streams refactoring #2837

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ public AttributeNormalizer(Resource baseResource)
Collections.sort(paths,attrComparator);
Collections.sort(uris,attrComparator);

Stream.concat(paths.stream(),uris.stream()).forEach(a->attributes.put(a.key,a));
Stream.concat(paths.stream(),uris.parallelStream()).forEach(a->attributes.put(a.key,a));

if (LOG.isDebugEnabled())
{
Expand Down
10 changes: 5 additions & 5 deletions jetty-start/src/main/java/org/eclipse/jetty/start/Modules.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ public Modules(BaseHome basehome, StartArgs args)

public void dump(List<String> tags)
{
Set<String> exclude = tags.stream().filter(t->t.startsWith("-")).map(t->t.substring(1)).collect(Collectors.toSet());
Set<String> include = tags.stream().filter(t->!t.startsWith("-")).collect(Collectors.toSet());
Set<String> exclude = tags.parallelStream().filter(t->t.startsWith("-")).map(t->t.substring(1)).collect(Collectors.toSet());
Set<String> include = tags.parallelStream().filter(t->!t.startsWith("-")).collect(Collectors.toSet());
boolean all = include.contains("*") || include.isEmpty();
AtomicReference<String> tag = new AtomicReference<>();

Expand Down Expand Up @@ -246,7 +246,7 @@ public String toString()

public List<Module> getEnabled()
{
List<Module> enabled = _modules.stream().filter(m->{return m.isEnabled();}).collect(Collectors.toList());
List<Module> enabled = _modules.parallelStream().filter(m->{return m.isEnabled();}).collect(Collectors.toList());

TopologicalSort<Module> sort = new TopologicalSort<>();
for (Module module: enabled)
Expand Down Expand Up @@ -357,14 +357,14 @@ private void enable(Set<String> newlyEnabled, Module module, String enabledFrom,
if (providers==null || providers.isEmpty())
throw new UsageException("Module %s does not provide %s",_baseHome.toShortForm(file),dependsOn);

enable(newlyEnabled,providers.stream().findFirst().get(),"dynamic dependency of "+module.getName(),true);
enable(newlyEnabled,providers.parallelStream().findFirst().get(),"dynamic dependency of "+module.getName(),true);
continue;
}
throw new UsageException("No module found to provide %s for %s",dependsOn,module);
}

// If a provider is already enabled, then add a transitive enable
if (providers.stream().filter(Module::isEnabled).count()>0)
if (providers.parallelStream().filter(Module::isEnabled).count()>0)
providers.stream().filter(m->m.isEnabled()&&!m.equals(module)).forEach(m->enable(newlyEnabled,m,"transitive provider of "+dependsOn+" for "+module.getName(),true));
else
{
Expand Down