• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Access to another process' memory

 
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 324
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 1871
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the help Rehuls. Richard
 
The knights of nee want a shrubbery. And a tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic