public void startSearch() {

        stopSearch();

        stop = false;

        MiscUtils.getExecutor().execute(new Runnable() {
            @Override
            public void run() {
                isSearching = true;
                try {
                    if (finder != null) {
                        finder.start();
                    }

                    for (String aSrPath : srPath) {
                        getFile(new File(aSrPath));
                    }

                    if (!stop && finder != null) {
                        finder.finished();
                    }

                } finally {
                    isSearching = false;
                }

            }
        });
    }
public void startSearch ( ) { stopSearch ( ) ; stop = false ; MiscUtils . getExecutor ( ) . execute ( new Runnable ( ) { @ Override public void run ( ) { isSearching = true ; try { if ( finder != null ) { finder . start ( ) ; } for ( String aSrPath : srPath ) { getFile ( new File ( aSrPath ) ) ; } if ( ! stop && finder != null ) { finder . finished ( ) ; } } finally { isSearching = false ; } } } ) ; }
开始搜索目录. 当前搜索会停止之前的搜索