KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sleepycat > je > cleaner > ReadOnlyProcess


1 /*-
2  * See the file LICENSE for redistribution information.
3  *
4  * Copyright (c) 2002,2006 Oracle. All rights reserved.
5  *
6  * $Id: ReadOnlyProcess.java,v 1.7 2006/11/22 23:54:49 mark Exp $
7  */

8
9 package com.sleepycat.je.cleaner;
10
11 import java.io.File JavaDoc;
12
13 import com.sleepycat.je.Environment;
14 import com.sleepycat.je.EnvironmentConfig;
15 import com.sleepycat.je.util.TestUtils;
16
17 /**
18  * @see ReadOnlyLockingTest
19  */

20 public class ReadOnlyProcess {
21
22     public static void main(String JavaDoc[] args) {
23
24         /*
25          * Don't write to System.out in this process because the parent
26          * process only reads System.err.
27          */

28         try {
29             EnvironmentConfig envConfig = TestUtils.initEnvConfig();
30             envConfig.setTransactional(true);
31             envConfig.setReadOnly(true);
32
33             File JavaDoc envHome = new File JavaDoc(System.getProperty(TestUtils.DEST_DIR));
34             Environment env = new Environment(envHome, envConfig);
35
36             //System.err.println("Opened read-only: " + envHome);
37
//System.err.println(System.getProperty("java.class.path"));
38

39             /* Notify the test that this process has opened the environment. */
40             ReadOnlyLockingTest.createProcessFile();
41
42             /* Sleep until the parent process kills me. */
43             Thread.sleep(Long.MAX_VALUE);
44         } catch (Exception JavaDoc e) {
45
46             e.printStackTrace(System.err);
47             System.exit(1);
48         }
49     }
50 }
51
Popular Tags