Process 1 « Development « 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 » Development » Process 1 

1. Will zipping a directory in Java affect other processes using the same files?    stackoverflow.com

I'm using the java.util.zip library and ZipOutputStream in order to create a zip file of a directory and all the files and directories under it. In my application, it is ...

2. Utility to view threads in a Java process    stackoverflow.com

I've got a java application on a windows machine which pins the CPU from time to time. Would like to run a utility to get an idea of how many ...

3. Using threads and ProcessBuilder    stackoverflow.com

I am really unfamiliar with working with threads, so I was hoping someone could help me figure out the best way to do this. I have a JButton in my java application...when ...

4. What does light weight process mean?    stackoverflow.com

Threads are light weight processes, what does it mean?

5. Threading isolation in Java    stackoverflow.com

Is there any sure-fire way to ensure Threads remain isolated from one-another, in Java? I've had an issue for a week and a half, where Threads implementing various 3rd party source ...

6. Process M slow calculations on N threads in Java    stackoverflow.com

I need to run N slow calculations (where N is a fairly large number) and would like to do so on M threads since the slow calculations have a good deal ...

7. Using a thread to capture process output    stackoverflow.com

I am using a thread to capture stream output from a process, and then outputting that stream to the eclipse console. The question I have is when to terminate the thread ...

8. Java, Massive message processing with queue manager (trading)    stackoverflow.com

I would like to design a simple application (without j2ee and jms) that can process massive amount of messages (like in trading systems) I have created a service that can receive messages ...

9. implementaion independent communication within a process    stackoverflow.com

is there any way two threads within the same process can communicate without knowing anything about each other's interface ? basically, one thread is a STOMP server, the other is a client. ...

10. which language is better for packet capturing and processing    stackoverflow.com

I want to write a program that has 2 threads , one thread continuously captures packets from the network and dumps them in a buffer every t seconds and the other ...

11. Process.waitFor(), threads, and InputStreams    stackoverflow.com

In pseudocode, here's what I'm doing:

Process proc = runtime.exec(command);
processOutputStreamInThread(proc.getInputStream());
processOutputStreamInThread(proc.getErrorStream());
proc.waitFor()
However, sometimes processOutputStreamInThread doesn't see any output and sometimes it does. Roughly, the method creates a BufferedInputStream of the command's output and ...

12. Java Inter Process communication and Inter Thread communication?    stackoverflow.com

First , what is the difference between Thread and a Process in Java context? and How Inter Process communication and Inter Thread communication is acheived in Java? Please point me real time examples. Thx ...

13. Java Multi threading - Avoid duplicate request processing    stackoverflow.com

I have following multi threaded environment scenario - Requests are coming to a method and I want to avoid the duplicate processing of concurrent requests coming. As multiple similar requests might ...

14. File processing in java    stackoverflow.com

I have a file of size 2GB which has student records in it. I need to find students based on certain attributes in each record and create a new file with ...

15. Best way to process files from multiple threads in Java?    stackoverflow.com

I currently have a Java program that spawns 50 threads and the goal is to look at a directory that has many files being written to it and upload those files ...

16. Guidance on creating a server that has a group of threads to process requests    stackoverflow.com

Say I am 1000 pop emails that I have to pull emails from. I want to create a service, that utilizes muliple threads so I can pull email from multiple pop3 servers ...

17. What is a process_reaper thread in Java?    stackoverflow.com

I'm getting hundreds of these process_reaper threads that build up over time in my application. Anyone have any idea what these may be? They seem to be in my use of ...

18. Java Panic Button that stops the Java program mid process    stackoverflow.com

some Function()
{  
    for(xxxxxx){
         //a infinite loop or just a long code loading an running stuff from a list
 ...

19. simple process rollback question    stackoverflow.com

while revising for an exam, i came across this simple question asking about rollbacks in processes. i understand how rollbacks occur, but i need some validation on my answer. The question:

20. What really is to "warm up" threads on multithreading processing?    stackoverflow.com

A very direct question this time (I hope). I'm not an experienced programmer and have learned it by myself, so I may lack some concepts. I'm dealing with multithreading in Java and, as ...

21. How to process particular thread as fast into multithread java?    stackoverflow.com

I am doing multithread processing for generating some products... i will create the products every 10 minutes..i have 2 threads .. first thread will wakeup every 10 minutes... the second thread will ...

22. Smart way of processing list with threads    stackoverflow.com

I have a list of read only data which are a bunch of end points on the internet that I want to process. I was wondering is there any kind of ...

23. If the child process is running then how the parent process will complete?    stackoverflow.com

I got a doubt while implementing threads, so thought of getting it cleared before i do some progress. I have a method from where the new thread is getting called and ...

24. Difference between process and thread    stackoverflow.com

I was asked a question during interview today. First they asked how to provide Synchronization between thread. Then they asked how to provide Synchronization between process, because I told them, the variable ...

25. Multi Processing in JAVA    stackoverflow.com

I have a Process in Java, tat takes 4 mins to complete. 10 such process lined up takes around 40 mins. If i Thread the processes like One thread for a ...

26. A question about Thread and Process    stackoverflow.com

I read some tutorial about threads and processes, it is said that the processes be scheduled by operating system kernel, and the threads can be managed and scheduled in a user ...

27. Java: Help with non-blocking thread that runs an external process    stackoverflow.com

I have created a Java GUI application which functions as a wrapper for many low level external processes. The utility works as is, but is in desperate need of one ...

28. Extracting a process's exit code in the case of ThreadInterrupted    stackoverflow.com

I have just created a process through an exec() call and I am now using its .waitFor() method. I need to catch an InterruptedException but I am not sure what I should ...

29. background process using thread    stackoverflow.com

I want to continuously check a table in the database to see whether a new row has been added to it. This runs as a back ground process. I think ...

30. How to invoke ShutdownHook thread with a window close operation of DISPOSE_ON_CLOSE or EXIT_ON_CLOSE    stackoverflow.com

Assuming that Runtime.getRuntime().addShutdownHook(new Thread() has been set up correctly, how can the ShutdownHook thread be invoked when a Java application window (JFrame) is closed (in this case the only window) and ...

31. Is it a good idea to dynamically change the names of processing threads in Java?    stackoverflow.com

We have a Java application that processes requests. Naturally, there is a thread pool with threads named with some insignificant names like "processor-1", "processor-2" etc. We are wondering whether it's a ...

32. Some questions about Java Threads and Process Priorities    stackoverflow.com

I have a small question about threads. On Unix systems, we have nice, which can be used to set priorities processes. OK, on ??my system, I call some external processes, however, ...

33. Java - process image while reading it    stackoverflow.com

I'm designing a server-side application that takes an image from a user, processes it, and sends it back over the network. Since the network connection might be quite slow, I'd like ...

34. Separating a task to a new Java-Thread vs. a new Process    stackoverflow.com

I'm considering separating a task from my main program to a new (java) thread. The second task can be resource consuming (which raises concerns about the "wellbeing" of the main program). Is ...

35. Java - Destroying objects that are in the process of doing something    stackoverflow.com

I've had a look at the posts about destructors in Java and have learnt that Java does not have them but I am confused about what I need to do in ...

36. Are the RMI requests handled per process or thread on server side?    stackoverflow.com

Are the RMI requests handled per process or per thread on the server side?

37. How to use the current thread to process a work queue?    stackoverflow.com

What data structures do I use to implement the following logic?

  1. read() is an asynchronous method that queues some workload
  2. Only one workload may run at a time.
  3. The first thread to queue a ...

38. Does a Java Thread have it's own process ID?    stackoverflow.com

The title says all! I want to get the process ID of a Thread to see how much memory it takes. ;) Thanks guys (:

39. multiple threads injecting data into the subsequent process    stackoverflow.com

I have a project made using Java. I have a complex processing, something like from one single process i create 10 different threads, then the process waits for the other threads ...

40. jstack: Target process not responding    stackoverflow.com

I am running Ubuntu server edition and I wanted to take a thread dump of Tomcat. So, I first tried to find out which PID tomcat uses:

$ jps -l
5809 sun.tools.jps.Jps
But it's not ...

41. Directory naming using Process ID and Thread ID    stackoverflow.com

I have an application with a few threads that manipulate data and save the output in different temporary files on a particular directory, in a Linux or a Windows machine. These ...

42. Java - Use more processing power for very high computative task    stackoverflow.com

I have a relatively simple program that currently uses 1 thread (main). The application takes about 30 minutes to complete. However, according to Task Manager, it is only using ...

43. How to create and process messages from worker threads    stackoverflow.com

How to create asynchronous messages from worker threads to the managing thread. The framework is below. In the snippet, Worker implements Runnable, and threadManager is ExecutorService. The Worker ...

44. SocketChannel.write() in a single thread processing multiple clients    stackoverflow.com

my application has a queue with " outgoing network packets" (A POJO with a ByteBuffer and a SocketChannel) inside, consumed by a single thread that writes the data to the SocketChannel. I ...

45. How do you gracefully exit a Process in Java?    stackoverflow.com

I am trying to make a Java program which will run several other unrelated Java programs, specifically a Minecraft server. Currently, I am trying to work out how to end a java.lang.Process ...

46. Differences between Process and Thread    coderanch.com

Methods like yield(),wait() are provided for IPC in java.Thus they cater to different threads inside the same ONE process.Multiple concurrent processes are supported in modern os's in process control blocks are created by the os track their addresses.Sharing of data is expensive between processes,the familiar consumer-producer processes ascompared to threads within a single process coz of faster context switching.Hope it helps. ...

47. Difference between Thread & Process    coderanch.com

Mukesh, In a nutshell, a process can contain multiple threads. In most multithreading operating systems, a process gets its own memory address space; a thread doesn't. Threads typically share the heap belonging to their parent process. For instance, a JVM runs in a single process in the host O/S. Threads in the JVM share the heap belonging to that process; that's ...

48. Thread processing    coderanch.com

Hi Angela, I think u r confused. There is nothing like how thred will come to know it's upto you what u want from a thread to do for you. If u wish that ur thread should wait for messages u can give code for it to listen at the specific port number using sockets here thread will keep on waiting ...

49. Running the process even after the program quits!    coderanch.com

Hi guys! I am facing a real life trouble here.. from my program I want to initiate some processes which should continue even after my program which started them goes off In short, I want to achieve something like this public class Launcher{ main(){ Runtime.getRuntime().exec("java -cp cpofMyClasspFile MySocketServerClass"); } } now when I do a ^c on the command prompt to ...

50. Thread and Process?    coderanch.com

To understand the basic difference between thread and a process u have to consider various points: 1. Each process has - A. Register context - value of CPU register when the process is executing. B. Data context - The code that the process is executing. C. Stack Context - Various values of function call returns and local variables etc. Now, no. ...

51. Long thread process?    coderanch.com

Hi everyone, I am going to be writing a program that spawns a single thread to do the basic processing of the program, while the event dispatch thread listens to user events. As the loop that the basic processing is performed in is not trivial, is the only way to exit gracefully from this thread to poll some variable that is ...

52. Thread and Process    coderanch.com

A decent book: Concurrency, State Models & Java Programs by Jeff Magee & Jeff Kramer 'Process' can be used to refer to an operating system process, which is a unit of resource allocation both for CPU time and memory in a system. An os process is characterized by: -a data segment -a code segment -multiple stacks, one for each thread The ...

53. Threads vs. processes    coderanch.com

A thread shares its memory space with all other threads living inside the same process. On one hand, this makes it easy for threads to interact with each other as they can simply share data (objects). On the other, if a thread crashes badly it can easily take all other threads down with it. Because threads share so many resources with ...

54. Threading Process Question    coderanch.com

I'm trying to design a process for an application using threads. I am having trouble figuring out the best way to do things. I have an application that will connect to a database, then periodically check for updates and send messages based on the updates. I am using a TimerTask object to check for and process the updates. My goal is ...

55. Thread Vs Process    coderanch.com

56. Process stoping and starting for outside a java app    coderanch.com

Hi all I've got a litte problem. I have an ap that runs ans starts another java app as a daemon on a server I am starting the daemon app in the following way rT.exec("cmd /c java -cp {all needed libs} {daemon app}"); my questions is: 1. Will this process keep runing on the unix system after i log off (can ...

57. Process ID of current thread !!!!! URGENT !!!!!!!    coderanch.com

Hello, How can i get the process ID that would be allocated by the JVM to any particular thread ? ie i've a java thread which invokes another thread and the INVOKING thread need to know the PROCESS ID of INVOKED thread. That means the invoked thread should return its own process id to the thread that invoked it. is there ...

58. An always running process for queue processing    coderanch.com

Hi, This is the simple representation of the situation: a producer (Servlet) produces queue elements and enqueues the elements (the queue is a Singleton datastructure). A consumer dequeues the elements for processing. The produces could produce elements all the time (in a very extreme situation), and should always be able to enqueue. The consumer is a Thread that is always running. ...

59. Thread and Process    coderanch.com

Hi, I read in my college days that a Thread is a lighter process , is'nt that true? I had a discussion earlier with a collegue who says , you cannot even call a thread as a lighter process . and i believe that a thread has to start from a process. I know some things likes the context switch for ...

60. running background process    coderanch.com

If you want to call another thread from servlet, it makes sense for servlet not to wait and return from doPost ( or doGet ) method. The idea of the background processing in servlet is to allow servlet code to return while the background thread will continue. Jason Hunter book on "Java Servlet Programming" has a very good example on servlet ...

61. process & thread    coderanch.com

In common usage (but not legally binding, so you will find exceptions) a process is a large-grained thing started by the operating system. When we start a Java program, the OS starts the JVM as a process. A thread is a finer grained thing inside the process, managed by the process. So the JVM can manage many threads inside its process. ...

62. process ID    coderanch.com

63. How to get java process id?    coderanch.com

64. Get a list of Processes    coderanch.com

65. create process problem    coderanch.com

Hi All, I am trying to call another software from my java program. And the source code is: Runtime r = Runtime.getRuntime(); Process p = null; try { p = r.exec("racer.exe"); }catch (Exception e) { System.out.print(e.getMessage()); } The software "racer.exe" must be started in MS-DOS environment and I compile and execute my java program also in MS-DOS environment. Now the problem ...

66. process management    coderanch.com

Hi all, I'm running a script on UNIX from my java application using Process p = Runtime.getRuntime().exec("/bin/sh " + cmdfilename); p.waitFor(); However it doesn't always run successfully so I want to be able to trace an output /errors thrown from the process ... how should I go about that ? On a separate note ... the script I'm running is to ...

67. How to speed up Batch Process    coderanch.com

HI all I want to speed up the processing time of my batch process which is taking hours for processing 10000+ records.I am using stateless session beans with DAO Beans to fetch\write Records in to data base .I use Prepared Statements for record insertion with more than 100 prepared statements for each record insertion. Do we have any other technique to ...

68. process has not exited    coderanch.com

Hi Friends, I am using Runtime class in my application.It creates JAR & EAR Files.For that I used Runtime class. Here my peace of code Pls help me what is worng in this code. try { String stmt = "jar -Mcvf " + ejbJarName + " META-INF/MANIFEST.MF " +" META-INF/ejb-jar.xml " + " com"; Process stmtProcess = java.lang.Runtime.getRuntime().exec(stmt); if (osname.startsWith("Windows")) { ...

69. eternal process    coderanch.com

You can use the Timer class in the library to run a task at scheduled times. Timer is a normal Java thread with a loop in the run() method and it can be set to never end. It would be nice to have a clean way to terminate it. Ctrl-C works, but a UI or a remote interface - eg a ...

70. multiple process in AIX    coderanch.com

I work on applications that use similar environment (AIX and Jdk1.3.1). If your java application is starting threads as soon as you start your application, then for a breif time (while your program is spawning threads), it shows that those threads as 'sub-processes'. you will know which process is the actual process and which are 'subprocesses/threads' by looking at their process ...

71. Process sequence    coderanch.com

Hi guys, hope you can give me a few ideas where to look to solve this problem: I have a component that recieves a message. I have an executor with a method execute() that is called by part of a framework. The execute method waits until the component recieves a message and notifies listeners (eg the executor). I'm trying to then ...

72. processing huge file in multithreaded env    coderanch.com

Hi all, the functionality that i am trying to implement is: 1. Read file 2. validate each record(line). 3. store record to DB. I want record processing should happen in parallel. What I meant by this is, read a file by thread A, handle the line(record) to sub thread to validate and store in DB), while sub thread busy doing validation ...

73. Send response before process is done.    coderanch.com

Hi, Sorry if this as been already answered but I could not find the information. I have 3 part in my project. A j2me device A servlet A Asp control that send fax. So I call my servlet with my j2me device, my device wait on the getResponseCode(), my Servlet do the process in the end it call the asp control ...

74. looking for help about using multiple threads to process several objects    coderanch.com

Hi Thank you for reading my post I have a question about threading , i now how to initiate a thread and use it , but what i do not know is : I have an array of objects (i am not allowd to change those objects class structure) i want to use several threads to process all this objects instead ...

75. Constant running process    coderanch.com

Tom, I might have misread your question. You never stated that you wanted to create new threads. And this question may just be how to use the sleep() method of the Thread class. If this is true... The sleep() method is static and affects the current thread. There is no reason to create a new thread object -- it can be ...

76. light weight process.    coderanch.com

77. running process in thread??    coderanch.com

In my application I kick off a batch file that runs osql commands and executes scripts for our dbas. There are some scripts that I can run in parallel and so I am now creating threads to run those. However I still see a serialized execution of threads one after another. Is this even possible to kick off processes (using Runtime.exec) ...

78. Process completes and abruptly stops its threads?    coderanch.com

Im having an odd problem with thread pooling. I have a class (lets call it Sender) that runs through a variety of data objects, spawning threads to process each one. I created a class that implements Runnable and, of course, implements the run() method. When it is instantiated, a reference to Sender is passed to it. At the end of run(), ...

79. Background Process    coderanch.com

I have a desktop application. I want to create a background thread that will call some functions or wait for an event to occur, without blocking the main thread (the user must be able to access the main form, click buttons etc.). The background thread is hidden for him. And when the function called is finihed or specified event occurs, the ...

80. Thread vs Process    coderanch.com

A favorite interview question is: What is the difference between Process and Thread. Here is my answer: Process: An instance of a program; Executed in own address space Independent entity to which system assigns resources CPU time, memory Cannot access variables or other data structure in another process Process communicate using inter-process mechanisms like files, pipes, sockets Thread Is ...

82. new threads for background processing    coderanch.com

dear guys, i don't think there is any way of renaming a post, so i created a new one whichh more accurately describes my question. my previous post was titled "sending html to the browser whilst an intensive operation proceeds ". my question is now... is it possible to start a new thread to handle the retrievel of the data. This ...

83. background processing - thread    coderanch.com

Hi all, I want to design a servlet that monitors a particular task continously in a loop. For this I am creating a thread that will run in a continous loop monitoring the task. I want to make this a background thread that will exist and keeps on doing it's job even when the servlet is unloaded? How can I do ...

84. multiple processes spawning for single-threaded application...    coderanch.com

hi folks, i have an rmi server running which extends UnicastRemoteObject and upon startup, before any clients have connected, it spawns about 15 processes, 1 parent and 14 children. the same thing happens when i start the rmiregistry (1 parent, 12 children). i'm running on suse 9.0 using jdk 1.4.1_06. i don't believe i've seen this sort of behavior before and ...

85. Process and threads    coderanch.com

Usually process means a "heavy weight" program context started by the operating system. If you start NotePad three times, each one is a process. You can see three applications and three processes in Task Manager. Threads are "light weight", meaning it's a lot less work to set one up, manage it and tear it down. A single process can manage multiple ...

86. Process vs thread    coderanch.com

To overgeneralize ... Processes are started by the operating system. There is quite a bit of startup and teardown overhead. They offer good safety and isolation from each other, the downside of which is it's harder to make them communicate with each other. Threads are managed by a program running in a process. They are lighter weight to startup and teardown, ...

87. Threads vs Processes    coderanch.com

A thread in computer science is short for a thread of execution. Threads are a way for a program to split itself into two or more simultaneously (or pseudo-simultaneously) running tasks. Threads and processes differ from one operating system to another, but in general, the way that a thread is created and shares its resources is different from the way a ...

88. Process and Thread    coderanch.com

A Process object is good for only a few things: - interaction with the process using the input, output and error streams - terminating the process - waiting for the process to finish before doing anything else - retrieving the exit code of the process That's why there are only methods for these operations.

89. What is the difference between process & thread??    coderanch.com

Both threads and processes are methods of parallelizing an application. However, processes are independent execution units that contain their own state information, use their own address spaces, and only interact with each other via interprocess communication mechanisms (generally managed by the operating system). Applications are typically divided into processes during the design phase, and a master process explicitly spawns sub-processes when ...

90. is Thread a light-weight process?    coderanch.com

91. Java multiprocess communication with each process running multiple threads    coderanch.com

Hello friends, I am testing my own 'desktop application' which processes bulk user data with the help of multithreading with each thread processing one user's data. The number of threads running at a time is configurable and I have set it to a value which gave us best overall throughput. Out of blue, I had setup multiple instances running with the ...

93. Writing to the Process OutputStream    coderanch.com

94. Multiple processes accessing single class data    coderanch.com

Hi. so, what i want to do is.. for example, if there is class1.java, class2.java and class.java, and each java source file has main classes, and when compiled, load as an individual program. let's say there is a deque in class.java. what i want to do is to allow class1.java and class2.java accesses to the same deque(same memory space; i am ...

95. Thread processing time    coderanch.com

Hi All, I am working on a Rule Engine Application, which is implementing Apache Lucene for indexing. The performance of this application is poor and incosistent. We are trying to findout a bottleneck which is hitting the performance. This application creates threads to process the records and for each 1lac records, it creates one thread. Now when I am running a ...

96. How to make the Threads efficient towards the end of process?    coderanch.com

Hi I am currently running a java application starting with 50 threads at a time. Every threads also include numerous page downloads from the web, so at start (when all the 50 threads are running), the process is very fast. When nearly 40 threads finish their operations and only the remaining threads are working....it takes a lot of time ....which also ...

97. Java processes    coderanch.com

For the program I am writing, I must not use threads at all, I can only use processes. I am trying to understand where to perform operations on the data once a child process is created. Here is the code: public static void main(String args[]) { try { // spawn child Runtime rt = Runtime.getRuntime(); Process proc = rt.exec("java child"); ArrayList ...

98. Process Thread Relation    coderanch.com

Hi, I am planning for a database synchronization tool which need to move a set of data from production server to test server.I am expecting load of some 50,000 to 1,00000 records from various tables. If i intend to do it in a generic way to handle more load than that, 1) Do i need to create multiple threads from a ...

99. How to use multiple threads to speed processing    coderanch.com

I am new to Java Threads. I would like to use threads to speed the processing of the following program. This is the pojo that does the work: import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.InputStream; import java.math.BigInteger; import java.security.MessageDigest; import java.util.ArrayList; import java.util.HashMap; public class FileFinder { private File originalFileObject; private File fileObject; private HashMap allFiles; private ArrayList duplicateFiles; private ...

100. Process the multiple records in a file by Producer/consumer concept using Multithreading    coderanch.com

Hi, I am new to coderanch forum.I have 3 years of Java exp and i never worked on threads. Here is the high level overivew of my code that I have created. Create Executor service for Producer to pick up the records using Linked blocking queue.. Once the records have been taken up by the producer, it will form ...

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.