Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 181090 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/hyades/logging/adapter/util/properties/messages.properties (-1 / +2 lines)
Lines 194-200 Link Here
194
HyadesGAValidation_No_GLAHome_WARN_=IWAT0871W GLA_HOME is not provided to the JVM. The adapter configuration will not be validated against the schema.
194
HyadesGAValidation_No_GLAHome_WARN_=IWAT0871W GLA_HOME is not provided to the JVM. The adapter configuration will not be validated against the schema.
195
INVALID_LOG_TYPE_INFO_                              = IWAT0812I No log records were parsed. Ensure the log you are parsing is of the expected type.
195
INVALID_LOG_TYPE_INFO_                              = IWAT0812I No log records were parsed. Ensure the log you are parsing is of the expected type.
196
196
197
 
197
HyadesGAAdapter_Already_Running_ERROR_=IWAT0876E This instance of the adapter is already active. Please ensure that you stop the adapter before trying to start it again.
198
198
# Message strings:
199
# Message strings:
199
EXCEPTION                                           = Exception
200
EXCEPTION                                           = Exception
200
 
201
 
(-)src/org/eclipse/hyades/logging/adapter/Adapter.java (-16 / +49 lines)
Lines 136-144 Link Here
136
     * Setup the adapter and validate the configuration file.  This method
136
     * Setup the adapter and validate the configuration file.  This method
137
     * will not run the adapter and stops after validation.
137
     * will not run the adapter and stops after validation.
138
     * @throws AdapterException if the configuration is invalid
138
     * @throws AdapterException if the configuration is invalid
139
     * @throws AdapterBusy if the adapter is already running
139
     */
140
     */
140
    public void validate() throws AdapterException {
141
    public void validate() throws AdapterBusy, AdapterException {
141
    	synchronized(this) {
142
       
143
        synchronized(this) {
144
            
145
            /* bugzilla 181090
146
             * Only validate the adapter if it is not already running.
147
             */
148
            if (status.isActive()) {
149
                throw new AdapterBusy(Messages.getString("HyadesGAAdapter_Already_Running_ERROR_"));
150
            }
142
    	   	/* If the controller object already exists and the adapter configuration file has not changed Then
151
    	   	/* If the controller object already exists and the adapter configuration file has not changed Then
143
        	 * validate the current configuration.
152
        	 * validate the current configuration.
144
        	 */
153
        	 */
Lines 194-207 Link Here
194
     * unless the configuration files were specified with setContextConfigPath and setComponentConfigPath methods.
203
     * unless the configuration files were specified with setContextConfigPath and setComponentConfigPath methods.
195
     * @param separateThread Run the adapter in a separate thread
204
     * @param separateThread Run the adapter in a separate thread
196
     * @param daemon Run the adapter as a daemon thread.
205
     * @param daemon Run the adapter as a daemon thread.
197
     * @throws AdapterException If an error occurs during execution.
206
     * @throws AdapterException if the configuration is invalid
207
     * @throws AdapterBusy if the adapter is already running
198
     */
208
     */
199
    public void start(boolean separateThread, boolean daemon) throws AdapterException {
209
    public void start(boolean separateThread, boolean daemon) throws AdapterBusy, AdapterException {
210
    	/* bugzilla 181090
211
    	 * Only run the adapter if it is not already running.
212
    	 */
213
    	synchronized(this) {
214
	    	if (status.isActive()) {
215
	    	    throw new AdapterBusy(Messages.getString("HyadesGAAdapter_Already_Running_ERROR_"));
216
	    	}
217
200
		/* bugzilla 86674
218
		/* bugzilla 86674
201
		 * Set the active status of the Adapter to true here so we include the configuration time
219
		 * Set the active status of the Adapter to true here so we include the configuration time
202
		 */
220
		 */
203
    	status.setActive(true);
221
	    	status.setActive(true);
204
    	
222
    	}
205
    	/* If the controller object already exists and the adapter configuration file has not changed Then
223
    	/* If the controller object already exists and the adapter configuration file has not changed Then
206
    	 * use the current configuration.
224
    	 * use the current configuration.
207
    	 */
225
    	 */
Lines 246-252 Link Here
246
        	/* Run the controller and therefore the adapter in the current thread. */
264
        	/* Run the controller and therefore the adapter in the current thread. */
247
            rootController.run();
265
            rootController.run();
248
            // All contexts have stopped so set the active status to false
266
            // All contexts have stopped so set the active status to false
249
            status.setActive(false);
267
            synchronized(this) {
268
            	status.setActive(false);
269
            }
250
        }
270
        }
251
        else {
271
        else {
252
        	/* Run the controller and therefore the adapter in a separate thread */ 
272
        	/* Run the controller and therefore the adapter in a separate thread */ 
Lines 265-271 Link Here
265
        if (rootController != null) {
285
        if (rootController != null) {
266
            rootController.stop();
286
            rootController.stop();
267
        }
287
        }
268
        status.setActive(false);
288
        synchronized(this) {
289
        	status.setActive(false);
290
        }
269
    }
291
    }
270
    
292
    
271
	/**
293
	/**
Lines 276-282 Link Here
276
		if (rootController != null) {
298
		if (rootController != null) {
277
			rootController.hardStop();
299
			rootController.hardStop();
278
		}
300
		}
279
		status.setActive(false);
301
		synchronized(this) {
302
			status.setActive(false);
303
		}
280
	}
304
	}
281
	
305
	
282
	/**
306
	/**
Lines 358-369 Link Here
358
     * @return the org.eclipse.hyades.logging.adapter.IStatus object representing the status.
382
     * @return the org.eclipse.hyades.logging.adapter.IStatus object representing the status.
359
     */
383
     */
360
    public IStatus getStatus() {
384
    public IStatus getStatus() {
361
    	// This method may be called before start() is called so check for null rootController
385
    	synchronized(this) {
362
    	if (rootController != null) {
386
	    	// This method may be called before start() is called so check for null rootController
363
    		status.setChildrenStatus(rootController.getStatus());
387
	    	if (rootController != null) {
364
    	}
388
	    		status.setChildrenStatus(rootController.getStatus());
365
    	else {
389
	    	}
366
    		status.setActive(false);
390
	    	else {
391
	    		status.setActive(false);
392
	    	}
367
    	}
393
    	}
368
    	return status;
394
    	return status;
369
    }
395
    }
Lines 376-382 Link Here
376
     * @param outputter component where GLA will log its messages.
402
     * @param outputter component where GLA will log its messages.
377
     */
403
     */
378
    public void setLogOutputter(IOutputter outputter) {
404
    public void setLogOutputter(IOutputter outputter) {
379
    	logOutputter = outputter;
405
    	/* bugzilla 181090
406
    	 * Only set the log outputter if the adapter is not already running.
407
    	 */
408
    	synchronized(this) {
409
	    	if (!status.isActive()) {
410
	    		logOutputter = outputter;
411
	    	}
412
    	}
380
    }
413
    }
381
    
414
    
382
    /**
415
    /**
(-)src/org/eclipse/hyades/logging/adapter/AdapterBusy.java (+55 lines)
Added Link Here
1
package org.eclipse.hyades.logging.adapter;
2
/**********************************************************************
3
 * Copyright (c) 2008 IBM Corporation and others.
4
 * All rights reserved.   This program and the accompanying materials
5
 * are made available under the terms of the Eclipse Public License v1.0
6
 * which accompanies this distribution, and is available at
7
 * http://www.eclipse.org/legal/epl-v10.html
8
 * $Id: AdapterBusy.java,v 1.6 2008/01/24 02:25:53 rshetty Exp $
9
 * 
10
 * Contributors: 
11
 * IBM - Initial API and implementation
12
 **********************************************************************/
13
14
public class AdapterBusy extends AdapterException
15
{
16
    /**
17
     * serial version UID
18
     */
19
    private static final long serialVersionUID = 1L;
20
    
21
    /**
22
     * Constructor for AdapterBusy.
23
     */
24
    public AdapterBusy()
25
    {
26
        super();
27
    }
28
    /**
29
     * Create an AdapterBusy with the specified message.
30
     * @param message
31
     */
32
    public AdapterBusy(String message)
33
    {
34
        super(message);
35
    }
36
    
37
    /**
38
     * Create an AdapterBusy with the specified message and cause exception.
39
     * @param message
40
     * @param cause
41
     */
42
    public AdapterBusy(String message, Throwable cause)
43
    {
44
        super(message,cause);
45
    }
46
    /**
47
     * Create an AdapterBusy with the specified cause exception.
48
     * @param cause
49
     */
50
    public AdapterBusy(Throwable cause)
51
    {
52
        super(cause);
53
    }
54
55
}

Return to bug 181090