Java Threads and enum

java , threads , enum , count United Kingdom
  • 8 years ago
    I am new to Java and have got stuck. I have multiple threads traveling in different directions. The various directions are set up as an enum and are North, South, East and West. All the treads start concurrently. How can I tell how many of the threads are travelling North for example. I tried using Thread.enumerate(threads); but so far this hasn't helped me. Obvious .activeCount() just gives me the total number of threads running. I need to test the number of threads running in a certain direction so that I can process the next stage. Any help you can give would be fab. Thanks
  • 8 years ago
    I am new to Java and have got stuck. I have multiple threads traveling in different directions. The various directions are set up as an enum and are North, South, East and West. All the treads start concurrently. How can I tell how many of the threads are travelling North for example. I tried using Thread.enumerate(threads); but so far this hasn't helped me. Obvious .activeCount() just gives me the total number of threads running. I need to test the number of threads running in a certain direction so that I can process the next stage. Any help you can give would be fab. Thanks

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“In theory, theory and practice are the same. In practice, they're not.”