0
votes
1answer
12 views

Appropriate off-thread database interface for small apps in Android

I know there are a lot of threads relating to this topic on here, but I haven't read a real answer to my question, and a lot of them are from 2010 when there didn't seem to be as much emphasis on ...
1
vote
2answers
46 views

Is a static method containing loops thread-safe?

I have a huge loop that I wanted to split up into 4 threads. I've done so using a little bit noobish method(or maybe not?) and split up the counter of the for loops into 4 intervals, created a new ...
0
votes
4answers
39 views

Determining the order of a Thread

I found this Thread question. The answers I feel that might be correct are, abc123 and 123abc only. How can it bring a1bc23 as a correct answer? The said method, is a synchronized static method. So ...
3
votes
3answers
30 views

Do all Swing components run on the EDT by default?

I'm new to Java and after reading many articles about threads and swing I understood that all the invocations of Swing methods should be done on the EDT because Swing is not thread safe. however, I ...
0
votes
1answer
15 views

Why isn't the threadpooltest running correctly?

http://www.java2s.com/Code/Java/Threads/ThreadPoolTest.htm I downloaded the source code from the official website, but can't get the code running for some reason. I have JCreator 5.0 and the latest ...
-1
votes
1answer
25 views

Does The new java synchronization mechanism preserve the code optimization by JVM. [on hold]

as we know that synchronization method or synchronization blocks preserve the java code and JVM does not optimize the code . is the this true for the new java synchronization mechanism.
0
votes
2answers
26 views

migrating from Handler to ScheduledExecutorService for scheduling

My goal is to schedule a recurrent job that happens on a non-even rate. I am going to migrate from first snippet to the second: 1st: Handler mHandler = new Handler() { @Override public void ...
0
votes
1answer
36 views

How to sandbox a Java program

I have been trying to build an online java compiler. And I have looked some answers like this one. But there are still something I don't understand. I use java -Djava.security.manager ...
0
votes
1answer
47 views

Is it possible to communicate between multiple threads from multiple instances of the same program?

I'm making a desktop java program that multiple people from different computers will be accessing at once because it is on a shared drive. The program writes user input to an excel file, so I was ...
0
votes
3answers
34 views

Anonymous threads deprecated entirely in Java?

It's been some time since I worked with java, and it seems that since I last worked with it, stop and destroy have been deprecated on threads. This is annoying because it means that I can't create ...
1
vote
3answers
36 views

Java Threading: Unexpected behavior when providing timeout argument in lock.wait()

Unfortunately I'm not going to be able to give full context to this, since there's too much complexity in the surrounding code. The short of it is this: I have a block of code that's waiting on a ...
3
votes
3answers
65 views

What the use of Thread constructor with string param?

Looking at the Thread constructors, I see there is one that takes single string parameter. I have the below code, which is kind of useless. I would like to know, how to make a fruitful use of this ...
0
votes
0answers
20 views

Google In-App Billing V3 and Java for Android threading

I am new to threading in general and have worked with Java for Android somewhat, but am by no means an expert. I'm trying to use Google's In-App Billing V3 and am completely confused. Google's ...
0
votes
1answer
32 views

Anagram Finding with SwingWorker bad idea? [on hold]

I have word list from A to Z. when my program starts generating anagrams of longer words it freezes and takes long time to process from A to Z. Do I miss step here or wrong logic is used? Example: ...
1
vote
2answers
41 views

One thread writes data while not being read, many threads read while data is not being written

I have more than just a basic understanding of locks and synchronized blocks. However, as far as i know, they just ensure that a single thread has access to some data at a time. What i need is a ...
0
votes
5answers
52 views

Identifying two different threads

I am learning multithreading in java.My doubt is,is there any way two identify two different threads if they have same name below is my code package com.rajeev.test2; public class Test11 extends ...
0
votes
1answer
21 views

What happens to remaining thread of invokeAny Executor Service

InWhen invokeAny successfully returns, what happens to remaining threads? Does it get killed automatically? If not how can I make sure that thread is stopped and return back to threadpool ...
0
votes
0answers
12 views

Apache HttpClient eats up memory and thread counts increases results in Server going Out Of Service

I am using the Apache HttpClient(4.3.5) and using Guice as DI @Provides @Singleton public CloseableHttpClient getCloseableHttpClient(){ PoolingHttpClientConnectionManager cm = new ...
0
votes
0answers
25 views

java.sql.SQLException: Thread stack overrun: 396896 bytes used of a 524288 byte stack, and 128000 bytes needed

I have stored procedure which have recursive call in mysql. I am getting exception that java.sql.SQLException: Thread stack overrun: 396896 bytes used of a 524288 byte stack, and 128000 bytes ...
0
votes
2answers
47 views

Pass a runnable to a Thread - Java

I'm trying to run a Runnable object in three kinds of threads. The Swing EDT, the current thread (which is the thread that created the object) and the main thread. So far I've come this step: public ...
0
votes
0answers
6 views

AudioRecord startRecording() Method freezes UI (causes skip frames) even when run on separate thread

I'm using a custom class that seems to just be a wrapper for the AudioRecord Class to take in audio data from the mic. When I implemented its use in my app, it froze the Ui thread (caused skipped ...
-5
votes
0answers
22 views

Organise multiple readers and writers [on hold]

You have a resource that can be read by multiple readers and written to by multiple writers. Any number of readers can read from the resource at any given time. However, if a writer wishes to write to ...
0
votes
1answer
43 views

REST API + Java Multithreaded

I managed to build a small REST API using eclipse. The following code works: @Path("Info") public class Rest { @POST @Path("/stats/{j}") @Produces("application/json") public Response ...
0
votes
0answers
14 views

SWT progress dialog while performing a long operation in the UI thread?

I have a long operation that cannot be moved from the SWT UI thread. I know, it's gross, but that's how it is. I would like to display a progress bar of some sort for said long operation. I have ...
0
votes
2answers
37 views

If I have multiple threads in my program, does each thread technically have it's own stack? Does each thread have it's own heap?

I have been trying to find the answer to this question in the API (and with Google) but I am not able to find anything that directly discusses the state of the call stack and heap in a multi-threaded ...
0
votes
4answers
42 views

Wait till a Blocking Queue is full

Im looking for a way to synchronize multiple asynchronous operations. I'd like to use a BlockingQueue with a size equal to my operations but who can i wait till the Queue is full? Im looking for ...
2
votes
2answers
40 views

Are mutations through an unmodified atomic reference visible?

Let's say I have an atomic reference to a mutable class type Foo: AtomicReference<Foo> foo = new AtomicReference<Foo>(new Foo()); Thread A writes to the Foo object: ...
0
votes
0answers
36 views

Is there a way to make MouseListener, MouseMotionListener, and ActionListener to work at the same time?

I've been working on a program, which uses the arrow keys to move a rectangle representing the player, and mouse movement and clicks to aim where the newly created shots go. However, every time I ...
2
votes
3answers
33 views

Java - Thread.setPriority() Error: cannot find symbol (the period between Thread and setPriority)

I'm taking a Java 2 class and our assignment is to show how multiple threads can be assigned different priorities. I'm trying to manipulate the example code in the book to see if it works and I'm ...
0
votes
0answers
3 views

JBoss: Threads of HTTP Pool are not released

I configured an HTTP thread pool for my JBoss http connector (I use JBoss 7.1.1). Here is how look my standalone.xml configuration : ... <subsystem xmlns="urn:jboss:domain:threads:1.1"> ...
2
votes
3answers
34 views

How do you get to the root cause of a sleep interruption in Java?

I've got some code: public class MyTask implements Runnable { @Override public void run() { // Some code Thread.sleep(); // Some more code. } } ExecutorService ...
1
vote
4answers
43 views

Thread isn't removed after it has stopped running

I have a Service which is running on a thread. When I need the thread to stop running I am using this code this.serviceThread.interrupt(); this.serviceThread = null; At some point I need to recreate ...
-3
votes
0answers
29 views

Remove object from Thread stack or how to clean thread stack when thread is interrupted in java

I need to read a file and insert the data from the file to database (Sync). The file contains 80k - 100k records. This works fine but I need a method to remove the file from Sync; And the thread ...
1
vote
1answer
32 views

Redirect System.out from every thread

I have created a swing ui and redirected System.out and System.err to a text field with this code ConsoleOutputStream cos = new ConsoleOutputStream(textColor, printStream); System.setOut( new ...
1
vote
1answer
11 views

Performance issue Sqlite in a tomcat server

I'm using a Tomcat 6 with the Xerial sqlite-jdbc-3.7.15-M1.jar driver. SQLite3 has the version 3.6.20. If the server is under load, processing of a request needs unbelievable long. Normally one ...
0
votes
2answers
27 views

Java + Oracle ORA-1000 Maximum open cursors exceeded

I have a multithreaded application where the main thread creates a few threads and hands them off to the ExecutorService. All the threads use a Oracle Database connection object in the main class. The ...
0
votes
2answers
23 views

using same statement object to execute multiple queries in multiple threads?

Is it a good idea to re-use java.sql.Statement object to execute multiple queries in multiple threads simultaneously? I've read somewhere that it's recommended to reuse same statement object, however ...
0
votes
1answer
33 views

How to interpret this thread dump?

I have an application running on linux server. Here are some details about the application 1. It bases on spring 3,quartz 1.6.1 and httpclient 4.1.2 to parse pages. 2. Basically its jobs will be run ...
-1
votes
4answers
63 views

How to stop of a Thread when it finishes its work?

I am working on web application on JEE. I have created a thread in my ServletContextLitner so it does some entries in database in background and user is sent to it's homepage. My question is that ...
0
votes
1answer
34 views

How to run process builder command as thread in java

I need to do the image conversion inside a folder using process builder with the help of image magick tool. I need to delete the original files after conversion but when i used wait for it takes long ...
-6
votes
1answer
179 views

Synchronization - Difference between locks [duplicate]

What is the difference between the following approaches of placing a lock with concurrency? public synchronized ArrayList<Player> getPlayers() { return players; } public ...
3
votes
2answers
64 views

Why does creating a string from multiple objects fail after joining the first two objects

Today, I encountered a problem when I tried to combine multiple "variables" or objects, like the following example code: String stuff = "blah blah" + amazingness.getName() + " fantabulous code: " + ...
-1
votes
1answer
26 views

How to get a return value from runnable thread and not block with join?

How can I get a return value back without using join (since it blocks in this case) or use a class variable to save the result? Or how can I make this asynchronous wiit java 6/7 and spring 3.2.3? ...
1
vote
2answers
42 views

Confusion with DBCP connection pooling and Threads

I am trying to get Multi-Threading working in my Java web application and it seems like no matter what I try I run into some sort of issues with connection pooling. My current process is that I have ...
0
votes
0answers
31 views

Calculating memory occupied by a ThreadGroup

I am writing application that is capable of running multiple instances of a Java game. Each instance of the game has multiple threads, which are grouped in a ThreadGroup object. I want to be able to ...
1
vote
1answer
38 views

Loop not terminating when joining on all other threads

First of all I searched the answer forever. I've been trying to join all of my Threads this way: Set<Thread> threads = Thread.getAllStackTraces().keySet(); try { for (Thread t : threads) ...
0
votes
2answers
38 views

What is the best way to manage multithreading in JavaFX 8?

I'm trying to find an efficient way to influence the shape and the content of the JavaFX GUI elements, such as simple Pane, with use of multithreading. Let's say I have a simple Pane, on which I ...
0
votes
1answer
32 views

Null pointer/array index out of bound/crazy exception in javafx with binding properties

I am trying out binding properties in javafx. I have a PieChart that has its data bind to changing properties. But i receive null pointer exception after a while, sometimes is ...
0
votes
2answers
41 views

usage of generic in Callable and Future interface?

What's the use of generic in Callable interface? Consider this code which I copied from https://blogs.oracle.com/CoreJavaTechTips/entry/get_netbeans_6: import java.util.\*; import ...
0
votes
2answers
24 views

How to create a new thread per an existing method (like C#/NET)?

How can I do this in java without using the Runnable class or implementing my threaded code in a run() method? public void dud() { System.out.println("create me on a new thread"); } public void ...