vendredi 27 avril 2018

Tools on Java for Multithreading Testing

this is a simple question, I have never testing a program in Java, cause most of them are not multithreading, now the result is vary depends on time and luck, which is bad. I don't want my code not working when needed, example. Curently my IDE is IntelliJ

Currently my program I developed has worked as expected, and now since it is a concurrent programming with threads, I need to run like 100x and then a random error occurred. I did not want the program to to go infinite loop, instead of closing program.

Example Result:

Exit: Bus 37 exit the store
Size of Shop: 0
Cleaner : We're closing now!
Cleaner : We're closing now!
Depot : We're closing now!
Mechanics : We're closing now!
Mechanics : We're closing now!
Parking: We are closing now!

Process finished with exit code 0

This is the result when the program is OK

And sometimes the Result is this:

Ramp: Bus 37 using the ramp
Size of Shop: 2
Size of Shop: 2
Ramp: Bus 37 exit the ramp
Exit: Bus 37 exit the store
Size of Shop: 1
Size of Shop: 1
Size of Shop: 1
Size of Shop: 1
Size of Shop: 1
Size of Shop: 1
Size of Shop: 1
Size of Shop: 1
Size of Shop: 1
Size of Shop: 1
Size of Shop: 1
Size of Shop: 1
Size of Shop: 1
Size of Shop: 1
...

As seen here it goes forever, caused the program not exit. Is there a way to testing like 100x, make sure the program is close, which I can fix later on.

I just need the tools to make sure the Java will exit, as this is the condition for a successful program.

Thanks for the time.

Aucun commentaire:

Enregistrer un commentaire