profesorfalken / jPowerShell

Simple Java API to interact with PowerShell console
Apache License 2.0
218 stars 84 forks source link

WAIT_PAUSE of 10ms insufficient #3

Closed jadcsi closed 8 years ago

jadcsi commented 8 years ago

Hi,

I am facing a problem when an individual .executeCommand() call is time consuming and hence is failing with the below Exception:

Mar 02, 2016 1:14:52 PM com.profesorfalken.jpowershell.PowerShellCommandProcessor call SEVERE: null java.lang.InterruptedException: sleep interrupted at java.lang.Thread.sleep(Native Method) at com.profesorfalken.jpowershell.PowerShellCommandProcessor.continueReading(PowerShellCommandProcessor.java:98) at com.profesorfalken.jpowershell.PowerShellCommandProcessor.call(PowerShellCommandProcessor.java:70) at com.profesorfalken.jpowershell.PowerShellCommandProcessor.call(PowerShellCommandProcessor.java:1) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745)

I am going to try to play with the below variables in the source code:

static final int WAIT_PAUSE = 10; static final int MAX_WAIT = 2000;

Do you think they should be exposed as part of the constructor for PowerShell?

jadcsi commented 8 years ago

Please disregard what you see above. It was a fault in my code. I learned that files accessed by powershell command should be closed in the java program before running the command

profesorfalken commented 8 years ago

Ok perfect, no problem then :-)