diff options
author | Ivo Hinkelmann <ihi@openoffice.org> | 2008-01-14 12:20:36 +0000 |
---|---|---|
committer | Ivo Hinkelmann <ihi@openoffice.org> | 2008-01-14 12:20:36 +0000 |
commit | 21ffb4797fe4625db26cc19a959de4af35d1249d (patch) | |
tree | f3fcd90d87a4ff68d17e20f93d55954d5e34d6e3 | |
parent | fb72cb927dff359d416feea2385b6283fa5c8933 (diff) |
INTEGRATION: CWS qadev31 (1.1.2); FILE ADDED
2007/11/16 15:49:33 cn 1.1.2.3: #i83329# thread for logging purposes. new initial vrsion
2007/11/16 15:48:58 cn 1.1.2.2: #i83329# thread for logging purposes. new initial vrsion
2007/11/16 15:48:28 cn 1.1.2.1: #i83329# thread for logging purposes. new initial vrsion
-rw-r--r-- | qadevOOo/runner/helper/LoggingThread.java | 127 |
1 files changed, 127 insertions, 0 deletions
diff --git a/qadevOOo/runner/helper/LoggingThread.java b/qadevOOo/runner/helper/LoggingThread.java new file mode 100644 index 000000000000..fc91feae859d --- /dev/null +++ b/qadevOOo/runner/helper/LoggingThread.java @@ -0,0 +1,127 @@ +/************************************************************************* + * + * $RCSfile: LoggingThread.java,v $ + * + * $Revision: 1.2 $ + * + * last change: $Date: 2008-01-14 13:20:36 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/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: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +package helper; + +import share.*; +import lib.TestParameters; +import util.PropertyName; + +/** + * This class is printing to a <CODE>LogWriter</CODE>. This could be usefull if a UNO-API + * function runns longer the the time out. To avoid the assumption of death applikation + * a simple string is logged for 100 times of time out.</br> + * Example:</br> + * logger = new LoggingThread((LogWriter)log, tParam); + * logger.start(); + * oObj.longRunningFunction(); + * logger.finish(); + * + */ +public class LoggingThread extends Thread { + + TestParameters param; + LogWriter log = null; + boolean finished = false; + + /** + * + * @param log + * @param tParam + */ + public LoggingThread(LogWriter log, TestParameters tParam) { + this.log = log; + this.param = tParam; + } + + public void run() { + int timeOut = param.getInt(PropertyName.TIME_OUT) / 2; + int count = 0; + finished = false; + log.println("TimeOutLogger: start"); + while (!finished && count < 200) { + try { + log.println("TimeOutLogger: " + count); + synchronized (this) { + wait(timeOut); + } + count++; + } catch (InterruptedException ex) { + } + } + log.println("TimeOutLogger: finished"); + } + + /** + * finished the LoggingThread + */ + public void finish() { + try { + finished = true; + synchronized (this) { + notify(); + } + log.println("TimeOutLogger: try to finish "); + sleep(1000); + } catch (InterruptedException ex) { + } + } +} |