Tagged Questions
2
votes
2answers
49 views
Accessing a large singleton object in multithreaded environment
I have a very large singleton object which contains a 2500 X 80000 double array. When I try to access it in a multithreaded environment, as the number of thread increases, the time to access the ...
1
vote
1answer
49 views
Write a static synchronized method (wait for a result from thread)
I have a problem with a task. Namely, we must write a class, which is called from Threads. One of the methods is:
public static synchronized void waitForResults() {
}
So the Master-Thread calls ...
-3
votes
2answers
30 views
Transfer CPU cycle of a machine to another [closed]
I want to transfer unused CPU Cycles of my machine to another machine located remotely.
Does anyone has any suggestions on how I can get started with such an issue, or can suggest any applicable ...
0
votes
1answer
29 views
unable to use thread in Android
I want to start another thread from my onCreateView method as follows :
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
...
2
votes
3answers
121 views
What object do I syncronize on in Scala?
In C# it's pretty straightforward:
class Class1{
private static readonly object locker = new object();
void Method1(){
lock(locker) { .... }
}
}
And I definitely should not make a ...
-4
votes
2answers
51 views
How to unlock thread in case of multithreading in java
Somewhere in the business flow, my thread are locked. So after that everything will be in a waiting position. If it goes like this then how do i proceed without suspend the application.
That means i ...
1
vote
1answer
30 views
how to control the threads running within a process on android platform
Is there any way/tool to control the threads running within a process on android platform, such as let some threads delay for a random time.
Background: I am a QA engineer. I'd like to see if some ...
0
votes
2answers
32 views
Client does not refresh the data sent from Server
I have problem with update my serialized objects. Client does not refresh the data sent from Server. I created loop in Client but it still dont update.
public void run(){
try {
...
2
votes
1answer
28 views
One to one mapping of Java Thread to Linux thread (LWP)
Is there a one to one mapping between Java Thread objects and OS threads (Lightweight processes). That is, if I have a Thread object, can I always identify precisely one associated OS thread, and I ...
2
votes
4answers
101 views
Multi-threading in Scala — dealing only with immutibility
I have the code of Scala
class MyClass {
private val myData: Map[String, MyClass2] = new HashMap[String, MyClass2]()
def someMethod = {
synchronized(myData) {
val id = getSomeId
...
0
votes
4answers
66 views
Killing child thread from parent thread in java
I am working in java android platform. I am creating a child thread from main thread. I want to stop child thread as my requirments. My child thread has simple function which doesn't have any loop. I ...
0
votes
1answer
61 views
What's wrong with my while loop in Client?
I've got problem with loop. In my project I'm sending a comments from match through socket.
I know that something is wrong with one of my loops because in client last comment is still printed.
...
0
votes
1answer
30 views
How do I run a thread run() inside of the GUI's actionPerformed() method?
This is my first time doing multi-threading and I'm kind of stuck on how to make two threads, "Reader" thread and "Writer" thread execute only when the JButton "jbStart" is clicked? I can't put the ...
0
votes
0answers
35 views
how to return value from new Thread by ThreadManager.createThreadForCurrentRequest(new Runnable() gae java
there are 2 part . I am use google app engine java.
1, task Queue, to start 2 process
2, each process using ThreadManager.createThreadForCurrentRequest(new Runnable() {
for 2 Thread
I expect to set ...
0
votes
0answers
29 views
How to log into separate files per thread using EclipseLink
Scenario: Multi-threaded application that interacts with a relational database using EclipseLink JPA Implementation
Desired: Having each thread to log SQL activity to a different file
The ...
0
votes
2answers
27 views
run a thread behind activities in android
Im developing for an android aplication and I need to run a thread in the background that is going to be check the current gps and show an activity depending of the current location data but the ...
6
votes
2answers
37 views
Cause runtime exceptions to be properly ordered with println in console output
A common problem with VM Java console output is that System.out and System.err are not usually synchronized properly, possibly because they are on different threads. This results in mixed up output ...
0
votes
1answer
24 views
Android: “Auto refresh” after a certain time
i have search how i can do an "Auto refresh" or a runnable method for my program, i saw some posts about handlers and threads...
I think that what im search from is a thread but i cant get the program ...
0
votes
1answer
56 views
Thread.join() not working
This is the comple java class (GFXSurface). Inside this class, a second class is defined,
public class GFXSurface extends Activity implements OnTouchListener {
AnotherSurface ourSurfaceView;
float ...
1
vote
2answers
48 views
With double-checked locking, does a put to a volatile ConcurrentHashMap have happens-before guarantee?
So far, I have used double-checked locking as follows:
class Example {
static Object o;
volatile static boolean setupDone;
private Example() { /* private constructor */ }
getInstance() {
...
-2
votes
1answer
21 views
java service(threads) dependency [closed]
I'm trying to learn threads in Java. I'm beginner so I have some questions. I have task to make. I have to make 4 java services (A,B,C,D). Every service should run his own thread, and should have ...
11
votes
3answers
108 views
Happens-before relationships with volatile fields and synchronized blocks in Java - and their impact on non-volatile variables?
I am still pretty new to the concept of threading, and try to understand more about it. Recently, I came across a blog post on What Volatile Means in Java by Jeremy Manson, where he writes:
When ...
2
votes
3answers
56 views
Using a thread loop to update a JFrame
ive done some extensive searching on using threads in a loop and whilst I understand the concept how how seperate threads work, I still cant seem to grasp how to implement it in my simple application.
...
0
votes
1answer
19 views
read and store server logs in real tine
i am using following code for read log file and matched pattern store in database.
public class MIScript {
//DB
public static void db(String email, String ip, String pdate, String hostname, String ...
0
votes
1answer
35 views
Can I control order of thread execution with CountDownLatch?
I have task to do. I have to create 4 services A,B,C and D. Each service should have his own thread. A service should only start after all the services that it depends on are started and
A service ...
0
votes
2answers
66 views
How to know a lock has been acquired
I have a common method which is accessed by multiple threads,
public void m(String fileName)
{
FileOutputStream fos= new FileOutputStream(fileName);
FileChannel fc = ...
0
votes
0answers
75 views
I received InterruptedException while Thread.interrupted is not called
I am in a situation where I catch anInterruptedException but I put a breakpoint at the beginning of the Thread.interrupt() method and there is no hit.
What else can cause InterruptedException to be ...
0
votes
2answers
78 views
countdown multiple threads java
I have 4 threads witch are printing numbers from 15 to 0.I want to control executing of my threads for example I want first to thread D to finish and after him thread C and after him thread B and ...
2
votes
2answers
52 views
what will happen when a thread T1 joins thread T2 and T2 gets interupted
I have a scenario where thread T1 joins thread T2. what will happen when thread T2 gets interrupted. whether T1 will proceed or T1 will also gets interrupted.
1
vote
2answers
36 views
OS X Java maximum threads per process
Running this code
for (int i = 0; i < 4000; i++) {
new Thread(new Runnable() {
@Override
public void run() {
try {
...