Class MailHandler.GetAndSetContext

  • All Implemented Interfaces:
    java.security.PrivilegedAction<java.lang.Object>
    Enclosing class:
    MailHandler

    private static final class MailHandler.GetAndSetContext
    extends java.lang.Object
    implements java.security.PrivilegedAction<java.lang.Object>
    Performs a get and set of the context class loader with privileges enabled.
    Since:
    JavaMail 1.4.6
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.Object NOT_MODIFIED
      A marker object used to signal that the class loader was not modified.
      private java.lang.Object source
      The source containing the class loader.
    • Constructor Summary

      Constructors 
      Constructor Description
      GetAndSetContext​(java.lang.Object source)
      Create the action.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Object run()
      Gets the class loader from the source and sets the CCL only if the source and CCL are not the same.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • NOT_MODIFIED

        public static final java.lang.Object NOT_MODIFIED
        A marker object used to signal that the class loader was not modified.
      • source

        private final java.lang.Object source
        The source containing the class loader.
    • Constructor Detail

      • GetAndSetContext

        GetAndSetContext​(java.lang.Object source)
        Create the action.
        Parameters:
        source - null for boot class loader, a class loader, a class used to get the class loader, or a source object to get the class loader. Default access to avoid generating extra class files.
    • Method Detail

      • run

        public final java.lang.Object run()
        Gets the class loader from the source and sets the CCL only if the source and CCL are not the same.
        Specified by:
        run in interface java.security.PrivilegedAction<java.lang.Object>
        Returns:
        the replaced context class loader which can be null or NOT_MODIFIED to indicate that nothing was modified.