I'd like to do some simple synchronization across two processes under Windows. I'd like process A to send an event and have process B handle this event via a callback. That is, process B will not be stuck waiting while the event is pending. Instead, a routine will be called when the event is sent.
The only way I've thought of so far ...
I'm trying to implement Future.get(long, TimeUnit) in terms of TimeUnit.timedWait(Object, long).
It's not clear how to use TimeUnit.timedWait(Object, long) in a way that handles spurious wakeups without losing the nanosecond component of TimeUnit. Normally you'd do something like this:
public V get(long timeout, TimeUnit unit)
{
long...
Suppose I have a Java method like:
public Ouput respond(Input input) { /* .. */ }
The Output object has many fields - some of those fields depend on the Input object but the rest are pre-determined. I want to make the thread which calls respond() to return as fast as possible.
For this I want to spawn another thread which pre-creates...
Hello
I have a program which has multiple objects of type PublisherTask and SubscriberTask.
A given subscriber can be subscribed to one or more Publishers.
To describe my problem I will post some code....
abstract class Publication {
// some published information
}
class ConcretePublicationA extends Publication {
}
class Concrete...
Hi everyone...
I've write a program with java that simulate production water with synchronization (Oxygen wait for Hydrogen to become available), but it's gives "Unexpected Operation Exeption" and did'nt work...
Please help me...
there are my codes:
// class for thread Oxygen
public class Thread_O implements Runnable {
Object object;...
I'm just learning, and really liking, the Actor pattern. I'm using Scala right now, but I'm interested in the architectural style in general, as it's used in Scala, Erlang, Groovy, etc.
The case I'm thinking of is where I need to do things concurrently, such as, let's say "run a job".
With threading, I would create a thread pool and a...
Will Visual Studio 2008 be supported by new .NET 4 from the get go?
I'm particularly interested in the System.Collections.Concurrent namespace and the parallel task library, which I would use immediately.
Is it worth upgrading to Visual Studio 2010 when it comes out?
...
I am using an API in a Java library which is called from the event dispatch thread and requires me to return a fully-initialized UI component. It looks like this:
public JDialog createDialog();
But I can only populate the dialog after loading from a database, which can take 10 seconds sometimes. Normally I would do that in a backgrou...
In my answer to this SO question I suggest using a single insert statement, with a select that increments a value, as shown below.
Insert Into VersionTable
(Id, VersionNumber, Title, Description, ...)
Select @ObjectId, max(VersionNumber) + 1, @Title, @Description
From VersionTable
Where Id = @ObjectId
I suggested this because I b...
I'm not very experienced with subjects such as Concurrency and Multithreading. In fact, in most of my web-development career I had never needed to touch these subjects.
I feel like it's an important concept, especially for Desktop applications and basically any other application that doesn't generate HTML :).
After reading a bit on con...
I want to create a ThreadPoolExecutor such that when it has reached its maximum size and the queue is full, the sumbit() method blocks when trying to add new tasks. Do I need to implement a custom RejectedExecutionHandler for that or is there an existing way to do this using standard java library?
...
So I was reading about the memory model that is part of the upcoming C++0x standard. However, I'm a bit confused about some of the restrictions for what the compiler is allowed to do, specifically about speculative loads and stores.
To start with, some of the relevant stuff:
Hans Boehm's pages about threads and the memory model in C++0...
Let me go over what my code is doing (haven't coded it yet), I want to make it run in multiple threads to speed things up.
looks for a record in the database that hasn't been processed yet:
SELECT TOP 1 * FROM Products WHERE isActive = 1
looks up a URL (Rest call), returns back the HTML and stores it in the database
Sets the flag for...
I have a problem with boost shared_memory_object and mapped_region. I want to write a set of objects (structures) in the memory object. If the structure contains just a char, everything is ok; if I just add an int to the structure, then if I put too many objects (let's say 70, so much less than the limit of the block) I get a segmentatio...
Hi,
If I want to find truly experience the pain of writing multi-threaded applications, What program should I try writing?
Note, I would like to know of an example that is not too big and serves as a good example of demonstrating the intricacies for teaching purposes.
thanks
...
Hi. I have a web application using spring webflow and spring security. I have a problem with concurrency and here's the scenario.
When I log in an and go to an edit page, and when my account was already restricted for that operation, I am not supposed to be able to perform the operation already. I see that since my ROLE save in the sess...
Hello all,
I know PHP scripts can run concurrently, but I notice that when I run a script and then run another script after it. It waits for the first to finish and then it does what it has to do?
Is there an Apache config I have to change or do I use a different browser or something?!!
Thanks all
EDIT
If I go to a different browser...
Will the following code snippet of a synchronized ArrayList work in a multi-threaded environment?
class MyList {
private final ArrayList<String> internalList = new ArrayList<String>();
void add(String newValue) {
synchronized (internalList) {
internalList.add(newValue);
}
}
boolean find(Stri...
Hello Experts,
Could you please clarify if we need to use explicit synchronization or locks for using ConcurrentLinkedQueue? I am specifically interested in knowing if sync calls are needed for following ConcurrentLinkedQueue methods.
add
clear
size
Possibly size is the only method which might require explicit sync since it's a not ...
Hi All ,
I am planning to enhance my knowledge about parallel and concurrent programming.
Can somebody help me to find out some online learning resources?
Thanks,
...