concurrency

How do you handle/react to user input concurrency on the GUI layer?

What are good ways to handle user input concurrency? As the answers to this question already rule out database locking, how do you handle concurrent user inputs in general? Is locking always a bad idea, even if it is not implemented by row locking? Are there best practices which are not use case dependant? What were your experiences wi...

Java Transport.send() is it thread-safe?

The method is static, but I cannot find mention of if it is thread-safe or not. I plan on hitting this method with several threads at once and I would like to avoid a synchronized block if possible. javax.mail.Transport.send(msg); ...

What Cases Require Synchronized Method Access in Java?

In what cases is it necessary to synchronize access to instance members? I understand that access to static members of a class always needs to be synchronized- because they are shared across all object instances of the class. My question is when would I be incorrect if I do not synchronize instance members? for example if my class is...

Explaining race conditions to a non-technical audience

Recently, I found myself having to write up some concerns I have about race conditions in an application that is in development (not by me). This will likely be brought to the attention of stakeholders who are non-technical and with whom I do not have a direct line of communication, so my explanation needs to be in written form. I have...

Postgresql Concurrency

Hi, In a project that I'm working, there's a table with a "on update" trigger, that monitors if a boolean column has changed (ex.: false -> true = do some action). But this action can only be done once for a row. There will be multiple clients accessing the database, so I can suppose that eventually, multiple clients will try to update...

Java Concurrency Techniques

Here are two chunks of code that accomplish (what I think is) the same thing. I basically am trying to learn how to use Java 1.5's concurrency to get away from Thread.sleep(long). The first example uses ReentrantLock, and the second example uses CountDownLatch. The jist of what I am trying to do is put one thread to sleep until a cond...

Django: How can I protect against concurrent modification of data base entries

If there a way to protect against concurrent modifications of the same data base entry by two or more users? It would be acceptable to show an error message to the user performing the second commit/save operation, but data should not be silently overwritten. I think locking the entry is not an option, as a user might use the "Back" but...

threadlocal variables in a servlet

Are the threadlocals variables global to all the requests made to the servlet that owns the variables? I am using resin for the server. Thanks for awnser. I think I can make my self more clear. The specific Case: I want to: initialize a static variable when the request starts the execution. be able to query the value of the vari...

Can a java fixedThreadPool be used by multiple threads

I have a webservice that does multiple small calculations before returning the result. I want to use the ExecutorService provided by Executors.newFixedThreadPool() as a way to implement the Master - Worker pattern (ie. call invokeAll and let the thread wait for all results to finish). Ideally all webservice threads use the same executor ...

Lock free constructs in .net

I am new to .net and would like to know whether .net has the java equivalent of AtomicInteger, ConcurrentLinkedQueue, etc? I did a bit of search and couldnt come up with anything. The lock free algorithms need some sort of a CAS instruction, which is provided through the undocumented Unsafe class in Java, does .net have anything equiva...

Benchmark problems for testing concurency

For one of the projects I'm doing right now, I need to look at the performance (amongst other things) of different concurrent enabled programming languages. At the moment I'm looking into comparing stackless python and C++ PThreads, so the focus is on these two languages, but other languages will probably be tested later. Ofcourse the c...

How would one make Python objects persistent in a web-app?

I'm writing a reasonably complex web application. The Python backend runs an algorithm whose state depends on data stored in several interrelated database tables which does not change often, plus user specific data which does change often. The algorithm's per-user state undergoes many small changes as a user works with the application. T...

Oracle Applications Concurrent Manager Job Owner

By default concurrent manager jobs are run under the APPS user. Is it possible to configure it to run as another user? I'd like to be able to isolate some of my stored procedures. ...

What is the best practice for running a number of tasks (threads) with a single timeout (run for a max of 30 seconds across all threads)?

I came up with a solution, but I wanted to see if anyone had a better way or more standard way of doing this. The main method demonstrates how I would use this class. In a production version of this I would keep the thread pool open and continue to reuse it rather than shut it down after the calls. public class MultiCallManager<T> { p...

Web application database concurrency

Dear, I have a web application (ASP.net 2.0) that has a database (SQL Server) at the background. I'm considering ways how to handle database concurrency if two users insert the same data to the same table at the same time. Are there any way to handle this case? Thanks in advance. Jimmy ...

what would make a single task executor stop processing tasks?

I'm using a java.util.concurrent.ExecutorService that I obtained by calling Executors.newSingleThreadExecutor(). This ExecutorService can sometimes stop processing tasks, even though it has not been shutdown and continues to accept new tasks without throwing exceptions. Eventually, it builds up enough of a queue that my app shuts down wi...

Proper synchronization of Java threads using wait/notifyAll?

Here is a simplified version of my application showing what I'm doing. /* in my app's main(): Runner run = new Runner(); run.dowork(); */ class Runner { private int totalWorkers = 2; private int workersDone = 0; public synchronized void workerDone() { workersDone++; notifyAll(); } public synchronized void dowork() { ...

What are all the way that you try to make your code functional like?

so that you can make your program concurrent easily in the future. ...

How do you handle busy icons in an AJAX site?

This question deals with concurrency issues, for suggestions on how to display a busy icon see this question: http://stackoverflow.com/questions/205631/javascript-loadingbusy-indicator-or-transparent-div-over-page-on-event-click When a user initiates an AJAX request on a page it's useful to show some kind of "working" or busy icon or pr...

How to make a resource (screen) accessible to only one user at a time in a distributed .Net application?

I have a client server based windows forms application that needs an administrator only screen. The administrator functionality needs to be implemented in such a way that at any given time only one administrator can access that screen. The windows forms client application talks to the server using .NET Remoting. And the server side is d...