0
votes
1answer
17 views

How to wake up waiting SwingWorker?

I have a SwingWorker that is running in the background. After it works on some stuff. It will wait. When the user push a button, the MyListener will be invoked and wake up the worker to continue ...
0
votes
0answers
14 views

Why does my Producer/Consumer thread algorithm cause audio skipping and jitters?

My algorithm causes skips and jitters... Here are some known facts: 1. audioQ is an ArrayBlockingQueue [1] 2. when I reduce the runtime of encodeSample, this algorithm works (eg in the case of WAV) ...
1
vote
0answers
19 views

Spring @Async saving searches

I've got a search input field in my Java Spring based website where user can search for content of the website. I want to save the queries entered by users to my MySQL database asynchronously for ...
0
votes
1answer
25 views

Game loop using threads and synchronization

I've been muddling through the internet and my own code in an attempt to write a game-loop I'm satisfied with (I'm picky). I implemented DeWitter's loop but decided I didn't like interpolation for ...
0
votes
0answers
28 views

Getting data out of JUnit test class in threaded environment

I am running some JUnit tests programatically with JUnitCore, and I want to get some data out of the test class once it is finished (so @AfterClass). Here is a pseudocode example of the constraints I ...
2
votes
2answers
72 views

Read the 30Million user id's one by one from the big file

I am trying to read a very big file using Java. That big file will have data like this, meaning each line will have an user id. 149905320 1165665384 66969324 886633368 1145241312 286585320 1008665352 ...
9
votes
4answers
113 views

Is setting a hashmap thread safe?

I have a hashmap in my program which is accessed by multiple threads, and is occasionally set by a single thread. For example: Map<String, String> myMap = new HashMap<String, String>(); ...
-2
votes
0answers
38 views

Debugging multithreaded application in java in eclipse [closed]

I have gone through Debugging multiple threads in eclipse and deadlock detection with eclipse. In my case there are 4 threads-A,B,C,D. I have put a break point and set its property 'suspend vm'. But, ...
1
vote
0answers
8 views

Refresh / Repaint SVG in Apache Batik

I am using Apache Batik to load, manipulate and render an SVG graphic for simulation purposes. Loading and manipulating works so far, at least when writing the SVG out to a file. Also rendering and ...
-2
votes
2answers
48 views

how can I insert data with thread in jdbc?

I want to insert data with using JDBC. I write this code : int i=0; while(i < columnCount ){ i++; stmt_ver.setString(i, x[i] ); stmt_ver.setDate(i+1, x[i+1] ); ...
0
votes
3answers
41 views

how to make threads wait state upto first thread complete

i am facing one multiThreaded issue. i have 10 Threads.when we strat application the first thread will try to create the folder. mean while remaining thread try to move the file to that folder,before ...
0
votes
2answers
35 views

Will I need a separate socket and thread for every player that joins? [JAVA]

I have been learning about sockets for sometime now (I'm quite young) and I think I have a good grip on java sockets. I have decided to create a simple multiplayer Java 2D social game. My goal is to ...
0
votes
1answer
34 views

List variable assigned through Thread Constructor by reference is not working

I am initializing class variable of one of my Thread via its constructor through one of my service class as below: ProcessMediaThread pThread = new ProcessMediaThread(listMediaPath, mediaType); ...
0
votes
0answers
48 views

Thread issue while using Executor service

I have facing thread issue in the below code.When then thread executes the Run method of the runnable object,it doesnt print the data that I expect it to be. code 1--calling code ...
0
votes
1answer
24 views

Get back to Android activity after background thread is complete

I'm using Parse with my Android app, and my code looks like this: public class SignupActivity extends Activity { //Collect signup data User.signupInBackground(data); } public class User{ //User ...
0
votes
0answers
36 views

Sending my email inside the thread is not working

This one is not working, I really don't know whats wrong why it doesn't send an email. I have tried so many codes, but still I did not recieved any message on my accounts. Thread thread = new ...
1
vote
2answers
30 views

AsyncTask get() method not working properly

I am using the following code: //(...) translationTextView.setText("Searching for translation..."); translationTextView.setVisibility(View.VISIBLE); myAsyncTask = (MyAsyncTask) new ...
2
votes
2answers
28 views

Are JNI native invocations from different Java threads serialized?

I am making a Windows JNI .dll. I am trying to determine whether the JVM can ever make concurrent calls to the same native function. Here is the Java code I wrote: public class TestThreads implements ...
12
votes
1answer
84 views

Why synchronize on a static lock member rather than on a class?

class Bob { private static final Object locke = new Object(); private static volatile int value; public static void fun(){ synchronized(locke){ value++; } } } How is ...
0
votes
1answer
16 views

When does ScheduledThreadPoolExecutor reject execution?

If the queue is unbounded, will it ever call the RejectedExecutionHandler? From the documentation: New tasks submitted in method execute(java.lang.Runnable) will be rejected when the Executor has ...
4
votes
4answers
97 views

Multithreading: Why this output? Is it deterministic?

I'm learning to write better multi-threaded programs, thread-safe and deterministic. I came across this piece of code // File Name : Callme.java // This program uses a synchronized block. class ...
0
votes
1answer
48 views

Reordering of code around synchronized blocks

I'm considering writing a singleton framework that looks something like this: Object getSingleton(name) { synchronized(A) { o = A.get(name) if (o != null) { ...
0
votes
2answers
52 views

LinkedBlockingQueue .take() performance

I am using LinkedBlockingQueue that is getting filled by multiple threads, the number of items is big (tens of millions objects). LinkedBlockingQueue.take() takes a lot of time (checked via profiler) ...
3
votes
1answer
44 views

Java's happens-before and synchronization

I'm having a little disagreement on Java's happens-before and synchronization. Imagine the following scenario: Main Thread MyObject o = new MyObject(); // (0) synchronized (sharedMonitor) { ...
0
votes
2answers
39 views

Concurrency: implement connection timeout in custom connection pool

I have to implement my own connection pool, and I want the connection will automatically return to the pool after some CONNECTION_TIMEOUT. How can I achive that? Everything that comes to mind is to ...
1
vote
1answer
34 views

Parallelization of file and network I/O operations

The Questions: Main Question: What's the best strategy to parallel these jobs? Ideas: How to speed up the process using other mechanisms like a second checksum (Adler32?) The Szenario: I'm ...
3
votes
5answers
51 views

Types of Thread Pools in java

What are the types of thread pools in java. I need to implement a robust multi-threaded application which uses heavy computation, which thread pool should I use.?
0
votes
1answer
103 views

Yet Another Java OutOfMemoryError [closed]

I'm running in 64-bit Windows 7 and Server 2008 with a 64-bit JVM, and I get "java.lang.OutOfMemoryError: unable to create new native thread" in a program with plenty of memory available. I have read ...
0
votes
3answers
56 views

How to synchronize the pass of two queues to thread constructor?

I'm trying to deal with synchronization of two queues passed to two threads in cascading way. So i have two threads, the ServerThread that listens to the connections from clients, and the ...
2
votes
2answers
89 views

Is this a better version of Double Check Locking without volatile and synchronization overhead

Below code snippet is from Effective Java 2nd Edition Double Checked Locking // Double-check idiom for lazy initialization of instance fields private volatile FieldType field; FieldType getField() ...

1 2 3 4 5 320
15 30 50 per page