Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

Search the Tips
Tip Bank > Java > Threading

Threading - Page 3

41-60 of 67     Previous     Next
Running Piped Threads
by Ajit Sagar
Each piped thread has a run() method, and in an application using piped streams, their run() methods are interdependent. These code excerpts illustrate the run() methods for a PipedInputStream ("in_") and a PipedOutputStream ("out_").
Threading Piped Streams
by Ajit Sagar
Though piped streams are typically used in separate threads, you can use this class to connect them together.
Using Piped Streams in an Application
by Ajit Sagar
Learn how to create and use the PipedInputStream and PipedOutputStream objects in separate classes and in separate threads.
Java Virtual Machine Doesn't Exit
by Brett Spell
You may have been surprised and frustrated to find that in some cases, the Java Virtual Machine (JVM) does not stop running when your application exits the static main() method. For ...
Connecting the Piped Stream Classes
by Ajit Sagar
The no-argument default constructors for the piped stream classes create streams that are not connected to any other stream. This code shows you how to connect them.
Thread Timing
by DevX Pro
How can I determine the total time it takes for a set of threads to execute?
Event Thread and Painting
by Brett Spell
Java uses the event thread to notify listeners of events by making calls to methods such as actionPerformed() and itemStateChanged(). However, this same thread is also responsible for repainting ...
Pass Data Between Threads Using Piped Streams
by Ajit Sagar
These "piped stream" classes allow your program to read data into an input stream and write it out through an output stream in a single method call.
A Runnable Is Not a Thread
by Behrouz Fallahi
You may come across some situations where implementing a Runnable may have some advantages over extending Thread. If the class you are going to multi-thread is already extending another class, you ...
Starting a Thread Using the Thread Class or the Runnable Interface
by Ajit Sagar
You can start a thread in Java by either implementing the java.lang.Runnable interface or by extending the java.lang.Thread class (see Tip
C++ and Multithreading
by Danny Kalev
Standard C++ does not directly address the issue of multiprocessing, threads, and thread safety. This issue is implementation dependent, which enables vendors to decide whether or not to provide ...
Weaving Threads
by Ajit Sagar
Java provides two ways to create and run a thread. You can implement the Runnable interface or extend the Thread class. The Runnable interface defines a single method run(). Consider the following ...
DHTML Window Redraw
by DevX Pro
Is there any way to control the redrawing/repainting of the open window/document? Specifically, I have to change page elements (labels, cursor style) before calling some time intensive task. I have successfully implemented changes to the cursor style but it doesn't always change the display of the mouse cursor immediately.
Delaying a Program
by DevX Pro
Can you please tell me how to delay the program flow in Java? I can't find any implementation of delay().
Splash Page Creation
by DevX Pro
I would like to show a splash page and have it time out after approximately five seconds. How do I do that?
Java Threads and Multiple Processors
by DevX Pro
On a Windows NT box with multiple processors, will a multithreaded Java application get split between the processors automatically?
Object passing between threads
by DevX Pro
Am implementing a network simulation program that requires a sender and receiver thread, with a frame object being passed between the two threads. Could you suggest a way of connecting the threads by means of an object stream that would allow the object to be passed between the two threads. What is required is much like the pipe implementation in c except from what I gather in java the data types that can be sent are limited.
Java Pausing Abilities
by DevX Pro
I want to make my Java program pause for a specified amount of time, but I don't want to use a threading implementation. How can I do this?
Multithreading Applets—the Right Way
by Paul Tyma
The canonical design of multithreaded applets is inherently flawed. You know what I'm talking about: the run method with the repaint/sleep statements embedded in a while(true). Any self-respecting ...
by DevX Pro
I recently took Sun's Certified Java Programmers Exam and I ran into a few questions from the exam I'd like to ask you. What is the difference between >> and >>>? For example let's say you have: int x = 64; what is x >> 4? what is x >>> 4? I get 4 for both. What can be said about garbage collection? Select all true statements: a. It will be done so that your program will never run out of memory (within reason). b.It happens at predictable times. c.You can flag an object for collection. d.You can call a method to have an object explicitly collected. Under which circumstance would a thread stop execution? Select all true statements: a.A thread with a higher priority becomes run-able. b.The priority of the running thread is changed. c.Thread objects of the same class terminates. If you have an object and then you set it to null: SomeObject ob = new SomeObject(); ob = null; after you set ob to null, is the object available for garbage collection?
41-60 of 67     Previous     Next
Thanks for your registration, follow us on our social networks to keep up-to-date