File D:\maven-qcr-plugin-testsunitaires\qcr4java\h2-1.3.170-sources\target\site\qc\lecode\store\SessionState.java.html

1 /*
2 * Copyright 2004-2011 H2 Group. Multiple-Licensed under the H2 License,
3 * Version 1.0, and under the Eclipse Public License, Version 1.0
4 * (http://h2database.com/html/license.html).
5 * Initial Developer: H2 Group
6 */
7 package org.h2.store;
8
9
10 /**
11 * The session state contains information about when was the last commit of a
12 * session. It is only used during recovery.
13 */
14 class SessionState {
15
16 /**
17 * The session id
18 */
19 public int sessionId;
20
21 /**
22 * The last log id where a commit for this session is found.
23 */
24 public int lastCommitLog;
25
26 /**
27 * The position where a commit for this session is found.
28 */
29 public int lastCommitPos;
30
31 /**
32 * The in-doubt transaction if there is one.
33 */
34 public InDoubtTransaction inDoubtTransaction;
35
36 /**
37 * Check if this session state is already committed at this point.
38 *
39 * @param logId the log id
40 * @param pos the position in the log
41 * @return true if it is committed
42 */
43 public boolean isCommitted(int logId, int pos) {
44 if (logId != lastCommitLog) {
45 return lastCommitLog > logId;
46 }
47 return lastCommitPos >= pos;
48 }
49
50 public String toString() {
51 return "sessionId:" + sessionId + " log:" + lastCommitLog + " pos:" + lastCommitPos + " inDoubt:" + inDoubtTransaction;
52 }
53 }
54