1 /* 2 * Copyright (C) 2014 Cristian Sulea ( http://cristian.sulea.net ) 3 * 4 * This program is free software: you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License as published by 6 * the Free Software Foundation, either version 3 of the License, or 7 * (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU Lesser General Public License for more details. 13 * 14 * You should have received a copy of the GNU Lesser General Public License 15 * along with this program. If not, see <http://www.gnu.org/licenses/>. 16 */ 17 18 package jatoo.exec.remote; 19 20 import com.jcraft.jsch.Channel; 21 22 /** 23 * Sometimes we want to do some things after the execution started (like a force 24 * stop for example). This callback allows us to acquire such a behavior. 25 * 26 * @author <a href="http://cristian.sulea.net" rel="author">Cristian Sulea</a> 27 * @version 1.1, July 24, 2014 28 */ 29 public final class RemoteCommandExecutorCallback { 30 31 private Channel channel; 32 33 void setChannel(final Channel channel) { 34 this.channel = channel; 35 } 36 37 public void disconnectChannel() { 38 if (channel != null) { 39 channel.disconnect(); 40 } 41 } 42 43 }