I can't get to the bottom of this error, because when the debugger is attached, it does not seem to occur. Below is the code.
This is a WCF server in a Windows service. The method NotifySubscribers is called by the service whenever there is a data event (at random intervals, but not very often - about 800 times per day).
When a Windows...
Now, I'm not sure whether this is a stupid question, please bear with me if it is.
Is the lock on an object "recursive", i. e. if two objects have references to a third object in their fields and a thread is running a synchronized method on one of the two, can any other thread access the third object?
// a and b are some objects that i...
I have an RDL with multiple datasets, and the stored stored procedures which populate the datasets create and drop temp tables having the same name.
This report has been run 1000 times without any problem, but I wonder if there is a race condition waiting to happen. Its possible in principle for both stored procedures to be executed in ...
How do I use a ConcurrentLinkedQueue in Java?
Using this LinkedQueue, do I need to be worried about concurrency in the queue? Or do I just have to define two methods (one to retrive elements from the list and another to add elements to the list)?
Note: obviously these two methods have to be synchronized. Right?
EDIT: What I'm trying t...
Let's say I have a counter function which updates a counter using raw SQL:
public void updateCounter() {
executeSql("UPDATE counter SET count_value = count_value + 1 WHERE id = 1;");
}
The database would make sure that two concurrent calls to the counter are handled as expected - that all calls would update the counter with one i...
I want to write a command line daemon that runs forever. I understand that if I want the JVM to be able to shutdown gracefully in linux, one needs to wrap the bootstrap via some C code. I think I'll be ok with a shutdown hook for now.
On to my questions:
My main(String[]) block will fire off a separate Superdaemon.
The Superdaemon wil...
class A {
public synchronized void myOneMethod() {
// ...
}
}
class B extends A {
public synchronized void myOtherMethod() {
// ...
}
}
// ...
B myObject;
// ...
myObject.myOneMethod(); // acquires lock
myObject.myOtherMethod(); // same lock?
How I understand the synchronization model, I'd say that ...
I have a .NET WCF service that will need to handle multiple client requests at once.
The service makes database calls (both read and write) for each client request.
Could IO completion ports be useful for the database access portions of this code to improve concurrent performance? How would they be used in such a situation?
...
There's a name for this, but I don't know what it is so it's hard to google.
What I'm looking for is something in the java concurrency utilities, which is a pair of queues, an "pending" queue used by a producer, and a "processing" queue used by a consumer, where the consumer can swap the queues atomically. If used in this way (1 produce...
I've been working on the solution for financial industry. The main functionality of the application is the ability to load massive input files, digest them, update state in persistent store and generate extracts from persistent store on request. Pretty straightforward.
The input files are industry standard formatted XML large (more that...
I have an object which does some computation, then for each iteraction I want to draw what happens. While the drawing is happening, I want it to wait.
This is what I did, basically:
synchronized public void compute()
{
other.mark(variable);
try
{
wait();
}
catch(InterruptedException e)
{
}
}
in the...
So, I've come up with this scheme for locking nodes when rotating in a binary tree that several threads have both read and write access to at the same time, which involves locking four nodes per rotation, which seems to be an awfully lot? I figured some one way smarter then me had come up with a way to reduce the locking needed, but goog...
I really like the concept of FutureValues. http://c2.com/cgi/wiki?FutureValue
And although I'm working in a CLDC 1.1 environment (Blackberry), I'm wondering if it is
possible to implement it with the available wait-notify / Threading support in Java 1.3.
Basically I want to create:
ExecutorService - to start threads
Each thread then c...
I'm using rsync to run backups of my machine twice a day and the ten to fifteen minutes when it searches my files for modifications, slowing down everything considerably, start getting on my nerves.
Now I'd like to use the inotify interface of my kernel (I'm running Linux) to write a small background app that collects notifications abou...
I'm building an application with the following criteria:
work items: items that need to be manually worked via the web by users (short one page form)
Multiple users working 'work items'
Each user has a queue of 'work items'
There is a search that allows users to view 'work items' and assign 'work items' to their queues
Users can take '...
Hi,
The following Function is executing in its own thread:
private void doSendData()
{
try {
//writeToFile(); // just a temporary location of a call
InetAddress serverAddr = InetAddress.getByName(serverAddress);
serverAddr.wait(60000);
//Log.d("TCP", "C: Connecting...");
Socket socket ...
I need to do a program to download the webpages, that is, I give a webpage to the software and it would download all the files in the website.
I would pass also a level of depth, that is, the level where the software goes download each file of the website.
I will develop this software in Java and I need to use concurrency also.
Please...
Hi,
a theoretical question. After reading Armstrongs 'programming erlang' book I was wondering the following:
It will take some time to learn Erlang. Let alone master it. It really is fundamentally different in a lot of respects.
So my question: Is it possible to write 'like erlang' or with some 'erlang like framework', which given tha...
In my application, I have a key-value map that serves as a central repository for storing data that is used to return to a defined state after a crash or restart (checkpointing).
The application is multithreaded and several threads may put key-value pairs into that map. One thread is responsible for regularly creating a checkpoint, i. e...
Please note that I already know of and understand the ABA problem. This question is about the behavior of the .NET memory model with regard to ABA.
In his discussion of the Lock-Free LIFO Stack (CLR Inside Out column from May 2007 MSDN Magazine), Joe Duffy says:
"We incur an object allocation for each Push, saving us from having to wor...