Repository navigation
Expand file tree
/
Copy pathWinParallelDemo.java
More file actions
59 lines (55 loc) · 2.19 KB
/
Copy pathWinParallelDemo.java
File metadata and controls
59 lines (55 loc) · 2.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/*
* Copyright 2018 National Bank of Belgium
*
* Licensed under the EUPL, Version 1.1 or - as soon they will be approved
* by the European Commission - subsequent versions of the EUPL (the "Licence");
* You may not use this work except in compliance with the Licence.
* You may obtain a copy of the Licence at:
*
* http://ec.europa.eu/idabc/eupl
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the Licence is distributed on an "AS IS" basis,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the Licence for the specific language governing permissions and
* limitations under the Licence.
*/
package _demo;
import internal.net.proxy.x.WinPowerShellProxySelector;
import java.net.Proxy;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.stream.Stream;
/**
*
* @author Philippe Charles
*/
public class WinParallelDemo {
public static void main(String[] args) throws URISyntaxException {
URI[] x = {
new URI("http://ec.europa.eu"),
new URI("http://dataservices.imf.org"),
new URI("http://data.un.org"),
new URI("https://sdmxcentral.imf.org"),
new URI("http://andmebaas.stat.ee"),
new URI("http://www.ilo.org"),
new URI("http://bdm.insee.fr"),
new URI("https://sdw-wsrest.ecb.europa.eu"),
new URI("http://sdmx.snieg.mx"),
new URI("https://stats.oecd.org"),
new URI("http://stat.data.abs.gov.au"),
new URI("https://stat.nbb.be"),
new URI("http://wits.worldbank.org"),
new URI("http://data.uis.unesco.org"),
new URI("https://api.worldbank.org"),
new URI("http://sdmx.istat.it")
};
WinPowerShellProxySelector proxySelector = new WinPowerShellProxySelector();
proxySelector.getProxyOrNull(new URI("http://localhost"));
Stream.of(x).parallel().forEach(o -> {
long start = System.currentTimeMillis();
Proxy p = proxySelector.getProxyOrNull(o);
System.out.println(o + " >>> " + p + " >>> " + (System.currentTimeMillis() - start));
});
}
}