Browse Prior Art Database

Improving Java's Instanceof Operator: Downloading Classes On Demand

IP.com Disclosure Number: IPCOM000123252D
Original Publication Date: 1998-Aug-01
Included in the Prior Art Database: 2005-Apr-04
Document File: 6 page(s) / 218K

Publishing Venue

IBM

Related People

Nichols, PH: AUTHOR

Abstract

This disclosure describes an improvement to the Java* instanceof operator which eliminates the premature downloading of classes that are used as arguments to this operator. The result is a performance improvement. The initial download delay of an applet is decreased since classes are not downloaded until they are actually needed.

This text was extracted from an ASCII text file.
This is the abbreviated version, containing approximately 26% of the total text.

Improving Java's Instanceof Operator: Downloading Classes On Demand

   This disclosure describes an improvement to the Java*
instanceof operator which eliminates the premature downloading of
classes that are used as arguments to this operator.  The result is a
performance improvement.  The initial download delay of an applet is
decreased since classes are not downloaded until they are actually
needed.

   The following two sub-sections contain background
information pertinent to understanding both the problem and the
improvement described in this disclosure.  A familiarity with Java is
assumed.

   A common deployment model for Java programs involves a
client downloading Java applets from a server.  The client downloads
one or more class files which contain information about each class
and the byte-codes which are executed in the client's Java Run-time
Environment (JRE).  The size and number of class files has a direct
impact on performance.  Downloading more data from the server means
an increased delay when launching a Java applet.  One technique for
improving this delay is to design a Java applet so that individual
functions are downloaded on demand.

   A large portion of a "download on demand" design will be
accomplished as a side effect of following good object-oriented
programming techniques.  For example, an applet that implements
functions X, Y and Z might define several classes.  Some classes
will only be used for function X, some only for function Y and some
only for function Z. Still other classes will be used for all three
functions.  When the applet is downloaded by the JRE's class loader
only the classes that are immediately needed will be downloaded.  A
class will not be downloaded until the execution of the applet
reaches an instruction which requires that class to be downloaded (a
"load point").  For example, if function X is invoked by clicking on
a button in the GUI then the classes required for function X will be
downloaded when the button is clicked.

   The goal of a "download on demand" design is to delay the
downloading of all function-unique classes until the function is
invoked for the first time.  To achieve this goal the following
steps must be taken:
  o  Identify the functions that will be downloaded on demand.
  o  Determine which classes are unique to each of these functions.
  o  Determine the load points for each of these classes.
  o  Eliminate all of the undesirable load points.

   An undesirable load point causes a class to be downloaded
before the associated function is invoked.  There are numerous
coding constructs that can result in the creation of an undesirable
load point.  An exhaustive list is outside the scope of this
disclosure.  The one undesirable load point that will be addressed
involves the use of the instanceof operator.

   The Java instanceof operator provides a mechanism for
answering the questions:
  o  Is object o an instance of class C?
  o  Does o...