EMMA Coverage Report (generated Sun Mar 01 22:06:14 CET 2015)
[all classes][org.h2.store]

COVERAGE SUMMARY FOR SOURCE FILE [PageStoreInDoubtTransaction.java]

nameclass, %method, %block, %line, %
PageStoreInDoubtTransaction.java100% (1/1)0%   (0/4)0%   (0/75)0%   (0/21)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class PageStoreInDoubtTransaction100% (1/1)0%   (0/4)0%   (0/75)0%   (0/21)
PageStoreInDoubtTransaction (PageStore, int, int, String): void 0%   (0/1)0%   (0/18)0%   (0/7)
getState (): String 0%   (0/1)0%   (0/20)0%   (0/5)
getTransactionName (): String 0%   (0/1)0%   (0/3)0%   (0/1)
setState (int): void 0%   (0/1)0%   (0/34)0%   (0/8)

1/*
2 * Copyright 2004-2014 H2 Group. Multiple-Licensed under the MPL 2.0,
3 * and the EPL 1.0 (http://h2database.com/html/license.html).
4 * Initial Developer: H2 Group
5 */
6package org.h2.store;
7 
8import org.h2.message.DbException;
9 
10/**
11 * Represents an in-doubt transaction (a transaction in the prepare phase).
12 */
13public class PageStoreInDoubtTransaction implements InDoubtTransaction {
14 
15    private final PageStore store;
16    private final int sessionId;
17    private final int pos;
18    private final String transactionName;
19    private int state;
20 
21    /**
22     * Create a new in-doubt transaction info object.
23     *
24     * @param store the page store
25     * @param sessionId the session id
26     * @param pos the position
27     * @param transaction the transaction name
28     */
29    public PageStoreInDoubtTransaction(PageStore store, int sessionId, int pos,
30            String transaction) {
31        this.store = store;
32        this.sessionId = sessionId;
33        this.pos = pos;
34        this.transactionName = transaction;
35        this.state = IN_DOUBT;
36    }
37 
38    @Override
39    public void setState(int state) {
40        switch(state) {
41        case COMMIT:
42            store.setInDoubtTransactionState(sessionId, pos, true);
43            break;
44        case ROLLBACK:
45            store.setInDoubtTransactionState(sessionId, pos, false);
46            break;
47        default:
48            DbException.throwInternalError("state="+state);
49        }
50        this.state = state;
51    }
52 
53    @Override
54    public String getState() {
55        switch(state) {
56        case IN_DOUBT:
57            return "IN_DOUBT";
58        case COMMIT:
59            return "COMMIT";
60        case ROLLBACK:
61            return "ROLLBACK";
62        default:
63            throw DbException.throwInternalError("state="+state);
64        }
65    }
66 
67    @Override
68    public String getTransactionName() {
69        return transactionName;
70    }
71 
72}

[all classes][org.h2.store]
EMMA 2.0.5312 (C) Vladimir Roubtsov