Project

General

Profile

« Previous | Next » 

Revision 2902

Added by sgarg about 19 years ago

bugfixes to teh previous commit... cleaner exit for the indexing thread

View differences:

src/edu/ucsb/nceas/metacat/IndexingQueue.java
55 55
	    for (int i = 0; i < NUMBEROFINDEXINGTHREADS; i++) {
56 56
	      Thread thread = new IndexingTask();
57 57
	      thread.start();
58
	      currentThreads.add(thread);
58 59
	    }
59 60
    }
60 61
	
......
92 93
	public void setMetacatRunning(boolean metacatRunning){
93 94
		this.metacatRunning = metacatRunning;
94 95
		
95
		if(metacatRunning == false){
96
			indexingMap.notifyAll();
96
		if(!metacatRunning){
97
			for(int count=0; count<currentThreads.size(); count++){
98
				((IndexingTask)currentThreads.get(count)).metacatRunning = false;
99
				((Thread)currentThreads.get(count)).interrupt();
100
			}
97 101
		}
98 102
	}
99 103
	
......
123 127
  	  private Logger logMetacat = Logger.getLogger(IndexingTask.class);
124 128
      protected final long MAXIMUMINDEXDELAY = Integer.
125 129
      	parseInt(MetaCatUtil.getOption("maximumIndexDelay"));;
126

  
130
      protected boolean metacatRunning = true;
131
      	
127 132
	  public void run() {
128
	    while (IndexingQueue.getInstance().getMetacatRunning()) {
133
	    while (metacatRunning) {
129 134
	      // blocks until job
130 135
	      IndexingQueueObject returnVal = 
131 136
	    	  IndexingQueue.getInstance().getNext();

Also available in: Unified diff