Assume you have a Collection(ConcurrentLinkedQueue) of Runnables with mutable state. Thread A iterates over the Collection and hands the Runnables to an ExecutorService. The run() method changes the Runnables state. The Runnable has no internal synchronization.
The above is a repetitive action and the worker threads need to see the chan...
I'm not too well-informed about the state of the discussion about which model is better, so I would like to ask a pretty straight question: Does it look like two opposing views having really heatened dispute? E.g. like prototype/class based OOP or dynamic vs. static typing
(though these are really not much fitting examples, I just do...
I'm studying pascal-fc for a concurrency test.
I'm familiar with Java's threads and its monitors.
I don't understand the role of channels, please explain.
...
Classic example of a simple server:
class ThreadPerTaskSocketServer {
public static void main(String[] args) throws IOException {
ServerSocket socket = new ServerSocket(80);
while (true) {
final Socket connection = socket.accept();
Runnable task = new Runnable() {
public void run() {
...
I'm writing to many files in a threaded app and I'm creating one handler per file. I have HandlerFactory class that manages the distribution of these handlers. What I'd like to do is that
thread A requests and gets foo.txt's file handle from the HandlerFactory class
thread B requests foo.txt's file handler
handler class recognizes tha...
Program Parcial2;
type buffer = channel of integer;
var buffers : array [1..2] of buffer;
val:integer;
process sleeper (id:integer);
var i : integer;
begin
for i:=1 to 10 do
begin
sleep (random(10*id));
**buffers (id):any;**
end;
end;
process troll;
begin
buffers[1]: random(10);
end;
process watcher;
begin...
I'm working with core java and IBM Websphere MQ 6.0. We have a standalone module say DBcomponent that hits the database and fetches a resultset based on the runtime query. The query is passed to the application via MQ messaging medium. We have a trigger configured for the queue which invokes the DBComponent whenever a message is availabl...
Hi,
I have a piece of code (simplified):
if(reentrantLockObject.isLocked()) {
reentrantLockObject.unlock();
}
where reentrantLockObject is java.util.concurrent.locks.ReentrantLock.
Sometimes I get IllegalMonitorStateException.
It seams that lock was released between check and unlock() call.
How can I prevent this exception?...
I have a document based application. Saving the document can take a few seconds, so I want to enable the user to continue using the program while it saves the document in the background.
Due to the document architecture, my application is asked to save to a temporary location and that temporary file is then copied over the old file. How...
Hello Experts,
am I allowed (without any sideeffects) to create and start a new Thread() from within a doGet() Method of a servlet? Or does this somehow leak ressources?
Is it valid to also pass the "Session" Object into the Thread to later save the result of my asynchronous processing (I will synchronized correctly) in the session? Or...
Hi all;
Im writing a concurrent server that's supposed to have a communication channel and a data channel.
The client initially connect to the communication channel to authenticate, upon successful authentication, the client is then connected to the data channel to access data.
My program is already doing that, and im using threads.My ...
Hello !
I am really curious about how does the JVM work with threads !
In my searches in internet, I found some material about RTSJ, but I don't know if it's the right directions for my answers.
I also found this topic in sun's forums,
http://forums.sun.com/thread.jspa?forumID=513&threadID=472453,
but that's not satisfatory.
Can...
I am involved in designing a asp.net webforms application using .NET 3.5. I have a requirement where we need to log exceptions.
What is the best approach for exception handling, given that there would be concurrent users for this application?
Is there a need or possibility to log in exceptions at a user level? My support team in-char...
I am JEE developer, and I want to get skills on concurrency development.
Could you provide me some assignments, ideas, or other - just for learning and training concurrency programming?
Thanks!
...
How can I get a timer task on a WebSphere cluster to execute once and only once? I know this is possible on other app servers but can't figure out how to do this in WebSphere.
...
I'm very interested in the user-space RCU (read-copy-update), and trying to simulate one via tr1::shared_ptr, here is the code, while I'm really a newbie in concurrent programming, would some experts help me to review?
The basic idea is, reader calls get_reading_copy() to gain the pointer of current protected data (let's say it's gener...
So I'll be providing a few functions via a self hosted (in a WindowsService) WebServiceHost (not sure how to process HTTP GET/POST with ServiceHost), one of which may be called a large amount of the time. This function will also rely on a connection in the appdomain (hosted by the WindowsService so it can stay alive over multiple request...
1]What is Non-blocking Concurrency and how is it different than Normal Concurrency using Threads. Why dont we use "non-blocking" Concurrency in all the scenarios where concurrency is reuired.. are there any overheads for "non-blocking"
2] I have heard that this is available in Java. Are there any particular scenarios we should use this ...
My problem
Let's say I want to hold my messages in some sort of datastructure for longpolling application:
1. "dude"
2. "where"
3. "is"
4. "my"
5. "car"
Asking for messages from index[4,5] should return:
"my","car".
Next let's assume that after a while I would like to purge old messages because they aren't useful anymore and I want...
Hi,
I have a question that is related to possible overhead of ExecutorServices in Java.
The present implementation has ExecutorService A with a capacity of 5 threads.
It runs threads of type A.
type A threads do some database reading and writing.
Now, a thread of type B will run after some threads of type A has finished.
The num...