Tagged Questions
0
votes
1answer
14 views
Run multiple Timer tasks with different intervals in Java
Say I have the following code
Timer t1 = new Timer();
t1.scheduleAtFixedRate(new TimerTask() {
@Override
public void run(){
//TASK 1
}
},0,2000);
Timer t2 ...
0
votes
2answers
22 views
Can't create objects with an interval in Libgdx
I am developing a space ship game.
I have an EnemyFactory class to create enemies with this method:
public void createPattern(String patternJson, final String enemyJson, final Vector2 position) {
...
0
votes
1answer
32 views
Threadsafe within a thread?
I'm writing a program, in Java, to simulate a molecular algorithm. As the molecular algorithm inherently uses concurrency (you can have as many chemical reactions going as needed, as long as you have ...
0
votes
0answers
8 views
SwingWorker degrading performance
I have a program which implements a SwingWorker to run some resource intensive tasks in the background. They all work in the sense that they run simultaneously, although ive noticed that in fact the ...
-6
votes
1answer
17 views
How to make multiple clients to access a single server? [on hold]
I have the client - server code that works fine.
I am able to download files from server and upload too, but i want the same to be implemented for multiple clients.
Kindly help me!!!
3
votes
5answers
50 views
Alternatives of holding an instance of a class
I have an object which is essentially a data structure that has methods which need access to an instance of the 'Main' class (there can be multiple instances of this class). What I currently do is ...
1
vote
1answer
25 views
What does it mean an object to be initiated once but called by different threads? ( I mean Servlets.. )
So I know that there is only one instance of a Servlet, and the methods of the Servlets are called by different threads.. I want to understand this concept but I am having a hard time..
Imagine I ...
-2
votes
4answers
35 views
run() method not running
I want to make a simple space shooter game but it is not working well at the start. How it will be its end? Something is going wrong with my code. The overridden run() method of the Runnable interface ...
0
votes
0answers
39 views
How to cancel Java 8 completable future?
I am playing with Java 8 completable futures. I have the following code:
CountDownLatch waitLatch = new CountDownLatch(1);
CompletableFuture<?> future = CompletableFuture.runAsync(() -> {
...
0
votes
1answer
36 views
MouseMotionListener in a Thread
I am new to Java and right now i am trying to understand Threads.
I am currently working on a "make the ball bounce or you lose" game.
In this game there is a ball that bounces of a "wall" or a ...
0
votes
0answers
9 views
How do you debug programs that use Java's Process and Runtime classes?
I'm trying to send commands to a .exe file and execute it programmatically. I found this thread on Stackoverflow as well as this thread and this thread on Stackoverflow.
I've tried writing something ...
7
votes
2answers
98 views
Alternate to Thread.stop() in Java 8?
Is there any way to force a Thread to stop under Java 8, now that Thread.stop has been removed? This includes forcing a thread waiting on a lock/synchronized/sleep/wait/infinite loop to stop.
This is ...
0
votes
1answer
25 views
Java: Can I send Thread.wait() and Thread.notify() on the PipedOutputStream?
Can I send from the Producer Thread on PipedOutputStream the wait()-Signal to the Receiver Thread, so that the Receiver "sleeps" until the notify()-Singal comes from the Producer Thread?
The Task is ...
0
votes
1answer
21 views
What are the best ways to launch a very long backround process from a java web app?
When you want to launch scripts (.sh,jar,.py,.pl...) running more than some hours by a simple click on a user interface(for example a nice jsf page).
What are the best methods to throw process.
...
0
votes
1answer
15 views
Clarification about Thread's .isInterrupted(): what is “alive”?
I have some trouble understanding what the javadoc for this method means to say here:
A thread interruption ignored because a thread was not alive at the time of the interrupt will be reflected by ...
1
vote
1answer
14 views
Subscribe to multiple channels with same thread Jedis
I have an application that uses Redis publish/subscribe to transfer messages between clients using the Jedis client in Java. I want to be able to subscribe to channels at runtime when the user types a ...
1
vote
0answers
18 views
Queue Using Deuce STM
I am new to Deuce STM and was wondering how do I go about implementing a queue using Deuce STM. Here is my current working implementation -
The Node class contains two fields - value and pointer to ...
-1
votes
1answer
20 views
Multiple Producer Multiple Resources One Cosumer
I am newbie to Java concurrency. I have learned about producer consumer pattern where one producer write on a vector and consumer consumed it from the vector. But I have to make a homework with some ...
-1
votes
1answer
18 views
I want to send Run time Notification through E-mail in my designed web application by using Executors Thread Pool
It may be a silly question but i am newbie on this, I am creating a web application where notifications are send by Email. For this i am planning to use Executor Service. I am bit confused in ...
-1
votes
3answers
44 views
Java multithreading - communication between 2 threads [on hold]
I'm trying to learn multithreading in java but i can't seem to find some simple examples on internet that show how 2 threads communicate and pass control between themselves. For example; I want to ...
2
votes
3answers
53 views
how to alternate monitor acquiring of synchronized section by two groups of threads?
I research concurrecy in java. Recently I learn wait and notify methods meaning.
Now I think that sometimes I should to solve following problem:
I have
class ThreadGroup1 extends Thread
and
...
3
votes
2answers
65 views
Mutli Threading in Java
When I have a synchronized method in java, and if multiple threads (lets say 10 threads) tries to access this method and lets assume some thread gets access to this method and finishes the execution ...
2
votes
1answer
57 views
How to correctly shutdown all threads?
I have 8 threads which each execute loops similar to this in their run method:
for (int i = 0; i < someVar; i++) {
for (int j = 0; j < someOtherVar; j++) {
if ...
0
votes
2answers
47 views
Problems with threads in Java
I'm working on a crawler which crawls the whole web 24x7 non stop in JAVA.
in order to increase the speed of crawling, I've implemented threads in it. But here is something I can't understand.
...
3
votes
0answers
50 views
+50
Workaround for Java bug which causes crash dump
A program that I've developed is crashing the JVM occasionally due to this bug: http://bugs.java.com/bugdatabase/view_bug.do?bug_id=8029516. Unfortunately the bug has not been resolved by Oracle and ...
0
votes
0answers
21 views
What does rcu_note_context_switch mean when debugging context switches on a Java thread?
I am trying to determine why thousands of context switches are happening to my isolated process as described here Why one non-voluntary context switch per second? so I am tracing the kernel with ...
1
vote
2answers
42 views
Java Static Variable of instance overwritten in another instance ?
Im suffering from more complex problem. I 've got server program, when server accepts connection it creates new socket and communicate throught it in new thread. This new thread creates an instance of ...
0
votes
2answers
56 views
Using threads in Java, iteratively
I was wondering if anyone can help me out with a problem.
What I want to accomplish (using Java):
In first iteration, I want to "doStuff" 10 times (concurrently).
In the second iteration, I want to ...
0
votes
2answers
37 views
Application crashes when UI thread waits for AsyncTask
I am creating an application in Android in which whenever a user receives new Text message (SMS) it is first sent on server and if server replies true the Broadcast is aborted else we Broadcast it.
...
0
votes
0answers
28 views
Main UI thread waits other thread's finish
In my app I have to show some images. They are stored on device localy. However, if some pictures aren't saved on device, they should be downloaded from web.
The thing is that I must show downloading ...
0
votes
3answers
25 views
Submitting to an Executor from a running task
Is it safe for a task (a Runnable) being run by an Executor to submit (execute()) a task? Can it result in deadlock, if using any of the standard Java executors? Is there any particular configuration ...
1
vote
1answer
34 views
Non-standard usage of wait notify in concurrent Java programs
I am very familiar with how the wait() / notify() signaling scheme works in Java. However, I realized that the few usage patterns I've seen are variants of the Producer / Consumer scheme, or ...
1
vote
1answer
24 views
Android : is it safe to create a View and a Handler in a worker thread
The android docs states that :
The Andoid UI toolkit is not thread-safe. So, you must not manipulate your UI from a worker thread—you must do all manipulation to your user interface from the ...
0
votes
1answer
32 views
Java basic thread pool implementation with locks.ReentrantLock
I'm new at Java. I was just experimenting with threads, and I wanted to create something like a Thread Pool (if this is actually what I am doing..).
Basically I have a while loop which fires Threads ...
0
votes
2answers
35 views
executor service in java for multi threading, ignore the details of threading?
I tried learning threads and runnable in java and a collegue of mine told me to stop it will take too learn these details. Just lookup how to write an executor. How does this work in java. Can someone ...
0
votes
1answer
35 views
At which point in the lifecycle is the “stack” of a Java Thread created and destroyed?
I am considering extending java.util.Timer, and completely overriding all public methods, to use a different implementation. The one "problem" I see is, that Timer instantiate and starts a Thread in ...
-1
votes
2answers
44 views
Make a blocking thread for message queue
I'm making a simple server-client application. I'm handling the message queue this way (class MessageQueue):
private Vector<String> messages;
//Runs from any thread
public void add(String ...
0
votes
2answers
20 views
Wait on multiple dialog inputs before processing data using Runnables
I thought I'd figured out this problem, by making a function showMessage, which can take a Runnable as an argument and run that piece of code if that particular button has been pressed.
Now I find ...
-1
votes
0answers
37 views
client/server instant messaging [on hold]
I have developed a server to handle 10 people in and instant message system. Now I need to that an already existing client and modify both my server and client to be able to run this system across the ...
0
votes
2answers
15 views
Stateful session bean multi-threaded access
The EJB 3.2 spec says the following:
By default, clients are allowed to make concurrent calls to a stateful session object and the container is
required to serialize such concurrent requests. ...
0
votes
0answers
7 views
Segfault in native code with jni CALL
I m having a segfault in my native C code.
I have a thread pool that contain 4thread in my program, each one do a new MyObject()
in MyObject i have
public class MyObject{
private final ...
0
votes
1answer
18 views
Camel IMAPS and TIMER components - exclude redundant threads
I use Camel IMAPS and Timer components.
An emails are received successfully and I can process them using MailboxConsumer.
And Timer is starting some processing using MyConsumer bean.
The problem is ...
0
votes
0answers
22 views
Inefficient .Net fork/join
I've implemented a parallel mergesort using Java fork/join pool and .Net Parallel.Invoke, and I observe drmamatic difference in perofmance between the versions: 5 sec (Java) and 45 sec (.Net) to sort ...
0
votes
1answer
23 views
How to have a large java or python datastructure remain persistent in memory so that other programs can “query” it (like a database)?
I have a graph structure with a few thousand nodes that I want to make a part of a web application. I've spent dozens of hours trying and reading up Neo4j and Cypher, and it's looking like they don't ...
1
vote
1answer
45 views
Android socket server with multiple clients.. Hopefully close, but no cigar
I'm attempting to create a socket server on Android which is capable of handling multiple client connections. Each of these client connections supports asynchronous communication. I think I have my ...
0
votes
2answers
50 views
How to access a thread's object from another thread - Java
I have a specific class which extends Thread. In my main i create a number of threads of that class. Each thread creates an object of class Hero (a class created by me).
Is there a way that one ...
0
votes
1answer
15 views
Avoiding Concurrency exceptions in libgdx with server/client threads
Basically, I have a LibGDX desktop application. I also have a server that the client connects to. The connection to the server runs on it's own personal thread with an ObjectInputStream.
Here's my ...
0
votes
0answers
27 views
set and get using synchronization tool error in java
i have an error in this code that's the thread set 2 value instead of one when the program start , the program mustn't set the next value before get the current
this is the main class
class DATA
...
1
vote
2answers
19 views
ReentrantReadWriteLock limit
Is there a limit to the ReentrantReadWriteLock? I'm now testing my application and it seems my write lock isn't giving out locks anymore (returning true: tryLock()) when I'm at 20 threads.
0
votes
1answer
23 views
JAVA - ScheduledExecutorService don't quits threads
I'm using ScheduledExecutorService.scheduleWithFixedDelay() to schedule periodic launch of thread. It works but threads are accumulating in ThreadStackTrace (with Waiting state). I'm sure that thread ...