classmanager.java
来自「Java的面向对象数据库系统的源代码」· Java 代码 · 共 81 行
JAVA
81 行
// You can redistribute this software and/or modify it under the terms of
// the Ozone Core License version 1 published by ozone-db.org.
//
// The original code and portions created by SMB are
// Copyright (C) 1997-@year@ by SMB GmbH. All rights reserved.
//
// $Id: ClassManager.java,v 1.8 2002/12/29 11:15:56 per_nyfelt Exp $
package org.ozoneDB.core;
import org.ozoneDB.OzoneClassNotFoundException;
import org.ozoneDB.util.LogWriter;
/**
* @author <a href="http://www.softwarebuero.de/">SMB</a>
* @version $Revision: 1.8 $Date: 2002/12/29 11:15:56 $
*/
public final class ClassManager extends ServerComponent {
protected ClassLoader classLoader;
public ClassManager( Env _env ) {
super( _env );
}
public void startup() throws Exception {
env.logWriter.newEntry( this, "startup...", LogWriter.INFO );
dropClasses();
}
public void shutdown() throws Exception {
env.logWriter.newEntry( this, "shutdown...", LogWriter.INFO );
}
public void save() throws Exception {
}
public Class classForName( String name ) throws OzoneClassNotFoundException {
if (env.logWriter.hasTarget( LogWriter.DEBUG3 )) {
env.logWriter.newEntry( this, "classForName(): " + name, LogWriter.DEBUG3 );
}
try {
// TODO: remove this if the classLoader works
// as long as the OzoneClassLoader does not work as expected and does
// not allow to drop classes we can directly use the context loader
// of the thread to avoid problems in managed environments like
// servlets
//Class cl;
// If we do not use OzoneClassLoader, we have to care for primitive types ourselves
//cl = OzoneClassLoader.primitiveType(name);
//if (cl==null) {
// cl = Thread.currentThread().getContextClassLoader().loadClass( name );
//}
Class cl = classLoader.loadClass( name );
if (env.logWriter.hasTarget( LogWriter.DEBUG3 )) {
env.logWriter.newEntry( this, " class: " + cl.getName() + ", " + cl.hashCode(), LogWriter.DEBUG3 );
}
return cl;
}
catch (ClassNotFoundException e) {
throw new OzoneClassNotFoundException( e.getMessage() );
}
}
public void dropClasses() throws Exception {
env.logWriter.newEntry( this, "dropClasses()", LogWriter.DEBUG3 );
classLoader = new OzoneClassLoader();
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?