Browse DevX
Sign up for e-mail newsletters from DevX

Search the Tips
Tip Bank > Java > Threading

Threading - Page 2

21-40 of 72     Previous     Next
How to Share a Handle Between Two Threads
by Rajesh Chathapuram
Whenever a handle is passed to another thread, use the DuplicateHandle ...
Making a Thread-Safe or Synchronized Collection
by Shantanu Garg
As you know by now, the commonly used collection classes, such as java.util.ArrayList, are not synchronized. However, if there's a chance that two threads could be altering a collection ...
Accessing Class Members From the Static Member Function
by Rajesh Chathapuram
When a class has Thread entry functions, it is usually declared as static member functions of the class as in the example ...
Take Control of the Threads Created By a Program
by Shantanu Garg
Whenever a thread is created in a program, it is unknown when it will execute. This means there may be cases where the parent program has finished but the thread is still executing. One way to ...
Portable Locks
by Danny Kalev
Sometimes you need to make sure that only one instance of the same application can run at any given time. Although every platform defines different locking schemes, you can use the following ...
Threads and JDBC Connections
by DevX Pro
Is the JDBC Connection class thread safe? In other words, can a connection be shared between multiple threads without using synchronization?
Synchronized Method Overhead
by DevX Pro
I am interested in keeping my code running as fast as possible. Is there a cost associated with making my methods synchronized, and if so, how significant a cost?
Threading and SimpleDateFormat
by DevX Pro
Is SimpleDateFormat threadsafe? I am trying to track down a bug where a date formatted "yyyy-MM-dd" actually came out as 2000-06-0001. I have four threads accessing the format method of my date formatter class at approximately the same time.
Identify Atomic and Non-Atomic Operations
by C.V. Ram
In Java, the reading and writing of 32-bit or smaller quantities are guaranteed to be atomic. By atomic we mean each action takes place in one step and cannot be interrupted. Thus, when we have ...
Re-entrant Functions
by Danny Kalev
A function that can be safely called while it's already executing is said to be re-entrant. The C++ standard doesn't state whether the Standard Library's functions are re-entrant; this is an ...
System Shutdown
by DevX Pro
Is there an API that I can use to sense that the system is shutting down?
Stopping Threads
by DevX Pro
How do you stop a Thread without using the stop() method?
Designing Applications for Symmetric Multiprocessing Environments
by Danny Kalev
Many modern operating systems support Symmetric Multiprocessing (SMP)—a hardware architecture that uses two or more processors on one machine and enables you to achieve true multitasking. On ...
Accessing an Object From Another Process
by Danny Kalev
On modern operating systems, a process consists of an executable file that the OS loads into the system's memory and executes. A process normally has an entry point and one or more exit points. The ...
AWT Thread Interaction
by DevX Pro
I have two threads in an application. Thread A displays a form and allows the user to interact with it, thread B executes a loop which continually retrieves data and updates the form object by executing a synchronized method in the form object. I first tried to code thread A to use the showDialog() method on the form object, then started thread a and then thread b. However, thread a starts and the form then waits to be closed before the statement starting thread b is executed. I then tried just using the show() method in thread a - this allows the start of thread b to execute but I lose my interaction with the form.
Volatile Semantics and Container Objects
by Danny Kalev
Volatile objects are used in multithreaded applications and applications that map hardware devices into registers. Although you can declare an STL container object with the volatile qualifier, you ...
Multithreading Misconceptions
by Danny Kalev
Force an Object to Destroy Itself
by Danny Kalev
Sometimes, you need to force an object to destroy itself because its destructor performs an operation needed immediately. For example, when you want to release a mutex or close a ...
Get all your Threads and Thread Groups
by Behrouz Fallahi
It might be useful to garner an enumeration of all thread groups and ...
Useful Thread Terminology
by Behrouz Fallahi
Java makes working with threads relatively straight forward. However, there are situations, or anomalies that can arise due to improper design of a thread-based code. The following provides you with ...
21-40 of 72     Previous     Next
Thanks for your registration, follow us on our social networks to keep up-to-date