KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sleepycat > je > log > FileManagerTestUtils


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

8
9 package com.sleepycat.je.log;
10
11 import java.io.IOException JavaDoc;
12
13 import com.sleepycat.je.DatabaseException;
14 import com.sleepycat.je.dbi.EnvironmentImpl;
15
16 public class FileManagerTestUtils {
17     public static void createLogFile(FileManager fileManager,
18                                      EnvironmentImpl envImpl,
19                                      long logFileSize)
20         throws DatabaseException, IOException JavaDoc {
21
22         LogBuffer logBuffer = new LogBuffer(50, envImpl);
23         logBuffer.getDataBuffer().flip();
24         fileManager.bumpLsn(logFileSize - FileManager.firstLogEntryOffset());
25         logBuffer.registerLsn(fileManager.getLastUsedLsn());
26         fileManager.writeLogBuffer(logBuffer);
27         fileManager.syncLogEndAndFinishFile();
28     }
29 }
30
31
Popular Tags