KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > core > internal > jobs > Deadlock


1 /*******************************************************************************
2  * Copyright (c) 2003, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM - Initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.core.internal.jobs;
12
13 import org.eclipse.core.runtime.jobs.ISchedulingRule;
14
15 /**
16  * The deadlock class stores information about a deadlock that just occurred.
17  * It contains an array of the threads that were involved in the deadlock
18  * as well as the thread that was chosen to be suspended and an array of locks
19  * held by that thread that are going to be suspended to resolve the deadlock.
20  */

21 class Deadlock {
22     //all the threads which are involved in the deadlock
23
private Thread JavaDoc[] threads;
24     //the thread whose locks will be suspended to resolve deadlock
25
private Thread JavaDoc candidate;
26     //the locks that will be suspended
27
private ISchedulingRule[] locks;
28
29     public Deadlock(Thread JavaDoc[] threads, ISchedulingRule[] locks, Thread JavaDoc candidate) {
30         this.threads = threads;
31         this.locks = locks;
32         this.candidate = candidate;
33     }
34
35     public ISchedulingRule[] getLocks() {
36         return locks;
37     }
38
39     public Thread JavaDoc getCandidate() {
40         return candidate;
41     }
42
43     public Thread JavaDoc[] getThreads() {
44         return threads;
45     }
46 }
47
Popular Tags