• Post Reply Bookmark Topic Watch Topic
  • New Topic

Runtime process interaction  RSS feed

 
Kurt Semba
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys,

I'm developing a client/server application using javax web services. The server waits for incoming client calls, runs a powershell command to gather some data and returns the results to the client. Everything works pretty good when I just do a simple call like this and then consume the output/input/error streams, close all streams, finalize and close the process and the runtime (below is just a snippet):

Now the problem is that before I can run my powershell command I need to load some snap-ins into the powershell console and this takes a long time (long = 1 - 2 minutes!) and I don#t want the client to have to wait so long each time he calls the web service method. So I'd like to open up a runtime, create new process which calls powershell.exe and loads the snap-ins on server startup (this all works already) and then, when the client calls the web serivice method simply re-use the existing powershell process to make additional calls and return the results.

I've tried to keep the process's inputstream open, tried to write to it after the first initial Process proc = runtime.exec(cmds); but it doesn't work. Depending on what I do I get no output from the additional command or an error message because I've closde some of the streams of the existing process.

Any hints on how to do that properly? What I need is a process that "lives" forever and accepts new commands and lets me read the results as often as I want.

Thanks
Kurt
 
Kurt Semba
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is the solution for those interested:
https://forums.oracle.com/forums/message.jspa?messageID=10074000
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!