Module ibm.jzos

Class WorkloadManager


  • public class WorkloadManager
    extends java.lang.Object
    A class with methods to interface with the WorkloadManager (WLM).

    Note: In order to use the classes in this package the caller's address space must be permitted to the BPX.WLMSERVER Facility class if it is defined. If BPX.WLMSERVER is not defined, the calling process must be defined as a superuser (UID=0).

    Note: WLM currently only allows one WorkloadManager instance per Java Virtual Machine. It is the user's responsibility to manage the lifecycle of the WorkloadManager and to disconnect() in order to release native system resources.

    Uses JNI wrappers to the following C Library APIs:

    • ConnectWorkMgr
    • DisconnectServer

    For additional information, see:

    Since:
    2.3.2
    See Also:
    WorkUnit, ServerClassification
    • Constructor Detail

      • WorkloadManager

        public WorkloadManager​(java.lang.String subSystemType,
                               java.lang.String subSystemName)
        Connect to WLM as a work manager to perform Workload Manager work manager functions.
        Parameters:
        subSystemType - a string containing the generic subsystem type (CICS, IMS, WEB, etc.). This is the primary category under which WLM classification rules are grouped. The string can be up to 4 bytes in length.
        subSystemName - a string containing the subsystem name used for classifying work requests. The character string can be up to 8 bytes in length.
        Throws:
        ErrnoException
        java.lang.SecurityException - if a a SecurityManager is active and the user doesn't have access to JzosPermission("WorkloadManager")
    • Method Detail

      • disconnect

        public void disconnect()
                        throws ErrnoException
        Disconnect the server from WLM.

        Destroy and remove any ServerClassifications held in the manager's cache. This method has no effect if the WorkloadManager is already disconnected.

        Throws:
        ErrnoException
      • createServerClassification

        public ServerClassification createServerClassification()
                                                        throws ErrnoException
        Create (and store for later deletion) a ServerClassification.

        The returned instance can be used when creating a WorkUnit WorkUnit(ServerClassification, String). All ServerClassifications created via this method will be destroyed when disconnect() is called.

        Returns:
        the ServerClassification
        Throws:
        ErrnoException
        java.lang.IllegalStateException - if this WorkLoadManager is no longer connected.
      • destroyServerClassification

        public void destroyServerClassification​(ServerClassification sc)
                                         throws ErrnoException
        Destroy a ServerClassification that was previously created/associated to this WorkloadManager.

        This destroys and deallocates the native storage associated with a ServerClassification using the C-Library __server_classifyDestroy() function.

        Parameters:
        sc - the ServerClassification to remove and destroy
        Throws:
        java.lang.IllegalStateException - if the given ServerClassification is not found
        ErrnoException
      • getConnToken

        public int getConnToken()
        Returns:
        the connection token. Returns 0 if not connected.
        Throws:
        java.lang.IllegalStateException - if the WorkloadManager is not connected