0
votes
1answer
30 views
Painting a Runnable JPanel
I am working on this little Horse race simulator and am stuck with it. I want the user to first select the number of horses in the race (2-6) and click on the "Start" button. Then, I want to ...
0
votes
0answers
8 views
javax.jcr.RepositoryException: This session has been closed. (Wicket, Brix, Multithreading)
I have a very large project in which I am performing parallel processing of large files (5mb) which are stored as nodes within brix repositry. The load nodes as input stream, but the problem is that ...
-1
votes
1answer
60 views
Complex Thread Control
Suppose I have 3 threads of execution, below describes what each thread will do.
Thread 1 - main thread
Thread 2 - detector thread
Thread 3 - action thread
When thread 1 starts, it spawns thread 2. ...
2
votes
3answers
61 views
Different ways of calling sleep method in threads
I am a beginner to threading. I dont know exactly what is the difference between the three different types of way the thread object has called the sleep method. Also can you please clarify in which ...
0
votes
1answer
73 views
Running threads in round robin fashion in java
I am new to Multithreading and synchronization in java. I am trying to achieve a task in which i am given 5 files, each file will be read by one particular thread. Every thread should read one line ...
2
votes
1answer
57 views
Parameter-free call to method in same class yields NullPointerException
I've seen my fair share of weird errors but this time, I'm completely stumped. I'm getting a NullPointerException when trying to call a method in the same class.
First off, some of the code. Let's ...
1
vote
2answers
57 views
Java threads checking for change on non-volatile variable seems to take forever
I'm sorry if I'm doing a bad thing with this, but I have a question which is a spin-off of this question here:
Why volatile in java 5+ doesn't synchronize cached copies of variables with main ...
3
votes
0answers
90 views
Swing Thread Safe Programming
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus ...
-1
votes
2answers
51 views
Warning message “uses or overrides a deprecated API” encountered during code compilation
I compiled my program and I got the following error. How should I resolve it?
Note: ClientThreadClients.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
1
vote
4answers
52 views
What Do I exactly need to Synchronize, Object or Data inside object
Suppose I have a class [X] (and its object [xObject]) and within it two Integers [A] and [B]. I have two threads One modifies [A] and other modifies [B].
Now, since both threads change the value of ...
-3
votes
1answer
26 views
reading multiple files from multiple threads [on hold]
I want to read files one after another in strict order.After reading a portion from one file , the associated thread will sleep and another will start , this will go till all the lines from all the ...
0
votes
4answers
90 views
How can I make a Java thread always run before another thread?
In my program, when a user enters a number, the program sends that number to the server through sockets and the server sends back data matching that number. The number represents a service level. The ...
2
votes
2answers
56 views
Is there a way to know if a user pressed the key ENTER using readline() method? - Java
I want to recognize if a user sent a text, using readline method from BufferedReader. While the user didn't send anything, the Thread keeps sleeping. Is there a way to do this? I'm trying for a long ...
0
votes
4answers
72 views
Threading slows down the PC and causes a java.lang.OutOfMemoryError
What I am doing is making a program that constantly takes screenshots of the users desktop and saves them as long as the user wants. I was initially placed a call to the method that captures in a ...
0
votes
2answers
40 views
Get all the data from the database first time and if any entries got changed then print out only the change
I am working on a project in which I need to print out the data from the database. Let's take an example, suppose in my database, I have below entries only-
Hello 1.0.0
World 1.0.0
Then my Java ...
0
votes
2answers
44 views
Thread-per-request tcp server
I am just trying to understand how to write a thread-per-request TCP server in Java.
I have already written a thread-per-connection server, that runs serverSocket.accept() and creates a new thread ...
0
votes
0answers
39 views
Java Chat - How to client can listen continuously from the server [on hold]
I'm working on a university project were I was asked to create a java chat using sockets and other java features. I have managed to complete basically the whole assignment (but the GUI part, and ...
1
vote
1answer
49 views
Why do I get this error in my TimerTask?
08-17 18:26:44.540: E/AndroidRuntime(2405): FATAL EXCEPTION: Scheduler
08-17 18:26:44.540: E/AndroidRuntime(2405): java.lang.IllegalThreadStateException: Thread already started.
08-17 18:26:44.540: ...
0
votes
0answers
33 views
excute a post task in ListenableFuture not work
When i try to asyn to upload a file use ListenableFuture,but it is not work.
if it is syn, it work ok.
ListenableFuture not support to excute a post to remote? i found a sample using URL.openStream() ...
3
votes
4answers
88 views
How to use AsyncTask
AsyncTask question
I've followed some tutorials but it still isn't clear to me. Here's the code I currently have with some questions below the code. MainActivity calls SomeClassWithHTTPNeeds, which ...
2
votes
3answers
68 views
Java - Check if a port is in use without connecting to it
My situation:
I have two threads running at the same time, one thread wants to wait until a port is in use by the other thread, which will run through a certain number of steps before it reaches the ...
0
votes
1answer
17 views
Intercept Thead end in a Web App
given the code bellow how can I log resquest time just when the thread ends to get just one final RequestTime?
@Override
public void doFilter(ServletRequest request, ServletResponse response, ...
0
votes
1answer
49 views
Serial write with thread in Java
I am using a java thread while serial communication with the device. It works fine absolutely perfect in debug mode but when I run the program then the thread does not execute instructions.Am using ...
3
votes
6answers
69 views
Trying to recreate java.util.ConcurrentModificationException
Code looks like this: The maps being used here are Guava maps
private Map<SomeObject, SomeOtherObject> myMap = Maps.newLinkedHashMap();
public Map<SomeObject, SomeOtherObject> getMap() ...
-3
votes
2answers
52 views
Does having multiple threads speed up a program? [on hold]
If for example I had 5 images moving around the screen. Would it be any faster having 5 separate threads for each image or the same speed if I had just one thread moving all images?
In my game I use ...
2
votes
3answers
55 views
child thread to parent thread communication
I am working on a java multi-threaded application on Android.
Thread 1: Listener Thread.
keep listening on a socket, fires 2nd thread for some action
Thread 2: Action Thread.
short lived. get fired ...
0
votes
2answers
61 views
Are Java threads created in user space or kernel space?
Check this code out
Thread t1 = new Thread(new Runnable() {
@Override
public void run()
{
try
{
System.out.println("STARTING ...
2
votes
1answer
36 views
Tunneling two socket client in java
I'm trying to interconnect two socket clients connected to a single remote server.
The case is:
Client_1] connect to the server
Client_2] connect to the server
Server] create a tunnel between ...
0
votes
2answers
69 views
Bad practice to wait for service to return?
I'm calling a Spring web service which takes approx 5 seconds to return a response.
The webservice call takes place within the Tomcat container prior to being deployed to websphere.
I've been told by ...
0
votes
2answers
68 views
In java how can I get a return value from a thread?
The following code compiles but results in a null pointer exception at run time.
My best guess is outputInts is not "visible" to each thread and therefore cannot be written to.
public class myClass{
...