concurrent « concurrency « Java Thread Q&A

Home
Java Thread Q&A
1.concurrency
2.Development
3.Exception
4.Notify
5.Operation
6.Socket
7.State
8.synchronize
9.Thread Safe
10.ThreadPool
Java Thread Q&A » concurrency » concurrent 

1. I can learn either C or Java, which one should I choose first? Should I take them concurrently?    stackoverflow.com

I realize this is a subject of hot debate, but I'm interested in opinions that relate to my specific situation. I want to learn the basics and fundamentals of programming, so I'm ...

2. What is a concurrent language?    stackoverflow.com

From the Java Language Specification:

The Java™ programming language is a general-purpose, concurrent, class-based, object-oriented language.
What is a concurrent language?

3. Reading Input and Error Streams Concurrently using BufferedReaders Hangs    stackoverflow.com

First off let me apologize to the SO community for coming to you with something that ought to be so trivial. But I've been at this all day and I'm ...

4. How Many Java HttpURLConnections Should I Be Able to Open Concurrently?    stackoverflow.com

I'm writing a multi-threaded Java web crawler. From what I understand of the web, when a user loads a web page the browser requests the first document (eg, index.html) and as ...

5. DataGrid - Preventing Concurrent Access To Rows    stackoverflow.com

I need to write a simple datagrid form which allows users to edit cells - The problem is that different people can edit this at EXACTLY the same time so concurrency ...

6. Crystal reports limited to three concurrent user requests    stackoverflow.com

I have a CrystalReports XI Developer Full Product (Release 1) license and found out recently that it has a limitation on the number of concurrent requests it can process. ...

7. Concurrent Programming in Java    stackoverflow.com

Is the lock retained by the thread when context switch occur. When we invoke a wait() the locks are given up by thread, what happens when theres a context switch. Thanks

8. Choice between Brute force approach and concurrent threads    stackoverflow.com

I have a question concerning graphs. Consider a graph with nodes and edges, each edge having a cost. The problem is to visit all nodes so that the sum of costs ...

9. can we run two applets concurrently    stackoverflow.com

i want two use output from one applet as an input for another applet running in parallel..

10. Java console / read and write concurrently    stackoverflow.com

I am practicing Java concurrency and using a chat client/server for learning. Currently I need a pair of terminal windows (a receiver and a sender) per client. So really there is a ...

11. Concurrent modification error while editing XML    stackoverflow.com

I am getting an concurrent modification error while editing an XML file using Java in a JSP file. How is this caused and how can I solve it?

ElementFilter f = new ...

12. How to run two Java ME emulators concurrently on Mac OSX    stackoverflow.com

I'm developing a mobile application in Netbeans, but I'm running into problems when testing communication using SMS. In order to test this, I obviously need two emulators running, which I'm aware ...

13. run external program concurrently    stackoverflow.com

I want to be able to run an external program concurrently with my Java code, i.e. I want to start the program, then return control to the calling method while keeping ...

14. Solr - OverlappingFileLockException when concurrent commits    stackoverflow.com

I'm using solr version 1.4.0 with tomcat 6. I've 2 solr instances running as 2 different web apps with separate data folders. My application requires frequent commits from multiple clients. I've ...

15. in Java, how to monitor several log files concurrently    stackoverflow.com

i want to monitor several log files concurrently .How to do in java ?

16. Suggest full text search engine for continuous concurrent read writes and updates    stackoverflow.com

Our application needs multiple concurrent read write simultaneously and NRT searches. We have been using Solr till now and with minor tweaks in the solr configuration we have managed to sort ...

17. Java Concurrent API's    stackoverflow.com

Can some one please explain how CAS(compare swap) machine instructions are leveraged by java concurrent API's?

18. Compass in highly concurrent environment    stackoverflow.com

in our system, we have the contact database stored in PostgreSQL. We store quite a lot of information about each contact and these information is stored in many tables. Our users ...

19. Sieve of Erathostenes using Concurrent programming (Java)    stackoverflow.com

I am trying to implement the Sieve of Erathostenes using 4cores i.e threads, because i am using the concurrent approach to solve this issue. i have it done using a single thread ...

20. Simulating 2000 concurrent connections, is apache bench reliable?    stackoverflow.com

I need to load test or simulate 2K connections to my web application to see how it handles load etc. If I run apache bench on my laptop, I'm guessing it can't ...

21. Does Netty concurrently modify passed ChannelBuffers    stackoverflow.com

In Netty, does anyone know if the ChannelBuffer passed to a handler for an upstream event (after you cast it from ChannelEvent / or MessageEvent) will be concurrently written to by ...

22. Example from Concurrent Programming    coderanch.com

I was checking out page 100 and page 102 in Concurrent Programming in Java. I did not understand the following examples class Plotter{ // ... public void showNextPoint(){ Point p=new Point(); p.x=computeX(); p.y=compute(); display(p); } protected void display(Point p){ // somehow arrange to show p } } The book says that the above example is an hand-off protocal and is thread ...

23. Does garbage collector run concurrently with another threads?    coderanch.com

The nature of threads is that they let you have multiple processes running at once without a command in one having to wait on a command in another to finish. garbage collection runs this way as a daemon thread(as I have just learned from another post). So it will not stop other threads from processing while it is active. [ June ...

24. Concurrent behavior of threads    coderanch.com

Hi friends We know that threads run concurrently depending upon the scheduling mechanism. So when does this concurrent execution start? After the creation of the Thread object or when the run() method of the thread object is being executed. I mean, does the concurrency depends only on the start() method or does it depend on the run(). In case I create ...

25. news: JSR 166 Concurrent Utilities    coderanch.com

26. Concurrent package    coderanch.com

Usually I feel bad about adding extra dependencies to a project, but using util.concurrent is so natural it doesn't even feel like a dependency. Usually when I'm writing something multithreaded it doesn't take long at all before I come across a problem that's trivial to solve with util.concurrent and a pain to code by hand. It's an amazingly useful package. [ ...

27. need help in using concurrent package    coderanch.com

I've only used the JDK 5 stuff, but assuming it's pretty similar, here's how simple it can be: private void acceptClientRequests() { executor = Executors.newCachedThreadPool( ); while ( mRunning ) { try { executor.execute( new MessageHandler( mServerSocket.accept() ) ); } catch ( IOException e ) { throw new WikiException( ... ); } } } This loop puts a command into the ...

28. Using util.concurrent with 1.4    coderanch.com

29. concurrent bubble sort    coderanch.com

Hello fellow programmers, i recently started working on threads and concurrent-parallel programming - which has not been going that well. I ve been trying to create a parallel bubble sort (meaning that in an array [10,5,3,1] the 10 should go after 1 and the 5 go between 1 and 10. Below is the basic bubble sort lagorithm, what confuses is me ...

30. Concurrent execution    coderanch.com

Originally posted by sudhana madhu: I have a class that contains 2 synchronised methods.I have 2 threads .Can these 2 threads concurrently execute these 2 methods(ie. First thread on First synchronised method and Second thread on Second synchronised method at the same time)If not why?? Whether two threads can run concurrently depends on the locks that they use to synchronize with. ...

31. Concurrent Programming with J2SE 5.0    coderanch.com

32. util.concurrent    coderanch.com

Hi I am using ClockDaemon.executePeriodically from Doug lea's library. in the call to above method we provide the period as an argument which specifies the period for timed call to the command. Here I have 2 queries regaring the method 1. what happens when the timer expires when the previous call to command is still not returned. 2. Does the library ...

33. Limit concurrent threads; report successful execution; terminating hung threads    coderanch.com

Hello, I'm having some difficulty with a project at work. Where the old program ran processes one at a time, I was charged with making it threadable.The downside is, it currently tries to run every thread at the same time. There are typically thousands, or tens of thousands, of threads to run, with each one taking several seconds to complete. (Yes, ...

34. Java Concurrent Programming    coderanch.com

Hey There, Im looking for advice on how to tackle a problem. The problem is I want to create a simulation of a restaurant scenario using java to code it. I need to specify the concurrent processes, the sequential activities carried out by each actor and the constructs used to provide mutual exclusion and condition synchronisation. At the moment this is ...

35. linking concurrent threads    coderanch.com

36. Reading and writing by concurrent threads from a file    coderanch.com

I am looking for a solution for the below problem. I want to have a thread that writes to a file and a thread that reads from the same file. Is this possible in java ? Can I ensure that data written by the writer thread will be seen by the reader thread ? I was thinking of using RandomAccessFile ,FileChannel ...

37. concurrent.DelayQueue.remove    coderanch.com

public class PurgeDelayThread extends Thread{ private static PurgeDelayThread timerScheduler = null; private DelayQueue queue = null; private CodeskPurgeTask task3; private PurgeDelayThread() { queue = new DelayQueue(); } public static synchronized PurgeDelayThread getInstance() { if(timerScheduler == null) timerScheduler = new PurgeDelayThread(); return timerScheduler; } public void run() { while(true) { try { ScheduleDBPurgeDelay dbDelay = (ScheduleDBPurgeDelay)queue.take(); task3.purgeData(dbDelay.getMonths()[0]); addToQueue(dbDelay.getApplicationId(),dbDelay.getDay(),dbDelay.getHour(),dbDelay.getMonths()); } catch (Exception e) ...

40. Concurrent Users inserting a record    coderanch.com

Hi, I am facing a problem when two user are simultaneously trying to insert a record in a table and both of them getting the same id. I am generating the id (pattern xxx-xxx) in my DAO layer and the way I am doing this is - first I am retrieving the last id created and incrementing it by one to ...

41. large system.in to object concurrent operations    coderanch.com

Here's my problem: on a windows box I need to search for all the locations in any number of drives for a list of files or a single file. The list currently contains 100 files. My solution was to create a hash of the entire drive using the file name as the key and an arraylist of locations as the value. ...

42. Enabling Concurrent Garbage collector    coderanch.com

43. Threads not running concurrent?    coderanch.com

Hi, I'm trying to understand how threads work in Java. For this I use this small test program: public class Threads01 extends Thread { public static void main(String[] args) { new Threads01().start(); new Threads01().start(); } public void run() { for (int i = 0; i < 10; i++) { System.out.print(i + " "); } } } As output, I expect a ...

45. calling two synchronised methods concurrently    coderanch.com

I have a class (say class 'A' ) which has two methods [ m1() and m2() ] both are synchronised. Is it possible to call m1() and m2() of the same object of class 'A', by two separate threadts 't1' and 't2' concurrently: t1.m1() t2.m2() ? What will happen if m1() is synchronised and m() unsynchronised ? will again it will ...

47. To find the Elapsed time of concurrent thread.    coderanch.com

Hi, I am trying to find the Thread execution elapsed time.but it seems fine for only certail loops. Record.java import java.util.Map; /* * its an Model to hold the Parsed File Objects. */ public class Record { private String command; private Map cmdMap; public String getCommand() { return this.command; } public void setCommand(String command) { this.command = command; } public Map ...

48. Concurrent File Write [Idea for comment]    coderanch.com

Hi Ranchers, I'm looking for a way to concurrently write to a log file. The sync blocks around the write in my current application are killing the through put of the system, getting rid of them would be a massive boon. I'm thinking of using a FileChannel to give the ability to write to a specific point in the file, calculating ...

50. Concurrent invocation of a singletone method    coderanch.com

Say there is a method in my singleton. And, from my handler there are invocations to this method. my question is if there are 1000 concurrent hits to the singleton method, how is the situation handled, singleton being only one instance in the memory? - will the 1000 requests queued to be handled in sequence by the JVM - or will ...

51. Concurrent threads in batch    coderanch.com

Hi, Lets say I have 10 transactions in a list where each batch consist of 5 transactions. If all the first 5 transactions is complete (batch 1), then only the next batch is allowed to proceed. Each transaction represents a thread in order to improve the performance as previously the list of transactions is processed one by one. My question is ...

52. will the code running concurrently or not    coderanch.com

Hi, I have a code.In that i am trying to hit two URLs and getting and store their datas in separate objects.My question is will it be processing concurrently.please give me suggestion import java.net.*; import java.io.*; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.xml.sax.SAXException; import org.xml.sax.SAXParseException; import org.w3c.dom.Node; import org.w3c.dom.*; import org.w3c.dom.*; import org.xml.sax.InputSource.*; import org.xml.sax.*; import java.util.*; public ...

53. concurrent programming    java-forums.org

Questions for the experts out here... I am very new to java... I treat it as C till now..but now i have to do multithreading for what i want to achieve... Any suggestions on how to perform multithreading in java... I got four programs , each of them gets a packet of data and check the first four bytes and compares ...

54. concurrent modification    java-forums.org

56. concurrent access to data structure by threads    forums.oracle.com

public ReaderThread () {} public ReaderThread (CallerTest caller,int numWriters,Data data) { this.caller = caller; this.data = data; this.numWriters = numWriters; } public void run() { try{ while(!data.IsModified()) { data.getResultList().wait(); } mergeResults(); // this is some processing if(caller.getCounter() < this.numWriters) data.setModified(false); else { mergeResults(); caller.setFinalResult(finalResult); } } } catch(Exception ent) { log.error("The exception is in remote result reader ", ent); } } ...

57. Concurrent 2D arrays    forums.oracle.com

59. RE : Concurrent FAQ    forums.oracle.com

if the varibale cancelled in the above code is not declared as volatile then how would it transform to If the compiler can see that the while-condition variable isn't modified inside the loop, it is a standard compiler optimization called 'code-hoisting' to move the test out of the loop. 'volatile' tells the compiler the variable can be modified by other means ...

60. Concurrent access to different parts of a RAF    forums.oracle.com

Hi All, I have 4 threads that needs to concurrently write contents to different parts of a single Random Access file. Let me explain with an example. Say, the first thread will always write the first 10 bytes [byte 0 - byte 9] of this file. The 2nd thread will always write content from byte position 10 to 19 of the ...

61. Identify concurrent programs    forums.oracle.com

62. Concurrent API and periodic actions    forums.oracle.com

Hi all, I'd like to execute a periodic operation and stop the process if the operation response changes. For instance, my program can print "Hello world" and stop if it prints "Hello John": "Hello world" "Hello world" "Hello world" "Hello world" "Hello John" I know how to execute periodic actions but don't know how to stop it not using time parameter. ...

63. Concurrent access to records--Is the Logic Implemented Correctly?    forums.oracle.com

There's no way to provide a code that deals with concurrency without knowing exactly what is needed, i.e. the whole scenario! Haven't you read my previous post? Will you synchronize reading access? i.e. when a thread is reading a Record, will others be able to read too? Or is it just writing access? Will be a writing mode, or you want ...

64. Concurrent library in Mac - urgent help    forums.oracle.com

Hi, Posted the following in the newbies forum (I'm one of them) but didn't get much help... Hope I have better luck around here! I'm having a bit of a problem with my first java development (hence I post in this forum). Just as general info, it is an applet that does ftp upload, which uses the apache library. Now, the ...

65. How to run multiple java files concurrently using command line?    forums.oracle.com

Hi, I have to write a script to run multiple java files and c files concurrently. Say, A and C are java files and B is another binary executable file, I have to make sure they are run in the order A-B-C, then I was trying to run by using java A & ./B & java C But it turned out ...

66. Concurrent BInarySearchTree program    forums.oracle.com

67. Concurrent logging to same log file    forums.oracle.com

Hi, I'm using Java Logging API for logging. I'm planning to let the same application run on several servers, and they all should write things into the same log file in the file system. Is that possible? Are there any prerequisites to do that? I couldn't find any hints in the Logging API documentation nor in this forum. Thanks in advance! ...

68. concurrent execution of threads    forums.oracle.com

my aim is to run 2 threads concurrently...let s have a lokk at the following code.... import java.io.*; import java.util.*; class testtimer extends TimerTask { public void run() { System.out.println("timer started"); } } class testtimer2 extends TimerTask { public void run() { System.out.println("timer 2 started"); } } class maintimer { public static void main(String args[]) { testtimer t1=new testtimer(); testtimer2 t2=new ...

69. concurrent programming ideas needed!    forums.oracle.com

Hi... I'm pretty new to Java; at uni, we are usually always given C programing assignements due to the nature of the course being very much low-level programming! but for this module, distributed systems, we have to learn about different distributed methods available! ...and obviously, one of the main ones, being RMI. The assignment is to write a simple RMI chat ...

70. concurrent method invocation?    forums.oracle.com

71. Concurrent applications?    forums.oracle.com

I want to run following jar as concurrent . but every application port must be different from other, Concurrent number will decide this port number. for (int k = 0; k <= CONCURRENT_NUMBER; K++) { String command = "java -jar x-server.jar -port DEFAULT_PORT" + k; Run.exec(command); } I want to run this application as concurrent,, help me..

72. concurrent programming    forums.oracle.com

You shouldn't just synchronize the consumers, the producer(s) should be sync'ed as well. The best object to synchronize on is the shared pool (queue) of produced objects. Producers should just wait while the consumers are busy with that queue and consumers should wait until there is something present in that queue they can consume. kind regards, Jos

73. question realted to concurrent    forums.oracle.com

74. Need help to concurrently swap elements in an array using trylock    forums.oracle.com

One thing that might help is if you try to lock the lower index first. So if thread 1 is trying to lock 3 and 7 and thread 2 is trying to lock 7 and 3, both can succeed in the first lock, but fail on the second one. If you re-arrange them so the lower index is locked first, that ...

75. Doubt Regarding HttpURLConnection (no of concurrent connections)    forums.oracle.com

Is there any limitation to no of concurrent connections that can be opened using HttpURLConnection ? I want to send Data to a servlet using HttpURLConnection . so I am starting 30 threads(to simulate concurrency ) and inside run i am opening HttpURLConnection and send data using post and receive response and closing the connection .But i am getting below error ...

76. Concurrent access to a DLL using JNA    forums.oracle.com

Hi, I am working on a Java project where I use JNA to load a library (.dll) which implements several functions for a VME bus. The project is working fine without any other application needing to access the VME bus (i.e using the same dll). However, the project i'm working on is supposed to be runned with other applications using the ...

java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.