com.sybase.jdbcx
Interface DynamicClassLoader


public abstract interface DynamicClassLoader


Method Summary
 void closeConnection()
          Gets the loader connection to relinquish its db connection.
 Class findClass(String className)
          Finds the specified class.
 boolean getKeepConnectionAlive()
           
 boolean hasClassBeenLoaded(String className)
          Return whether a class with the given name has been loaded by this class loader.
 void openConnection()
          Gets the loader connection to establish a connection to the db.
 void preloadJars(String[] jarNames)
          Loads all the jars specified in the given array of names.
 void setKeepConnectionAlive(boolean flag)
          Set the 'keep alive' flag on the connection, so that it stays open even after a class is loaded.
 

Method Detail

findClass

public Class findClass(String className)
Finds the specified class. This method will be called by the inherited loadClass method after checking the parent class loader for the requested class.
Parameters:
className - the fully-qualified name of the class to load
Returns:
the loaded class

preloadJars

public void preloadJars(String[] jarNames)
                 throws SQLException
Loads all the jars specified in the given array of names. Note that "jar" means the "retained jar name" - the name under which the classes are stored. It has nothing to do with a jar file.

This method is used when the PRELOAD_JARS property is specified, but you can use it directly to load one or more jars at a more convenient time.

Throws:
SQLException - if something goes wrong talking to the db

openConnection

public void openConnection()
                    throws SQLException
Gets the loader connection to establish a connection to the db. This method can be used to exercise manual control over when the db connection is opened and closed. It's not necessary to call this method under normal circumstances, as the loader connection will open itself automatically when needed.
Throws:
SQLException - if something goes wrong opening the connection

closeConnection

public void closeConnection()
                     throws SQLException
Gets the loader connection to relinquish its db connection. This method can be used to exercise manual control over when the db connection is opened and closed. It is not necessary to call this method if the connection's 'keep alive' flag is "false", as the flag causes the loader to close the db connection automatically when it's done with it. If the flag value is "true", it's wise to call this method when you know you're done with class loading. However, even if you close it prematurely, it will be reopened automatically as needed.
Throws:
SQLException - if something goes wrong opening the connection

setKeepConnectionAlive

public void setKeepConnectionAlive(boolean flag)
Set the 'keep alive' flag on the connection, so that it stays open even after a class is loaded.
Parameters:
flag - true if you want to keep the connection alive

getKeepConnectionAlive

public boolean getKeepConnectionAlive()
Returns:
the current value of the connection's 'keep alive' flag.

hasClassBeenLoaded

public boolean hasClassBeenLoaded(String className)
Return whether a class with the given name has been loaded by this class loader.
Returns:
true if the class has been loaded, otherwise false.