4 * Copyright 2006 Sun Microsystems, Inc., 4150 Network Circle, Santa
5 * Clara, California 95054, U.S.A. All rights reserved.
7 * Sun Microsystems, Inc. has intellectual property rights relating to
8 * technology embodied in the product that is described in this
9 * document. In particular, and without limitation, these
10 * intellectual property rights may include one or more of the
11 * U.S. patents listed at http://www.sun.com/patents and one or more
12 * additional patents or pending patent applications in the U.S. and
15 * U.S. Government Rights - Commercial software.
16 * Government users are subject to the Sun Microsystems, Inc. standard
17 * license agreement and applicable provisions of the FAR and its
18 * supplements. Use is subject to license terms. Sun, Sun
19 * Microsystems, the Sun logo and Java are trademarks or registered
20 * trademarks of Sun Microsystems, Inc. in the U.S. and other
23 * This product is covered and controlled by U.S. Export Control laws
24 * and may be subject to the export or import laws in other countries.
25 * Nuclear, missile, chemical biological weapons or nuclear maritime
26 * end uses or end users, whether direct or indirect, are strictly
27 * prohibited. Export or reexport to countries subject to
28 * U.S. embargo or to entities identified on U.S. export exclusion
29 * lists, including, but not limited to, the denied persons and
30 * specially designated nationals lists is strictly prohibited.
33 package dstm2.manager;
35 import dstm2.Transaction;
38 * Tries to keep a maximal independent set running.
39 * If prior transaction is
40 * waiting or lower priority, then abort it.
41 * otherwise, wait for it to commit, abort, or wait
42 * Complete description in
43 * Rachid Guerraoui, Maurice Herlihy, and Sebastian Pochon, Toward a Theory of Transactional Contention Management,
44 * Proceedings of the Twenty-Fourth Annual Symposium on Principles of Distributed Computing (PODC).
45 * Las Vegas, NV July 2005.
46 * @author Maurice Herlihy
48 public class GreedyManager extends BaseManager {
49 public void resolveConflict(Transaction me, Transaction other) {
50 if (other.waiting || other.startTime < me.startTime) {
53 me.waiting = true; // I'm waiting
54 other.waitWhileActiveNotWaiting();
55 me.waiting = false; // I'm no longer waiting
59 * Reset priority only on commit. On abort, restart with previous priority.
61 public void committed() {
65 public void openSucceeded() {
66 setPriority(getPriority() + 1);