/*___INFO__MARK_BEGIN__*/
/*************************************************************************
 * 
 *  The Contents of this file are made available subject to the terms of
 *  the Sun Industry Standards Source License Version 1.2
 * 
 *  Sun Microsystems Inc., March, 2001
 * 
 * 
 *  Sun Industry Standards Source License Version 1.2
 *  =================================================
 *  The contents of this file are subject to the Sun Industry Standards
 *  Source License Version 1.2 (the "License"); You may not use this file
 *  except in compliance with the License. You may obtain a copy of the
 *  License at http://gridengine.sunsource.net/Gridengine_SISSL_license.html
 * 
 *  Software provided under this License is provided on an "AS IS" basis,
 *  WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
 *  WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
 *  MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
 *  See the License for the specific provisions governing your rights and
 *  obligations concerning the Software.
 * 
 *   The Initial Developer of the Original Code is: Sun Microsystems, Inc.
 * 
 *   Copyright: 2001 by Sun Microsystems, Inc.
 * 
 *   All Rights Reserved.
 * 
 ************************************************************************/
/*___INFO__MARK_END__*/
package jqmon;_x000D_
_x000D_
import java.lang.*;_x000D_
import jqmon.debug.*;_x000D_
import jqmon.events.*;_x000D_
import codine.*;_x000D_
_x000D_
/**_x000D_
   Diese Klasse repraesentiert den JWorkerThread, das Arbeitstier._x000D_
   Er schickt DPrint-Meldungen an den angeschlossenen JDPrintThread,_x000D_
   falls einer angeschlossen ist._x000D_
	_x000D_
	@author  Michael Roehrl_x000D_
	@version 0,01_x000D_
_x000D_
*/_x000D_
_x000D_
public class JWorkerThread extends Thread {_x000D_
_x000D_
	/** Soll der Thread beendet werden ? */_x000D_
	protected boolean end = false;_x000D_
_x000D_
	/** Das globale JDebug-Objekt */_x000D_
	protected JDebug debug = null;_x000D_
_x000D_
	/** Die JAnswerList */_x000D_
	protected JAnswerList answerList = null;_x000D_
	_x000D_
	/** Die Queue-Liste */_x000D_
	protected JQueueList queueList = null;_x000D_
_x000D_
	/** Die Host-Liste */_x000D_
	protected JHostList hostList = null;_x000D_
_x000D_
	/** Das UpdateQueueList Model */_x000D_
	protected JUpdateQueueList updateQueueList = null;_x000D_
	_x000D_
	/** Das UpdateHostList Model */_x000D_
	protected JUpdateHostList updateHostList = null;_x000D_
	_x000D_
	_x000D_
   /** Default-Konstruktor. Legt einen JWorkerThread ohne JDPrintThread an._x000D_
       Im Normalfall sollte ein JDPrintThread mitangegeben werden._x000D_
    */_x000D_
   public JWorkerThread(JDebug d, JUpdateQueueList q, JUpdateHostList h) {_x000D_
      debug 	  		 = d;_x000D_
		updateQueueList = q;_x000D_
		updateHostList  = h;_x000D_
		answerList 		 = new JAnswerList(10,10);_x000D_
		queueList  		 = new JQueueList(10,10);_x000D_
		hostList	  = new JHostList(10,10);_x000D_
   }_x000D_
   _x000D_
_x000D_
   /** Haelt den Thread am Laufen. Er befindet sich in einer Endlosschleife_x000D_
       und kann nur doch "stop" angehalten werden._x000D_
    */_x000D_
	public void run() {_x000D_
		contact();_x000D_
      try {_x000D_
         while( !end ) {_x000D_
            work();_x000D_
            sleep(1000);_x000D_
         }_x000D_
      } _x000D_
      catch (InterruptedException e) {_x000D_
      }_x000D_
      catch (ThreadDeath td) {_x000D_
			cleanup();_x000D_
         throw td; // Muss unbedingt nochmal geworfen werden!!_x000D_
      }_x000D_
_x000D_
		cleanup();_x000D_
	}_x000D_
_x000D_
_x000D_
   /** Macht die ganze Arbeit. Wird von run() aufgerufen, weil_x000D_
       sich nur so synchronisiert arbeiten laesst. _x000D_
    */_x000D_
   protected synchronized void work() {_x000D_
		_x000D_
   }_x000D_
_x000D_
_x000D_
   /** Setzen des JDPrintThread. Sollte dieser Null sein, so werden keine JDPrintStrings_x000D_
       verarbeitet._x000D_
    */_x000D_
_x000D_
	public synchronized void endThread() {_x000D_
		end = true;_x000D_
	}_x000D_
_x000D_
	protected void cleanup() {_x000D_
	}_x000D_
_x000D_
	protected synchronized void contact() {_x000D_
		debug.DENTER("JWorderThread.contact");_x000D_
		contactC();_x000D_
		updateQueueList.newJQueueList(answerList, queueList);_x000D_
		updateHostList.newJHostList(answerList, hostList);_x000D_
		debug.DEXIT();_x000D_
	}_x000D_
_x000D_
	private native void contactC();_x000D_
	private native void getQueue();_x000D_
}_x000D_

/** Soll der Thread beendet werden ? */
/*___INFO__MARK_BEGIN__*/
/*************************************************************************
 * 
 *  The Contents of this file are made available subject to the terms of
 *  the Sun Industry Standards Source License Version 1.2
 * 
 *  Sun Microsystems Inc., March, 2001
 * 
 * 
 *  Sun Industry Standards Source License Version 1.2
 *  =================================================
 *  The contents of this file are subject to the Sun Industry Standards
 *  Source License Version 1.2 (the "License"); You may not use this file
 *  except in compliance with the License. You may obtain a copy of the
 *  License at http://gridengine.sunsource.net/Gridengine_SISSL_license.html
 * 
 *  Software provided under this License is provided on an "AS IS" basis,
 *  WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
 *  WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
 *  MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
 *  See the License for the specific provisions governing your rights and
 *  obligations concerning the Software.
 * 
 *   The Initial Developer of the Original Code is: Sun Microsystems, Inc.
 * 
 *   Copyright: 2001 by Sun Microsystems, Inc.
 * 
 *   All Rights Reserved.
 * 
 ************************************************************************/
/*___INFO__MARK_END__*/
package jqmon;_x000D_
_x000D_
import java.lang.*;_x000D_
import jqmon.debug.*;_x000D_
import jqmon.events.*;_x000D_
import codine.*;_x000D_
_x000D_
/**_x000D_
   Diese Klasse repraesentiert den JWorkerThread, das Arbeitstier._x000D_
   Er schickt DPrint-Meldungen an den angeschlossenen JDPrintThread,_x000D_
   falls einer angeschlossen ist._x000D_
	_x000D_
	@author  Michael Roehrl_x000D_
	@version 0,01_x000D_
_x000D_
*/_x000D_
_x000D_
public class JWorkerThread extends Thread {_x000D_
_x000D_
	/** Soll der Thread<SUF>*/_x000D_
	protected boolean end = false;_x000D_
_x000D_
	/** Das globale JDebug-Objekt */_x000D_
	protected JDebug debug = null;_x000D_
_x000D_
	/** Die JAnswerList */_x000D_
	protected JAnswerList answerList = null;_x000D_
	_x000D_
	/** Die Queue-Liste */_x000D_
	protected JQueueList queueList = null;_x000D_
_x000D_
	/** Die Host-Liste */_x000D_
	protected JHostList hostList = null;_x000D_
_x000D_
	/** Das UpdateQueueList Model */_x000D_
	protected JUpdateQueueList updateQueueList = null;_x000D_
	_x000D_
	/** Das UpdateHostList Model */_x000D_
	protected JUpdateHostList updateHostList = null;_x000D_
	_x000D_
	_x000D_
   /** Default-Konstruktor. Legt einen JWorkerThread ohne JDPrintThread an._x000D_
       Im Normalfall sollte ein JDPrintThread mitangegeben werden._x000D_
    */_x000D_
   public JWorkerThread(JDebug d, JUpdateQueueList q, JUpdateHostList h) {_x000D_
      debug 	  		 = d;_x000D_
		updateQueueList = q;_x000D_
		updateHostList  = h;_x000D_
		answerList 		 = new JAnswerList(10,10);_x000D_
		queueList  		 = new JQueueList(10,10);_x000D_
		hostList	  = new JHostList(10,10);_x000D_
   }_x000D_
   _x000D_
_x000D_
   /** Haelt den Thread am Laufen. Er befindet sich in einer Endlosschleife_x000D_
       und kann nur doch "stop" angehalten werden._x000D_
    */_x000D_
	public void run() {_x000D_
		contact();_x000D_
      try {_x000D_
         while( !end ) {_x000D_
            work();_x000D_
            sleep(1000);_x000D_
         }_x000D_
      } _x000D_
      catch (InterruptedException e) {_x000D_
      }_x000D_
      catch (ThreadDeath td) {_x000D_
			cleanup();_x000D_
         throw td; // Muss unbedingt nochmal geworfen werden!!_x000D_
      }_x000D_
_x000D_
		cleanup();_x000D_
	}_x000D_
_x000D_
_x000D_
   /** Macht die ganze Arbeit. Wird von run() aufgerufen, weil_x000D_
       sich nur so synchronisiert arbeiten laesst. _x000D_
    */_x000D_
   protected synchronized void work() {_x000D_
		_x000D_
   }_x000D_
_x000D_
_x000D_
   /** Setzen des JDPrintThread. Sollte dieser Null sein, so werden keine JDPrintStrings_x000D_
       verarbeitet._x000D_
    */_x000D_
_x000D_
	public synchronized void endThread() {_x000D_
		end = true;_x000D_
	}_x000D_
_x000D_
	protected void cleanup() {_x000D_
	}_x000D_
_x000D_
	protected synchronized void contact() {_x000D_
		debug.DENTER("JWorderThread.contact");_x000D_
		contactC();_x000D_
		updateQueueList.newJQueueList(answerList, queueList);_x000D_
		updateHostList.newJHostList(answerList, hostList);_x000D_
		debug.DEXIT();_x000D_
	}_x000D_
_x000D_
	private native void contactC();_x000D_
	private native void getQueue();_x000D_
}_x000D_
