KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sleepycat > je > recovery > stepwise > NonTxnalDeletedEntry


1 /*-
2  * See the file LICENSE for redistribution information.
3  *
4  * Copyright (c) 2002,2006 Oracle. All rights reserved.
5  *
6  * $Id: NonTxnalDeletedEntry.java,v 1.4 2006/10/30 21:14:49 bostic Exp $
7  */

8
9 package com.sleepycat.je.recovery.stepwise;
10
11 import java.util.Iterator JavaDoc;
12 import java.util.Map JavaDoc;
13 import java.util.Set JavaDoc;
14
15 import com.sleepycat.bind.tuple.IntegerBinding;
16
17 /*
18  * A non-transactional log entry should add itself to the expected set.
19  */

20
21 class NonTxnalDeletedEntry extends LogEntryInfo {
22     NonTxnalDeletedEntry(long lsn,
23                   int key,
24                   int data) {
25         super(lsn, key, data);
26     }
27
28     /* Delete this item from the expected set. */
29     public void updateExpectedSet(Set JavaDoc useExpected, Map JavaDoc newUncommittedRecords, Map JavaDoc deletedUncommittedRecords) {
30         Iterator JavaDoc iter = useExpected.iterator();
31         while (iter.hasNext()) {
32             TestData setItem = (TestData) iter.next();
33             int keyValInSet = IntegerBinding.entryToInt(setItem.getKey());
34             if (keyValInSet == key) {
35                 if (data == -1) {
36                     /* non-dup case, remove the matching key. */
37                     iter.remove();
38                     break;
39                 } else {
40                     int dataValInSet = IntegerBinding.entryToInt(setItem.getData());
41                     if (dataValInSet == data) {
42                         iter.remove();
43                         break;
44                     }
45                 }
46             }
47         }
48     }
49 }
50
Popular Tags