Questions tagged [non-thread-safe]

A program or library is non-thread-safe, when usage in a threaded environment can provoke errors.

A program or library is non-thread-safe, when usage in a threaded environment can provoke errors.

8 questions
5
votes
1 answer

Is this null pointer exception in TreeMap due to concurrent access?

I know that TreeMap is not thread safe. I am trying to do a comparison of TreeMap with ConcurrentSkipListMap. Code I use is shown below and I want to make sure if the error I am getting is due TreeMap not being threadsafe and not because of some…
Rajind Ruparathna
  • 2,215
  • 24
  • 55
2
votes
3 answers

unsynchronized read/write of variables may cause data race?

in Java Performance Tuning by Jack Shirazi it writes: This means that access and update of variables are automatically synchronized (as long as they are not longs or doubles). If a method consists solely of a variable access or assignment, there is…
choxsword
  • 3,187
  • 18
  • 44
2
votes
2 answers

Initializing a static Java constant from a non-thread-safe method

Let there be a class definition like public static class Bootstrapper { public static final Object DEFAULT_VALUE = getDefaultValue(); private static Object getDefaultValue() { if (DEFAULT_VALUE == null) { return…
PNS
  • 19,295
  • 32
  • 96
  • 143
1
vote
0 answers

Running Selenium Webdriver tests with TestNG in parallel does not sent correct data to browser

I have two TestNG classes with one test method in each. Each test class has its own @Dataprovider. Each test executes functionality on a web application using Selenium Webdriver. The driver is created for each TestNG class via a factory method and…
0
votes
0 answers

RHEL PHP 8.0 Non-Thread Safe Compilation

I have an application that I need to be using a non-thread-safe(nts) version of php 8.0 being built on current RHEL. I have tried a few different ways of recompiling php including this one to no avail. Checking the php info page, It still says that…
D3alWyth1t
  • 69
  • 3
  • 11
0
votes
1 answer

How to share a util object which is not thread safe in light-4j handler

I have generated code from an openapi yaml file. I'm implementing the handleRequest methods. I need to share the same instance of a "Util" object to reuse it in all the handleRequest calls. Could you please tell me where to store my Util object…
Steve Hu
  • 358
  • 2
  • 10
0
votes
0 answers

Making Thread run a Jframe

I am experienced programmer, but never used Java until recently. I have a class that works by copying code from the internet(huzzah), and the Jframe runs in its own thread when I run the code below as its own thread when using the main()…
BAMF4bacon
  • 523
  • 1
  • 7
  • 21
-1
votes
1 answer

Java class annotated with non thread safe

I have a java class that represents AWSSecretManager client with annotation @NonThreadSafe, am I allowed to use Singleton to get a single instance of that class?