DISQUS

Dobesland: Running Work in a Seperate Thread and Transaction in Glassfish using the WorkManager

  • lee_wright · 10 months ago
    Why under netbeans am I unable to find the WorkManagerFactory class?
    Do you have a full example (including imports) of the code snippet?

    Thanks

    Lee
  • dobes_vandermeer · 10 months ago
    Hello Lee,
    In eclipse I just type "WorkManagerFactory" and press CTRL+SPACE. The
    WorkManager implementation is here:

    import com.sun.enterprise.connectors.work.CommonWorkManager;

    You can just use new CommonWorkManager("thread-pool-name-here") to construct
    it; this is basically what the WorkManagerFactory does except it allows you
    to set a different implementation of WorkManager if desired.

    The "Work" interface is here:

    import javax.resource.spi.work.Work;

    Note that these won't be available unless you have appserv-rt.jar in your
    classpath.

    Hope that helps!
  • Vamsi Mandava · 6 months ago
    Hi All,

    Is this Workmanager API compatible to JSR-237?
    I am missing some methods like waitForAll() in WorkManager?

    Is there any implementation simillar to Weblogic or Websphere work manager for glass fish?
  • dobes_vandermeer · 6 months ago
    Hi Vamsi,
    This is a glassfish-specific API that is not a standard, and is not
    available in other containers as far as I know.

    Hope that helps (or not!).

    I don't know if WorkManager has a waitForAll() method, you'll just have to
    go take a look at the source code and see what is there for use.

    If you just want to run some jobs in a bunch of threads you can use the
    standard Thread and ThreadPool APIs as well, WorkManager doesn't do anything
    special except manage a list of "Work" objects and run them for you when the
    thread is available.
  • sujitkale · 4 months ago
    i am using Sun Java™ System Application Server Platform Edition 8.2
    how to perform above things in it.
    i have the work manager api. but there is no WorkManagerFactory kind of concept in it.
    how to associate a threadpool to this workmanager.
  • ahtivas · 3 months ago
    Thanks ...