public void stopRunning( StepMetaInterface smi, StepDataInterface sdi ) throws KettleException {
    if ( this.isStopped() || sdi.isDisposed() ) {
      return;
    }

    dbLock.lock();
    try {
      meta = (TableInputMeta) smi;
      data = (TableInputData) sdi;

      setStopped( true );

      if ( data.db != null  && data.db.getConnection() != null && !data.isCanceled ) {
        data.db.cancelQuery();
        data.isCanceled = true;
      }
    } finally {
      dbLock.unlock();
    }
  }
@Test
  public void testStopRunningWhenStepDataInterfaceIsDisposed() throws KettleException {
    doReturn( false ).when( mockTableInput ).isStopped();
    doReturn( true ).when( mockStepDataInterface ).isDisposed();

    mockTableInput.stopRunning( mockStepMetaInterface, mockStepDataInterface );

    verify( mockTableInput, times( 1 ) ).isStopped();
    verify( mockStepDataInterface, times( 1 ) ).isDisposed();
  }