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

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.

Search the Tips
Tip Bank > Java > Threading

Threading - Page 4

61-72 of 72     Previous     Next
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 ...
How to kill/dispose of applet thread when you leave page
by DevX Pro
I have an applet placed on successive pages that displays different information on each page (a text-scrolling applet). This applet is running on a thread. Is there a way to kill or dispose of this thread when you leave the page on which it was created? I have noticed that from time to time that when I quit using the browser, I can still see the applet scrolling across until Netscape completely disposes of all its memory.
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?
Difference between yield() and sleep()
by DevX Pro
What is the difference between calling yield() and sleep()? Also, in what instances would you call either method?
How to Keep Track of Number of Threads or Connections
by DevX Pro
I have a server application listening for client applets to connect. The server spawns a new thread each time a connection to a client is established. I want to keep track, i.e. count the number of clients connected and output it to a textfield in a frame. I am not sure how Java handles shared data among threads so my question is: How does one keep track of the number of threads or connections? I want the number of threads to be displayed in a single frame; I tried something, but a new window is created each time a new thread is spawned.
How to Prevent Simultaneous Access
by DevX Pro
How do you lock a file in Java to prevent simultaneous multiple accesses?
Passing Data Between Two Threads
by DevX Pro
I am new to Java and am currently trying to associate idioms and techniques from other languages/environments with like capabilities in Java. Specifically, I am trying to determine how to perform inter-thread and inter-process communication. How does one pass data, in the form of an Object or Object reference, between two threads?
What is the Thread.interrupt()method's purpose?
by DevX Pro
What is the purpose of the Thread.interrupt() method? I expect that if I call the interrupt() method of a sleeping thread, an InterruptedException will be thrown. Here is a quick code sample showing my thoughts (please forgive the formatting):*/ class Timer extends Thread { public void run() { for(int i = 0; i I expect that when s.foo() is called, I will see output resembling Interrupted! What am I missing?
Why Does Spawned Thread Work on PC and not Sun?
by DevX Pro
This may be too vague, but: I spawn a thread (after a button click) which brings up a new window. This works great on my PC running Netscape 3.0 and Internet Explorer, but it doesn't work on a Sun (Netscape 3.0). I've also tried it on another PC running Internet Explorer and it didn't work there, either. Any clues?
61-72 of 72     Previous     Next
We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.
Thanks for your registration, follow us on our social networks to keep up-to-date