ozone core API

org.ozoneDB.core
Class Env

java.lang.Object
  |
  +--org.ozoneDB.core.Env

public final class Env
extends java.lang.Object

Env is the environment of a ozone database server. Currently there is only one environment allowed per JVM. A server environment can be initialized by the a Server or by a LocalDatabase.

Version:
$Revision: 1.5 $Date: 2002/06/25 11:34:38 $
Author:
SMB
, Medium.net

Field Summary
static int ACCEPT_THREAD_PRIORITY
          AdminPort and InvokeServer accepts and admin requests
 AdminManager adminManager
           
 ClassManager classManager
           
private  DxBag components
           
 org.ozoneDB.Setup config
          Holds the content of the 'config.properties' config file.
static java.lang.String CONFIG_FILE
           
static java.lang.String DATA_DIR
           
 org.ozoneDB.Database database
          Interface for the database objects inside the server.
static int DEADLOCK_THREAD_PRIORITY
          Thread priority deadlock recognition.
protected  DeadlockThread deadlockThread
           
 java.lang.String dir
           
protected  DeadlockRecognition dr
           
protected  GarbageCollector garbageCollector
           
protected  InvokeServer invokeServer
           
protected  long keepMemory
           
 KeyGenerator keyGenerator
           
protected  LocalClientTracker localClientTracker
           
static java.lang.String LOG_FILE
           
 LogWriter logWriter
           
static java.lang.String OS_DIR
           
protected static OzoneSecurityManager securityManager
           
static boolean selfCheck
          Wether ozone should do selfChecks at different code locations.
static int SERVER_THREAD_PRIORITY
          Priority of the server thread (Server.main())
 boolean shuttingdown
          This indicates that we are about to shutdown.
 org.ozoneDB.Setup state
          Holds the content of the 'state.properties' file.
static java.lang.String STATE_FILE
           
static java.lang.String STATS_DIR
           
 StoreManager storeManager
           
static Env theEnv
          The one and only ozone environment of this VM.
protected  long totalMemory
           
static int TRANSACTION_MUTEX_PRIORITY
           
static int TRANSACTION_THREAD_PRIORITY
          Thread priority of normal transaction.
 TransactionManager transactionManager
           
 UserManager userManager
           
static java.lang.String VERSION
           
 
Constructor Summary
Env(java.lang.String _dirName, java.lang.String _debugLevel)
          Construct a new ozone server environment.
 
Method Summary
 int adminPortNum()
           
protected  void calcMemory()
          Initialize the internal memory counter so that freeMemory() returns correct results.
static Env currentEnv()
          Returns the environment of the current thread.
 int dbID()
           
 DeadlockRecognition deadlockRecognition()
          Factory method to create or re-use a DR object.
 void fatalError(java.lang.Object sender, java.lang.String msg, java.lang.Exception e)
          Fires an error message and exits the VM
 long freeMemory()
          Return the amount of *total* free memory in the system.
 GarbageCollector getGarbageCollector()
           
 InvokeServer getInvokeServer()
           
 LocalClientTracker getLocalClientTracker()
           
 LogWriter getLogWriter()
           
 org.ozoneDB.Setup getState()
           
 StoreManager getStoreManager()
           
 TransactionManager getTransactionManager()
           
 UserManager getUserManager()
           
protected  void initLogs(java.lang.String debugLevelName)
          Initialize server logging.
protected  void initSetup()
          Initialize the setup (state and config) of this server environment.
 boolean isComponentStateChanged()
           
 int portNum()
           
 void shutdown()
           
 void startDeadlockRecognition()
           
 void startExternalEventProcessing()
           
protected  void storeSetup()
          Save the setup (state and config) of the current server environment.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

selfCheck

public static final boolean selfCheck
Wether ozone should do selfChecks at different code locations. If set to true, diagnostic messages are printed out in case something unusual or bad has been detected. If set to false, ozone will run at full speed. This is a kind of "poor man"s assertion facility as long as ozone should be compileable by javac older than from JDK1.4

See Also:
Constant Field Values

VERSION

public static final java.lang.String VERSION
See Also:
Constant Field Values

OS_DIR

public static final java.lang.String OS_DIR
See Also:
Constant Field Values

STATE_FILE

public static final java.lang.String STATE_FILE
See Also:
Constant Field Values

CONFIG_FILE

public static final java.lang.String CONFIG_FILE
See Also:
Constant Field Values

LOG_FILE

public static final java.lang.String LOG_FILE
See Also:
Constant Field Values

DATA_DIR

public static final java.lang.String DATA_DIR

STATS_DIR

public static final java.lang.String STATS_DIR
See Also:
Constant Field Values

ACCEPT_THREAD_PRIORITY

public static final int ACCEPT_THREAD_PRIORITY
AdminPort and InvokeServer accepts and admin requests

See Also:
Constant Field Values

TRANSACTION_THREAD_PRIORITY

public static final int TRANSACTION_THREAD_PRIORITY
Thread priority of normal transaction.

See Also:
Constant Field Values

TRANSACTION_MUTEX_PRIORITY

public static final int TRANSACTION_MUTEX_PRIORITY
See Also:
Constant Field Values

DEADLOCK_THREAD_PRIORITY

public static final int DEADLOCK_THREAD_PRIORITY
Thread priority deadlock recognition.

See Also:
Constant Field Values

SERVER_THREAD_PRIORITY

public static final int SERVER_THREAD_PRIORITY
Priority of the server thread (Server.main())

See Also:
Constant Field Values

theEnv

public static Env theEnv
The one and only ozone environment of this VM.


securityManager

protected static OzoneSecurityManager securityManager

dir

public java.lang.String dir

state

public org.ozoneDB.Setup state
Holds the content of the 'state.properties' file. After changing the content the state must be written to disk to make changes persistent.


config

public org.ozoneDB.Setup config
Holds the content of the 'config.properties' config file.


logWriter

public LogWriter logWriter

shuttingdown

public boolean shuttingdown
This indicates that we are about to shutdown.


totalMemory

protected long totalMemory

keepMemory

protected long keepMemory

database

public org.ozoneDB.Database database
Interface for the database objects inside the server.


components

private DxBag components

keyGenerator

public KeyGenerator keyGenerator

adminManager

public AdminManager adminManager

classManager

public ClassManager classManager

transactionManager

public TransactionManager transactionManager

storeManager

public StoreManager storeManager

userManager

public UserManager userManager

localClientTracker

protected LocalClientTracker localClientTracker

garbageCollector

protected GarbageCollector garbageCollector

invokeServer

protected InvokeServer invokeServer

deadlockThread

protected DeadlockThread deadlockThread

dr

protected DeadlockRecognition dr
Constructor Detail

Env

public Env(java.lang.String _dirName,
           java.lang.String _debugLevel)
    throws java.lang.Exception
Construct a new ozone server environment.

Parameters:
_dirName - Directory of the database.
_debugLevel - the debug level that should be used, oveerriding the entry in config.properties. If null then the config.properties entry will be used.
Method Detail

currentEnv

public static Env currentEnv()
Returns the environment of the current thread. Useful for objects that do not store the enviroment itself like ObjectContainer.

Returns:
The environment of the current thread or null if called outside the server.

shutdown

public void shutdown()

startExternalEventProcessing

public void startExternalEventProcessing()
                                  throws java.lang.Exception
java.lang.Exception

startDeadlockRecognition

public void startDeadlockRecognition()

initSetup

protected void initSetup()
                  throws java.lang.Exception
Initialize the setup (state and config) of this server environment. When searching specific property look in setup file first, then in the properties file, then use defaults, then use System properties.

java.lang.Exception

isComponentStateChanged

public boolean isComponentStateChanged()

storeSetup

protected void storeSetup()
Save the setup (state and config) of the current server environment.


initLogs

protected void initLogs(java.lang.String debugLevelName)
                 throws java.lang.Exception
Initialize server logging. There are two LogTargets: stdout and file. Which log messages are written to which target is specified in the config file. If the server runs in debug mode, debug messages are written to each target. If debugLevelName is set to null the setting from the config.properties file is used

java.lang.Exception

fatalError

public void fatalError(java.lang.Object sender,
                       java.lang.String msg,
                       java.lang.Exception e)
Fires an error message and exits the VM


dbID

public int dbID()

portNum

public int portNum()

adminPortNum

public int adminPortNum()

deadlockRecognition

public DeadlockRecognition deadlockRecognition()
Factory method to create or re-use a DR object.


calcMemory

protected void calcMemory()
Initialize the internal memory counter so that freeMemory() returns correct results.


freeMemory

public long freeMemory()
Return the amount of *total* free memory in the system. The results returned by Runtime.freeMemory() may change overtime and so its useless for ozone.


getLogWriter

public LogWriter getLogWriter()

getTransactionManager

public TransactionManager getTransactionManager()

getState

public org.ozoneDB.Setup getState()

getInvokeServer

public InvokeServer getInvokeServer()

getStoreManager

public StoreManager getStoreManager()

getUserManager

public UserManager getUserManager()

getGarbageCollector

public GarbageCollector getGarbageCollector()

getLocalClientTracker

public LocalClientTracker getLocalClientTracker()

ozone core API

Copyright (C) The Ozone Database Project - www.ozone-db.org. All rights reserved.