com.ibm.oti.shared

Class SharedClassURLHelperImpl

  1. java.lang.Object
  2. extended bycom.ibm.oti.shared.SharedAbstractHelper
  3. extended bycom.ibm.oti.shared.SharedClassAbstractHelper
  4. extended bycom.ibm.oti.shared.SharedClassURLHelperImpl
All implemented interfaces:
SharedClassHelper, SharedClassURLHelper, SharedHelper

  1. public class SharedClassURLHelperImpl
  2. extends SharedClassAbstractHelper
  3. implements SharedClassURLHelper
Implementation of SharedClassURLHelper.

Version:
initial
Author:
OTI
See Also:
SharedClassURLHelper, SharedClassHelperFactory, SharedClassAbstractHelper

Field Summary

Modifier and Type Field and Description
  1. static
  2. boolean
MINIMIZE_ENABLED

Method Summary

Modifier and Type Method and Description
  1. byte[]
findSharedClass(java.lang.String partition,java.net.URL path,java.lang.String className)
  1. byte[]
findSharedClass(java.net.URL path,java.lang.String className)
  1. boolean
setMinimizeUpdateChecks()
  1. boolean
storeSharedClass(java.lang.String partition,java.net.URL path,java.lang.Class clazz)
  1. boolean
storeSharedClass(java.net.URL path,java.lang.Class clazz)
Methods inherited from class com.ibm.oti.shared.SharedClassAbstractHelper
getSharingFilter, isSharedClassCookie, setSharingFilter
Methods inherited from class com.ibm.oti.shared.SharedAbstractHelper
getClassLoader
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.ibm.oti.shared.SharedClassHelper
getSharingFilter, setSharingFilter
Methods inherited from interface com.ibm.oti.shared.SharedHelper
getClassLoader

Field Detail

MINIMIZE_ENABLED

  1. public static final boolean MINIMIZE_ENABLED
See Also:

Method Detail

setMinimizeUpdateChecks

  1. public boolean setMinimizeUpdateChecks( )

Description copied from interface: SharedClassURLHelper

Minimize update checking on jar files for optimal performance

By default, when a class is loaded from the shared class cache, the timestamp of the container it was originally loaded from is compared with the timestamp of the actual container on the filesystem. If the two do not match, the original class is marked stale and is not returned by findSharedClass(). These checks are not performed if the container is held open by the ClassLoader.

If the ClassLoader does not want to open the container, but doesn't want the timestamp to be constantly checked when classes are loaded, it should call this function immediately after the SharedClassURLHelper object has been created. Once this function has been called, each container timestamp is checked once and then is not checked again for the lifetime of the SharedClassURLHelper.

This feature cannot be unset.

Specified by:
Returns:
boolean True if the feature has been successfully set, false otherwise.

findSharedClass

  1. public byte[] findSharedClass(java.net.URL path,
  2. java.lang.String className)

Description copied from interface: SharedClassURLHelper

Find a class in the shared cache using a specific URL and class name. A class will be returned if it was stored against the same URL.

Null is returned if the class cannot be found or if it is stale (see Dynamic Cache Updates).

To obtain an instance of the class, the byte[] returned must be passed to defineClass by the caller ClassLoader.

Also returns false if the URL at foundAtIndex is not a file URL or if the resource it refers to does not exist.

Specified by:
Parameters:
path - URL A URL path. Cannot be null.
className - String The name of the class to be found
Returns:
byte[] A byte array describing the class found, or null.

findSharedClass

  1. public byte[] findSharedClass(java.lang.String partition,
  2. java.net.URL path,
  3. java.lang.String className)

Description copied from interface: SharedClassURLHelper

Find a class in the shared cache using a specific URL, class name and user-defined partition (see Partitions).

A class will only be returned if it was stored against the same URL and using the same partition. Null is returned if the class cannot be found or if it is stale (see Dynamic Cache Updates).

To obtain an instance of the class, the byte[] returned must be passed to defineClass by the caller ClassLoader.

Also returns false if the URL at foundAtIndex is not a file URL or if the resource it refers to does not exist.

Specified by:
Parameters:
partition - String. User-defined partition if finding modified bytecode (see Partitions). Passing null is equivalent of calling non-partition findSharedClass call.
path - URL. A URL path. Cannot be null.
className - String. The name of the class to be found
Returns:
byte[]. A byte array describing the found class, or null.

storeSharedClass

  1. public boolean storeSharedClass( java.net.URL path,
  2. java.lang.Class clazz)

Description copied from interface: SharedClassURLHelper

Store a class in the shared cache using the URL location it was loaded from. The class being stored must have been defined by the caller ClassLoader and must exist in the URL location specified. Returns true if the class is stored successfully or false otherwise.

Will return false if the class being stored was not defined by the caller ClassLoader.

Also returns false if the URL at foundAtIndex is not a file URL or if the resource it refers to does not exist.

Specified by:
Parameters:
path - URL. The URL path that the class was loaded from. Cannot be null.
clazz - Class. The class to store in the shared cache
Returns:
boolean. True if the class was stored successfully, false otherwise.

storeSharedClass

  1. public boolean storeSharedClass( java.lang.String partition,
  2. java.net.URL path,
  3. java.lang.Class clazz)

Description copied from interface: SharedClassURLHelper

Store a class in the shared cache using the URL location it was loaded from and a user-defined partition (see Partitions).

The class being stored must have been defined by the caller ClassLoader and must exist in the URL location specified. Returns true if the class is stored successfully or false otherwise.

Will return false if the class being stored was not defined by the caller ClassLoader.

Also returns false if the URL at foundAtIndex is not a file URL or if the resource it refers to does not exist.

Specified by:
Parameters:
partition - String. User-defined partition if storing modified bytecode (see Partitions). Passing null is equivalent of calling non-partition storeSharedClass call.
path - URL. The URL path that the class was loaded from. Cannot be null.
clazz - Class. The class to store in the shared cache
Returns:
boolean. True if the class was stored successfully, false otherwise.