com.joanju.cg.core
Class PProcedureCache

java.lang.Object
  extended by com.joanju.cg.core.PProcedureCache

public class PProcedureCache
extends java.lang.Object

Provides static services for working with persistent procedure targets of "call in" sites.

This maintains a cache of persistent procedures, their local/active internal procedure names, and the procedure names that can be found in their super procedures, and the addresses of all those.

Be careful not to leave this persistent across calls to methods that might update the database directly.

Currently (July 2006) the cache size is 128 persistent procedures.


Constructor Summary
PProcedureCache()
           
 
Method Summary
 int getAddrOrStub(int cuId, int procNameId)
          Get a procedure ID (or stub ID) for a cuid and procedure name ID.
 int lookupLocalProcAddress(int cuid, int procnameID)
          Lookup the address for an internal procedure name for a given CUID.
 java.util.HashSet<int[]> lookupLocalSuperAddresses(int cuid, int procnameID)
          Lookup the addresses for local super procedures of a CUID and procedure name ID.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PProcedureCache

public PProcedureCache()
Method Detail

getAddrOrStub

public int getAddrOrStub(int cuId,
                         int procNameId)
                  throws java.sql.SQLException,
                         java.io.IOException
Get a procedure ID (or stub ID) for a cuid and procedure name ID. Use this cache rather than dealing direct with updating the database, otherwise this cache could get out of sync.

Throws:
java.sql.SQLException
java.io.IOException

lookupLocalProcAddress

public int lookupLocalProcAddress(int cuid,
                                  int procnameID)
                           throws java.sql.SQLException,
                                  java.io.IOException
Lookup the address for an internal procedure name for a given CUID.

Returns:
Zero if the procedure is not defined within the CU.
Throws:
java.sql.SQLException
java.io.IOException

lookupLocalSuperAddresses

public java.util.HashSet<int[]> lookupLocalSuperAddresses(int cuid,
                                                          int procnameID)
                                                   throws java.sql.SQLException,
                                                          java.io.IOException
Lookup the addresses for local super procedures of a CUID and procedure name ID.

This should be called only if lookupLocalProcAddress returned zero.

This examines the local supers of the CU to see if any of those contain the procedure for the procedure name ID. This does not examine the session supers - that is the responsibility of the caller.

Returns:
Set of int[], where each int[] is {cuid,address}. May return an empty set, never returns null.
Throws:
java.sql.SQLException
java.io.IOException
See Also:
lookupLocalProcAddress(int, int)


Copyright © 2008 Joanju Software. All Rights Reserved.