steam-condenser icon indicating copy to clipboard operation
steam-condenser copied to clipboard

Java - Multithreading

Open Khanattila opened this issue 8 years ago • 1 comments

An example in pseudocode.

List<SteamId> steamUsers; List<SteamGame> steamGames;

steamUsers.stream().forEach((user) -> {
            try {
                steamGames.addAll(user.getGames().values());
            } catch (SteamCondenserException ex) {
                Logger.getLogger(...).log(...);
            }
});

You can not make it multithreaded? I tried different solutions but does not work.

Caused by: com.github.koraktor.steamcondenser.exceptions.SteamCondenserException: XML data could not be parsed: FWK005 parse may not be called while parsing.

Khanattila avatar Mar 13 '16 20:03 Khanattila

Steam Condenser’s Java implementation uses a static DocumentBuilder instance which is reused for all XML parsing. That prevents it from being capable of multi-threading.

Initially, XMLData should be removed in version 2.0.0 as Valve deprecated its XML APIs. As there‘s still no full-featured Web API, this might change, though. So I might consider this.

However, the master branch already uses the Web API for most parts, e.g. SteamId#getGames(). So you might have more luck with that branch.

koraktor avatar Mar 18 '16 06:03 koraktor