Extension SDK 10.1.2

oracle.ide.util
Class AddinPolicyUtils

java.lang.Object
  extended byoracle.ide.util.AddinPolicyUtils

public class AddinPolicyUtils
extends java.lang.Object

A utility class containing addin policies we want to enforce. This Class is removed in non debug builds.


Method Summary
static void applicationExiting()
           
static void checkCallStackForPolicyViolation(java.lang.String violationMethod, java.lang.String method)
          Check if we are called with a particular method on the stack.
static void creatingAbstractButtonLeakPolicyCheck(javax.swing.AbstractButton abstractButton)
          Make certain we're avoiding a known memory leak causes.
static void creatingImageIconPolicyCheck()
          Check if creating an ImageIcon is ok.
static void creatingJMenuItemLeakPolicyCheck(javax.swing.JMenuItem menuItem, int commandID)
           
static void creatingLocalActionLeakPolicyCheck(javax.swing.Action action)
          Make certain we're avoiding a known memory leak causes.
static void creatingThreadPolicyCheck()
          Check if creating a Thread is ok.
static void ensureGarbageCollectable(java.lang.Object obj)
          Calls ensureGarbageCollectable(Object,int) with seconds set to 10.
static void ensureGarbageCollectable(java.lang.Object obj, int seconds)
          Determines whether the given object is available for garbage collection within the given time bounds.
static void initializingAddins(boolean initializing)
           
static void runRunnable(java.lang.Runnable runnable)
          A utility method to run code that is to be used only if the AddinPolicyUtils is in "effect"
static boolean setWarnWhenCreatingImageIcons(boolean warn)
           
static boolean setWarnWhenCreatingThreads(boolean warn)
           
static boolean setWarnWhenLeakingJMenuItems(boolean warn)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

initializingAddins

public static void initializingAddins(boolean initializing)

creatingImageIconPolicyCheck

public static void creatingImageIconPolicyCheck()
Check if creating an ImageIcon is ok.


creatingThreadPolicyCheck

public static void creatingThreadPolicyCheck()
Check if creating a Thread is ok.


creatingAbstractButtonLeakPolicyCheck

public static void creatingAbstractButtonLeakPolicyCheck(javax.swing.AbstractButton abstractButton)
Make certain we're avoiding a known memory leak causes. Debatably not a policy check.


creatingLocalActionLeakPolicyCheck

public static void creatingLocalActionLeakPolicyCheck(javax.swing.Action action)
Make certain we're avoiding a known memory leak causes. Debatably not a policy check.


creatingJMenuItemLeakPolicyCheck

public static void creatingJMenuItemLeakPolicyCheck(javax.swing.JMenuItem menuItem,
                                                    int commandID)

setWarnWhenCreatingThreads

public static boolean setWarnWhenCreatingThreads(boolean warn)

setWarnWhenCreatingImageIcons

public static boolean setWarnWhenCreatingImageIcons(boolean warn)

setWarnWhenLeakingJMenuItems

public static boolean setWarnWhenLeakingJMenuItems(boolean warn)

runRunnable

public static void runRunnable(java.lang.Runnable runnable)
A utility method to run code that is to be used only if the AddinPolicyUtils is in "effect"


applicationExiting

public static void applicationExiting()

checkCallStackForPolicyViolation

public static void checkCallStackForPolicyViolation(java.lang.String violationMethod,
                                                    java.lang.String method)
Check if we are called with a particular method on the stack.


ensureGarbageCollectable

public static void ensureGarbageCollectable(java.lang.Object obj)
Calls ensureGarbageCollectable(Object,int) with seconds set to 10.

Parameters:
obj - Object to check

ensureGarbageCollectable

public static void ensureGarbageCollectable(java.lang.Object obj,
                                            int seconds)
Determines whether the given object is available for garbage collection within the given time bounds. This works by starting a thread that holds a weak reference to the object, and periodically checking if the reference is cleared (and calling System.gc(). If after seconds seconds the reference is still not cleared, an error message is printed to the console.

Parameters:
obj - The object to check
seconds - The number of seconds to wait around hoping for the object to be collected.

Extension SDK

 

Copyright © 1997, 2004, Oracle. All rights reserved.