Open klehmann opened 5 years ago
In the Server class (https://github.com/alwx/react-native-http-bridge/blob/master/android/src/main/java/me/alwx/HttpServer/Server.java#L30) you are using a HashMap to store the pending requests. Since HashMap is not Thread-safe, this class needs to be synchronized, e.g. by wrapping it in Collections.synchronizedMap(...), to avoid multi threading effects.
Collections.synchronizedMap(...)
In the Server class (https://github.com/alwx/react-native-http-bridge/blob/master/android/src/main/java/me/alwx/HttpServer/Server.java#L30) you are using a HashMap to store the pending requests. Since HashMap is not Thread-safe, this class needs to be synchronized, e.g. by wrapping it in
Collections.synchronizedMap(...)
, to avoid multi threading effects.