isExecSuccess=false;
exitCode=-1;
Thread newThread=new Thread(new Runnable() {
@Override
public void run() {
try {
exitCode= process.waitFor();
isExecSuccess=true;
} catch (InterruptedException e) {
e.printStackTrace();
}
}
});
newThread.start();
long startTime=System.currentTimeMillis();
long currentTime;
long timeOut=0;
while (timeOut< this.ftpCommandTimeout && !isExecSuccess){
Thread.sleep(10);
currentTime=System.currentTimeMillis();
timeOut=currentTime-startTime;
}
if(newThread.isAlive()){
newThread.interrupt();
}
isExecSuccess=false;
exitCode=-1;
Thread newThread=new Thread(new Runnable() {
@Override
public void run() {
try {
exitCode= process.waitFor();
isExecSuccess=true;
} catch (InterruptedException e) {
e.printStackTrace();
}
}
});
newThread.start();
long startTime=System.currentTimeMillis();
long currentTime;
long timeOut=0;
while (timeOut< this.ftpCommandTimeout && !isExecSuccess){
Thread.sleep(10);
currentTime=System.currentTimeMillis();
timeOut=currentTime-startTime;
}
if(newThread.isAlive()){
newThread.interrupt();
}