📄 workmanager.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><!--NewPage--><HTML><HEAD><!-- Generated by javadoc (build 1.4.2_02) on Thu Nov 13 17:20:31 PST 2003 --><TITLE>WorkManager (Java 2 Platform Ent. Ed. v1.4)</TITLE><META NAME="keywords" CONTENT="javax.resource.spi.work.WorkManager interface"><LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style"><SCRIPT type="text/javascript">function windowTitle(){ parent.document.title="WorkManager (Java 2 Platform Ent. Ed. v1.4)";}</SCRIPT></HEAD><BODY BGCOLOR="white" onload="windowTitle();"><!-- ========= START OF TOP NAVBAR ======= --><A NAME="navbar_top"><!-- --></A><A HREF="#skip-navbar_top" title="Skip navigation links"></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""><TR><TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_top_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM><b>Java<sup><font size=-2>TM</font></sup> 2 Platform<br>Ent. Ed. v1.4</b></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../javax/resource/spi/work/WorkListener.html" title="interface in javax.resource.spi.work"><B>PREV CLASS</B></A> NEXT CLASS</FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../index.html" target="_top"><B>FRAMES</B></A> <A HREF="WorkManager.html" target="_top"><B>NO FRAMES</B></A> <SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--></SCRIPT><NOSCRIPT> <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A></NOSCRIPT></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: NESTED | <A HREF="#field_summary">FIELD</A> | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: <A HREF="#field_detail">FIELD</A> | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><A NAME="skip-navbar_top"></A><!-- ========= END OF TOP NAVBAR ========= --><HR><!-- ======== START OF CLASS DATA ======== --><H2><FONT SIZE="-1">javax.resource.spi.work</FONT><BR>Interface WorkManager</H2><HR><DL><DT>public interface <B>WorkManager</B></DL><P>This interface models a <code>WorkManager</code> which provides a facility to submit <code>Work</code> instances for execution. This frees the user from having to create Java threads directly to do work. Further, this allows efficient pooling of thread resources and more control over thread usage. The various stages in <code>Work</code> processing are: <ul> <li> work submit: A <code>Work</code> instance is being submitted for execution. The <code>Work</code> instance could either be accepted or rejected with a <code>WorkRejectedException</code> set to an appropriate error code. </li> <li> work accepted: The submitted <code>Work</code> instance has been accepted. The accepted <code>Work</code> instance could either start execution or could be rejected again with a <code>WorkRejectedException</code> set to an appropriate error code. There is no guarantee on when the execution would start unless a start timeout duration is specified. When a start timeout is specified, the <code>Work</code> execution must be started within the specified duration (not a real-time guarantee), failing which a <code>WorkRejectedException</code> set to an error code (<code>WorkRejected.TIMED_OUT</code>) is thrown. </li> <li> work rejected: The <code>Work</code> instance has been rejected. The <code>Work</code> instance could be rejected during <code>Work</code> submittal or after the <code>Work</code> instance has been accepted (but before Work instance starts execution). The rejection could be due to internal factors or start timeout expiration. A <code>WorkRejectedException</code> with an appropriate error code (indicates the reason) is thrown in both cases. </li> <li> work started: The execution of the <code>Work</code> instance has started. This means that a thread has been allocated for its execution. But this does not guarantee that the allocated thread has been scheduled to run on a CPU resource. Once execution is started, the allocated thread sets up an appropriate execution context (transaction , security, etc) and calls Work.run(). Note, any exception thrown during execution context setup or Work.run() leads to completion of processing. </li> <li> work completed: The execution of the <code>Work</code> has been completed. The execution could complete with or without an exception. The <code>WorkManager</code> catches any exception thrown during <code>Work</code> processing (which includes execution context setup), and wraps it with a <code>WorkCompletedException</code>. </li> </ul><P><P><DL><DT><B>Version:</B></DT> <DD>1.0</DD><DT><B>Author:</B></DT> <DD>Ram Jeyaraman</DD></DL><HR><P><!-- ======== NESTED CLASS SUMMARY ======== --><!-- =========== FIELD SUMMARY =========== --><A NAME="field_summary"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Field Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static long</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../javax/resource/spi/work/WorkManager.html#IMMEDIATE">IMMEDIATE</A></B></CODE><BR> A constant to indicate timeout duration. </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static long</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../javax/resource/spi/work/WorkManager.html#INDEFINITE">INDEFINITE</A></B></CODE><BR> A constant to indicate timeout duration. </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static long</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../javax/resource/spi/work/WorkManager.html#UNKNOWN">UNKNOWN</A></B></CODE><BR> A constant to indicate an unknown start delay duration or other unknown values.</TD></TR></TABLE> <!-- ======== CONSTRUCTOR SUMMARY ======== --><!-- ========== METHOD SUMMARY =========== --><A NAME="method_summary"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Method Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../javax/resource/spi/work/WorkManager.html#doWork(javax.resource.spi.work.Work)">doWork</A></B>(<A HREF="../../../../javax/resource/spi/work/Work.html" title="interface in javax.resource.spi.work">Work</A> work)</CODE><BR> Accepts a <code>Work</code> instance for processing. </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../javax/resource/spi/work/WorkManager.html#doWork(javax.resource.spi.work.Work, long, javax.resource.spi.work.ExecutionContext, javax.resource.spi.work.WorkListener)">doWork</A></B>(<A HREF="../../../../javax/resource/spi/work/Work.html" title="interface in javax.resource.spi.work">Work</A> work, long startTimeout, <A HREF="../../../../javax/resource/spi/work/ExecutionContext.html" title="class in javax.resource.spi.work">ExecutionContext</A> execContext, <A HREF="../../../../javax/resource/spi/work/WorkListener.html" title="interface in javax.resource.spi.work">WorkListener</A> workListener)</CODE><BR> Accepts a <code>Work</code> instance for processing. </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../javax/resource/spi/work/WorkManager.html#scheduleWork(javax.resource.spi.work.Work)">scheduleWork</A></B>(<A HREF="../../../../javax/resource/spi/work/Work.html" title="interface in javax.resource.spi.work">Work</A> work)</CODE><BR> Accepts a <code>Work</code> instance for processing. </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../javax/resource/spi/work/WorkManager.html#scheduleWork(javax.resource.spi.work.Work, long, javax.resource.spi.work.ExecutionContext, javax.resource.spi.work.WorkListener)">scheduleWork</A></B>(<A HREF="../../../../javax/resource/spi/work/Work.html" title="interface in javax.resource.spi.work">Work</A> work, long startTimeout, <A HREF="../../../../javax/resource/spi/work/ExecutionContext.html" title="class in javax.resource.spi.work">ExecutionContext</A> execContext, <A HREF="../../../../javax/resource/spi/work/WorkListener.html" title="interface in javax.resource.spi.work">WorkListener</A> workListener)</CODE><BR> Accepts a <code>Work</code> instance for processing. </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> long</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../javax/resource/spi/work/WorkManager.html#startWork(javax.resource.spi.work.Work)">startWork</A></B>(<A HREF="../../../../javax/resource/spi/work/Work.html" title="interface in javax.resource.spi.work">Work</A> work)</CODE><BR> Accepts a <code>Work</code> instance for processing. </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> long</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../javax/resource/spi/work/WorkManager.html#startWork(javax.resource.spi.work.Work, long, javax.resource.spi.work.ExecutionContext, javax.resource.spi.work.WorkListener)">startWork</A></B>(<A HREF="../../../../javax/resource/spi/work/Work.html" title="interface in javax.resource.spi.work">Work</A> work, long startTimeout, <A HREF="../../../../javax/resource/spi/work/ExecutionContext.html" title="class in javax.resource.spi.work">ExecutionContext</A> execContext, <A HREF="../../../../javax/resource/spi/work/WorkListener.html" title="interface in javax.resource.spi.work">WorkListener</A> workListener)</CODE><BR> Accepts a <code>Work</code> instance for processing. </TD></TR></TABLE> <P><!-- ============ FIELD DETAIL =========== --><A NAME="field_detail"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=1><FONT SIZE="+2"><B>Field Detail</B></FONT></TD></TR></TABLE><A NAME="IMMEDIATE"><!-- --></A><H3>IMMEDIATE</H3><PRE>public static final long <B>IMMEDIATE</B></PRE><DL><DD>A constant to indicate timeout duration. A zero timeout value indicates an action be performed immediately.<P><DL><DT><B>See Also:</B><DD><A HREF="../../../../constant-values.html#javax.resource.spi.work.WorkManager.IMMEDIATE">Constant Field Values</A></DL></DL><HR><A NAME="INDEFINITE"><!-- --></A><H3>INDEFINITE</H3>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -