Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

How ChannelExec.isClosed() works

pm81
2011-04-01
2013-05-28
  • pm81
    pm81
    2011-04-01

    I'm using JSch to send start command to start JBoss server instance. Which is working fine, I can my server was started but in client code I am checking to see if the channel is closed before returning, but that is taking several minutes to close… Is it my coding bug or JSch bug… Here is my code looks like -

    channelExec.setCommand(startCommand);
    channelExec.connect();
    while (!channelExec.isClosed()) {sleep;}

    start command is a command to invoke ksh script which has script to start the server.  My understanding was that it should be returning immediately but even after starting the server, executing the script, still channel is open. Is it correct way to ahndle this?

    any suggestions?? Thanks.