File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Threads and Synchronization and the fly likes Access to another process' memory Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Threads and Synchronization
Reply Bookmark "Access to another process Watch "Access to another process New topic
Author

Access to another process' memory

Richard Robbins
Ranch Hand

Joined: Mar 07, 2001
Posts: 66
I am creating an application wherein a buffer is required to keep messages that come in at a faster rate than they can be processed. I have one app called StoreMsgIn that will receive messages and store them in a data structure. Another app, XFerMsg, needs to remove messages from the message queue created by StoreMsgIn. How can I give XFerMsg access to the data structure created by StoreMsgIn? Thanks, Richard


Richard Robbins is one of the founders of WebsiteTemplateDatabase.com, a resource for free website templates and Photoshop tutorials. He also consults for an online boutique selling baptism dresses and christening gowns.
Rahul Rathore
Ranch Hand

Joined: Sep 30, 2000
Posts: 324
StoreMsgIn must define synchronized add() and synchronized remove() methods. Messages will be added to the queue using add(). Messages will be removed from the queue using remove() method. XFerMsg must execute in a separate thread, which regularly calls the remove() method. To reduce the load on the processor use the wait-notify protocol. If at the time of remove() the thread of XFerMsg finds that the queue is empty, then it must go into wait(). Then inside every add() method there must be a notify/notifyAll() to wake up waiting thread/threads.
Rahul Mahindrakar
Ranch Hand

Joined: Jul 28, 2000
Posts: 1829
Excellent Rathore!!!

How can I give XFerMsg access to the data structure created by StoreMsgIn

Richard you need to pass the datastructure to the StoreMsgIn either in its constructor or through a method invocation. Check out the section in the Java Tutorial on PipedInputStreams here

[This message has been edited by Rahul Mahindrakar (edited April 03, 2001).]
Richard Robbins
Ranch Hand

Joined: Mar 07, 2001
Posts: 66
Thanks for the help Rehuls. Richard
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Access to another process' memory
 
Similar Threads
packages
Design Questions
How to create a war file.
inheriting a class
Hibernate - Database IP changes daily