You should post a SSCCE. It not only makes it easy for people to help you; it is also a powerful step toward solving your problem yourself. In preparing your SSCCE, you may find that you don't really need help.
Threads can be tricky. You can rarely depend on them for anything. The best place to discover exactly what you can depend on is the Java Language Specification for threads: http://docs.oracle.com/javase/specs/jls/se7/html/jls-17.html
When it comes to interleaving of threads, you should remember Item 72 of Effective Java Second Edition: "Don't depend on the thread scheduler." It sounds like you are hoping that your threads will toss the processor back and forth like a hot potato. If that is what you mean by interleaving, then remember Item 72 and force it to happen instead of depending on the thread scheduler to make it happen. Always assume that the thread you least want to be running will be the one chosen by the scheduler; the only way you can stop it from happening is by putting that thread to sleep, such as with
Object.wait, or by forcing it to wait to enter a
synchronized block. A well-behaved thread will stop frequently so that other threads get a chance to run even when the scheduler is doing its best to prevent it. Also, don't expect
Thread.yield to help because all that does is suggest that the scheduler consider choosing another thread to run, which is very little help when the scheduler always chooses the wrong thread.
Edited 3 Years Ago by bguild
Hi I'm having a problem implementing a mini shopping cart drop down in the header to show the user all the products they have in their shopping cart. It seems the only solution for this is Ajax, and I've looked all over and can't find anything that I could possibly ...
Hello All ...
Iam Getting An Error With try to excecute the stored procedure .
I have Have Sql database , the stored procedure like so :
USE [MPRS] GO /****** Object: StoredProcedure [dbo].[Search_Licenses_By_Number] Script Date: 26-Nov-16 8:06:52 AM ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER PROCEDURE ...
Help! I want to create a java program that finds the highest even integer among the values entered by the user. Stop asking values when a value less than 1 have been entered. If no even integer is entered, display "No Even Integer"
Here is the sample output that I ...