I'd just like to check, is this a good way of iterating over rows in a database and deleting them when processed? I first had
Grab all
Process all
Delete all
But figured that might leave to problems if new rows were added (from outside) while the "Process all" step is running.
// the limited for loop is to prevent an infinite loop
/...
I need to submit a number of task and then wait for them until all results are available. Each of them adds a String to a Vector (that is synchronized by default). Then I need to start a new task for each result in the Vector but I need to do this only when all the previous tasks have stopped doing their job.
I want to use Java Executor...
Hello, i need to make multiple calls to different web services using PHP and i was wondering if the php-java combination would be more appropriate in dealing with this issue.
The multiple calls to the services if called sequentially will create a significant amount of delay, so i am looking for ways to overcome that.
I have read arti...
I've got a requirement for a list in Java with a fixed capacity but which always allows threads to add items to the start. If it's full it should remove an item from the end to make space. No other process will remove items, but other processes will wish to iterate over the items.
Is there something in the JDK which would allow me to ...
I'll be using a multi-threaded Java program to insert new records to a table in MySQL. Is it necessary to synchronize for this? Or is it OK since each insert is a different record in my case?
...
I am looking into performance issues of a large C#/.NET 3.5 system that exhibits performance degradation as the number of users making requests scales up to 40-50 distinct user requests per second.
The request durations increase significantly, while CPU and I/O loads appear to stay about the same. This leads me to believe we may have pr...
Suppose that I have an integer variable in a class, and this variable may be concurrently modified by other threads. Writes are protected by a mutex. Do I need to protect reads too? I've heard that there are some hardware architectures on which, if one thread modifies a variable, and another thread reads it, then the read result will be ...
I want a thread in a Java program to loop until all other threads die, and then end the loop. How can I know when my loop thread is the only thread remaining?
In my situation, the loop thread will have no reference to any other threads, so I don't think isAlive() helps me.
...
Suppose I have following code
private volatile Service service;
public void setService(Service service) {
this.service = service;
}
public void doWork() {
service.doWork();
}
Modified field marked as volatile and it's value do not depend on it's previous value. So this is correct multithreaded code (don't bother about Service im...
I am developing an application in C# using National Instruments Daqmx for performing measurements on certain hardware.
My setup consists of several detectors from which I have to get data during a set period of time, all the while updating my UI with this data.
public class APD : IDevice
{
// Some members and properties go here, ...
usecase example
I have a servlet that is receiving login requests.
If a login is currently in process OR the user is already logged in, the servlet should abort and inform the caller.
current design
Taking inspiration from database sharding, I plan to use the first character of each userid as a synchronization key.
void login( Stri...
When i hit a link a window popup is opened.I am having a session managed bean that loads a java.util.List.It is taking few seconds to load that list.
when i click the link twice i am getting concurrent modification exception. because the page is in session mode and first request is still loading the List, before it ends the second reque...
I'm told that Clojure has lockless concurrency and that this is Important.
I've used a number of languages but didn't realize they were performing locks behind the scenes.
Why is this an advantage in Clojure (or in any language that has this feature)?
...
I've just come to a realization about deadlocks - namely what they are - and I'm concerned about this issue affecting my Rails code.
Are there any specific deadlock issues to watch out for while developing a Rails app?
Have you ever encountered a deadlock in your Rails code - or is that even possible?
(I'm not referring to database de...
I am enhancing an existing algorithm that consists of multiple independent steps to use concurrent tasks. Each of the tasks will create multiple objects to hold its results. In the end, I would like to have a list of all the results to return from the controlling method. At the moment, my code looks something like that
private final Exe...
I'm trying to understand the contract of drainPermits in the Java Semaphore class
The JavaDoc simply reads:
public int drainPermits()
Acquire and return all permits that are immediately available.
Returns:
the number of permits
If no permits are currently available, does it block and wait until one is available?
...
I was wondering if there was a way to execute very simple tasks on another thread in scala that does not have a lot of overhead?
Basically I would like to make a global 'executor' that can handle executing an arbitrary number of tasks. I can then use the executor to build up additional constructs.
Additionally it would be nice if block...
I need to draw a graph of write accesses of two concurrently running threads. What is the best way to write a timestamp value pair of these accesses to an array, without interfering with the threads themselves? The queue that is being written to looks like this:
import java.util.concurrent.atomic.AtomicInteger;
class IQueue<T> {
A...
I know you can pass arguments through the RunWorkerAsync function call when you first start the backgroundworker, but can you pass it data after its already been started? Or would I need to create my own form of concurrency to handle passing data to it from a different thread?
...
If you can definitely prove that a method has no linearization points, does it necessarily mean that that method is not linearizable? Also, as a sub question, how can you prove that a method has no linearizatioon points?
...