Class WorkManager.RemoteWorkManager

  • All Implemented Interfaces:
    commonj.work.WorkManager
    Enclosing class:
    WorkManager

    protected class WorkManager.RemoteWorkManager
    extends Base
    implements commonj.work.WorkManager
    RemoteWorkManager is a delegating WorkManager wrapper.
    • Field Detail

      • m_memberPinned

        protected Member m_memberPinned
        The service Member this RemoteWorkManager is pinned to.
    • Constructor Detail

      • RemoteWorkManager

        public RemoteWorkManager​(Member memberPinned)
    • Method Detail

      • schedule

        public commonj.work.WorkItem schedule​(commonj.work.Work work)
                                       throws commonj.work.WorkException,
                                              IllegalArgumentException
        Dispatches a Work asynchronously. The work is dispatched and the method returns immediately.

        If a JVM that this pinned WorkManager represents has failed then a WorkRejectedException will be thrown even if the remote JVM restarts. The pinned WorkManager must be refreshed by using a normal WorkManager and then acquiring a new pinned WorkManager.

        Specified by:
        schedule in interface commonj.work.WorkManager
        Parameters:
        work - the Work to execute
        Returns:
        the WorkItem representing the asynchronous work; since the Work must be serializable, a RemoteWorkItem is always returned
        Throws:
        commonj.work.WorkException - thrown if queuing this up results in an exception
        IllegalArgumentException - thrown if work is a javax.ejb.EnterpriseBean.
      • schedule

        public commonj.work.WorkItem schedule​(commonj.work.Work work,
                                              commonj.work.WorkListener workListener)
                                       throws commonj.work.WorkException,
                                              IllegalArgumentException
        Dispatches a Work asynchronously. The work is dispatched and the method returns immediately.

        If a JVM that this pinned WorkManager represents has failed then a WorkRejectedException will be thrown even if the remote JVM restarts. The pinned WorkManager must be refreshed by using a normal WorkManager and then acquiring a new pinned WorkManager.

        Specified by:
        schedule in interface commonj.work.WorkManager
        Parameters:
        work - the Work to execute
        workListener - can be null or a WorkListener which is used to inform the application of the progress of a Work.
        Returns:
        the WorkItem representing the asynchronous work; since the Work must be serializable, a RemoteWorkItem is always returned
        Throws:
        commonj.work.WorkException - thrown if queuing this up results in an exception
        IllegalArgumentException - thrown if work is a javax.ejb.EnterpriseBean.
      • schedule

        protected commonj.work.WorkItem schedule​(commonj.work.Work work,
                                                 commonj.work.WorkListener workListener,
                                                 Member member)
                                          throws commonj.work.WorkException
        Accepts a Work instance for processing at the specified Member.
        Parameters:
        work - the Work to execute
        workListener - an optional WorkListener which is used to inform the application of the progress of a Work
        member - the Member to execute the Work at
        Returns:
        a WorkItem representing scheduled Work
        Throws:
        commonj.work.WorkException - thrown if queuing this up results in an exception
      • waitForAll

        public boolean waitForAll​(Collection collWorkItems,
                                  long lTimeoutMillis)
                           throws InterruptedException,
                                  IllegalArgumentException
        Description copied from interface: commonj.work.WorkManager
        Wait for all WorkItems in the collection to finish successfully or otherwise. WorkItems from different WorkManagers can be placed in a single collection and waited on together.

        The WorkItems collection should not be altered once submitted until the method returns.

        Specified by:
        waitForAll in interface commonj.work.WorkManager
        Parameters:
        collWorkItems - the Collection of WorkItem objects to wait for.
        lTimeoutMillis - the timout in milliseconds. If this is 0 then this method returns immediately.
        Returns:
        true if all WorkItems have completed, false if the timeout has expired.
        Throws:
        InterruptedException - thrown if the wait is interrupted.
        IllegalArgumentException - thrown if workItems is null, any of the objects in the collection are not WorkItems or the timeout_ms is negative.
        See Also:
        WorkManager.waitForAll(java.util.Collection, long)
      • waitForAny

        public Collection waitForAny​(Collection collWorkItems,
                                     long lTimeoutMillis)
                              throws InterruptedException,
                                     IllegalArgumentException
        Description copied from interface: commonj.work.WorkManager
        Wait for any of the WorkItems in the collection to finish. If there are no WorkItems in the list then it returns immediately indicating a timeout. WorkItems from different WorkManagers can be placed in a single collection and waited on together.

        The WorkItems collection should not be altered once submitted until the method returns.

        Specified by:
        waitForAny in interface commonj.work.WorkManager
        Parameters:
        collWorkItems - the Collection of WorkItem objects to wait for.
        lTimeoutMillis - the timeout in ms. If this is 0 then the method returns immediately, i.e. does not block.
        Returns:
        the WorkItems that have completed or an empty Collection if it time out expires before any finished.
        Throws:
        InterruptedException - thrown if the wait is interrupted.
        IllegalArgumentException - thrown if workItems is null, any of the objects in the collection are not WorkItems or the timeout_ms is negative.
        See Also:
        WorkManager.waitForAny(java.util.Collection, long)