1190 lines
27 KiB
HTML
1190 lines
27 KiB
HTML
<!DOCTYPE html>
|
||
<html>
|
||
<head>
|
||
<meta charset="utf-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
<title>
|
||
Class: Rex::Job
|
||
|
||
— Documentation by YARD 0.9.37
|
||
|
||
</title>
|
||
|
||
<link rel="stylesheet" href="../css/style.css" type="text/css" />
|
||
|
||
<link rel="stylesheet" href="../css/common.css" type="text/css" />
|
||
|
||
<script type="text/javascript">
|
||
pathId = "Rex::Job";
|
||
relpath = '../';
|
||
</script>
|
||
|
||
|
||
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
||
|
||
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
|
||
|
||
|
||
</head>
|
||
<body>
|
||
<div class="nav_wrap">
|
||
<iframe id="nav" src="../class_list.html?1"></iframe>
|
||
<div id="resizer"></div>
|
||
</div>
|
||
|
||
<div id="main" tabindex="-1">
|
||
<div id="header">
|
||
<div id="menu">
|
||
|
||
<a href="../_index.html">Index (J)</a> »
|
||
<span class='title'><span class='object_link'><a href="../Rex.html" title="Rex (module)">Rex</a></span></span>
|
||
»
|
||
<span class="title">Job</span>
|
||
|
||
</div>
|
||
|
||
<div id="search">
|
||
|
||
<a class="full_list_link" id="class_list_link"
|
||
href="../class_list.html">
|
||
|
||
<svg width="24" height="24">
|
||
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
||
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
||
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
||
</svg>
|
||
</a>
|
||
|
||
</div>
|
||
<div class="clear"></div>
|
||
</div>
|
||
|
||
<div id="content"><h1>Class: Rex::Job
|
||
|
||
|
||
|
||
</h1>
|
||
<div class="box_info">
|
||
|
||
<dl>
|
||
<dt>Inherits:</dt>
|
||
<dd>
|
||
<span class="inheritName">Object</span>
|
||
|
||
<ul class="fullTree">
|
||
<li>Object</li>
|
||
|
||
<li class="next">Rex::Job</li>
|
||
|
||
</ul>
|
||
<a href="#" class="inheritanceTree">show all</a>
|
||
|
||
</dd>
|
||
</dl>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<dl>
|
||
<dt>Defined in:</dt>
|
||
<dd>lib/rex/job.rb</dd>
|
||
</dl>
|
||
|
||
</div>
|
||
|
||
<h2>Overview</h2><div class="docstring">
|
||
<div class="discussion">
|
||
|
||
<p>This class is the concrete representation of an abstract job.</p>
|
||
|
||
|
||
</div>
|
||
</div>
|
||
<div class="tags">
|
||
|
||
|
||
</div>
|
||
|
||
|
||
|
||
<h2>Instance Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
|
||
<ul class="summary">
|
||
|
||
<li class="protected ">
|
||
<span class="summary_signature">
|
||
|
||
<a href="#clean_proc-instance_method" title="#clean_proc (instance method)">#<strong>clean_proc</strong> ⇒ Object </a>
|
||
|
||
|
||
|
||
</span>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<span class="note title protected">protected</span>
|
||
|
||
|
||
|
||
|
||
|
||
<span class="summary_desc"><div class='inline'>
|
||
<p>:nodoc:.</p>
|
||
</div></span>
|
||
|
||
</li>
|
||
|
||
|
||
<li class="protected ">
|
||
<span class="summary_signature">
|
||
|
||
<a href="#cleaned_up-instance_method" title="#cleaned_up (instance method)">#<strong>cleaned_up</strong> ⇒ Object </a>
|
||
|
||
|
||
|
||
</span>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<span class="note title protected">protected</span>
|
||
|
||
|
||
|
||
|
||
|
||
<span class="summary_desc"><div class='inline'>
|
||
<p>:nodoc:.</p>
|
||
</div></span>
|
||
|
||
</li>
|
||
|
||
|
||
<li class="protected ">
|
||
<span class="summary_signature">
|
||
|
||
<a href="#cleanup_mutex-instance_method" title="#cleanup_mutex (instance method)">#<strong>cleanup_mutex</strong> ⇒ Object </a>
|
||
|
||
|
||
|
||
</span>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<span class="note title protected">protected</span>
|
||
|
||
|
||
|
||
|
||
|
||
<span class="summary_desc"><div class='inline'>
|
||
<p>:nodoc:.</p>
|
||
</div></span>
|
||
|
||
</li>
|
||
|
||
|
||
<li class="protected ">
|
||
<span class="summary_signature">
|
||
|
||
<a href="#container-instance_method" title="#container (instance method)">#<strong>container</strong> ⇒ Object </a>
|
||
|
||
|
||
|
||
</span>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<span class="note title protected">protected</span>
|
||
|
||
|
||
|
||
|
||
|
||
<span class="summary_desc"><div class='inline'>
|
||
<p>:nodoc:.</p>
|
||
</div></span>
|
||
|
||
</li>
|
||
|
||
|
||
<li class="public ">
|
||
<span class="summary_signature">
|
||
|
||
<a href="#ctx-instance_method" title="#ctx (instance method)">#<strong>ctx</strong> ⇒ Object </a>
|
||
|
||
|
||
|
||
</span>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<span class="summary_desc"><div class='inline'>
|
||
<p>Some job context.</p>
|
||
</div></span>
|
||
|
||
</li>
|
||
|
||
|
||
<li class="public ">
|
||
<span class="summary_signature">
|
||
|
||
<a href="#jid-instance_method" title="#jid (instance method)">#<strong>jid</strong> ⇒ Object </a>
|
||
|
||
|
||
|
||
</span>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<span class="summary_desc"><div class='inline'>
|
||
<p>The job identifier as assigned by the job container.</p>
|
||
</div></span>
|
||
|
||
</li>
|
||
|
||
|
||
<li class="protected ">
|
||
<span class="summary_signature">
|
||
|
||
<a href="#job_thread-instance_method" title="#job_thread (instance method)">#<strong>job_thread</strong> ⇒ Object </a>
|
||
|
||
|
||
|
||
</span>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<span class="note title protected">protected</span>
|
||
|
||
|
||
|
||
|
||
|
||
<span class="summary_desc"><div class='inline'>
|
||
<p>:nodoc:.</p>
|
||
</div></span>
|
||
|
||
</li>
|
||
|
||
|
||
<li class="public ">
|
||
<span class="summary_signature">
|
||
|
||
<a href="#name-instance_method" title="#name (instance method)">#<strong>name</strong> ⇒ Object </a>
|
||
|
||
|
||
|
||
</span>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<span class="summary_desc"><div class='inline'>
|
||
<p>The name of the job.</p>
|
||
</div></span>
|
||
|
||
</li>
|
||
|
||
|
||
<li class="protected ">
|
||
<span class="summary_signature">
|
||
|
||
<a href="#run_proc-instance_method" title="#run_proc (instance method)">#<strong>run_proc</strong> ⇒ Object </a>
|
||
|
||
|
||
|
||
</span>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<span class="note title protected">protected</span>
|
||
|
||
|
||
|
||
|
||
|
||
<span class="summary_desc"><div class='inline'>
|
||
<p>:nodoc:.</p>
|
||
</div></span>
|
||
|
||
</li>
|
||
|
||
|
||
<li class="public ">
|
||
<span class="summary_signature">
|
||
|
||
<a href="#start_time-instance_method" title="#start_time (instance method)">#<strong>start_time</strong> ⇒ Object </a>
|
||
|
||
|
||
|
||
</span>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<span class="summary_desc"><div class='inline'>
|
||
<p>The time at which this job was started.</p>
|
||
</div></span>
|
||
|
||
</li>
|
||
|
||
|
||
</ul>
|
||
|
||
|
||
|
||
|
||
|
||
<h2>
|
||
Instance Method Summary
|
||
<small><a href="#" class="summary_toggle">collapse</a></small>
|
||
</h2>
|
||
|
||
<ul class="summary">
|
||
|
||
<li class="public ">
|
||
<span class="summary_signature">
|
||
|
||
<a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(container, jid, name, ctx, run_proc, clean_proc) ⇒ Job </a>
|
||
|
||
|
||
|
||
</span>
|
||
|
||
|
||
<span class="note title constructor">constructor</span>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<span class="summary_desc"><div class='inline'>
|
||
<p>Creates an individual job instance and initializes it with the supplied parameters.</p>
|
||
</div></span>
|
||
|
||
</li>
|
||
|
||
|
||
<li class="public ">
|
||
<span class="summary_signature">
|
||
|
||
<a href="#start-instance_method" title="#start (instance method)">#<strong>start</strong>(async = false) ⇒ Object </a>
|
||
|
||
|
||
|
||
</span>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<span class="summary_desc"><div class='inline'>
|
||
<p>Runs the job in the context of its own thread if the async flag is false.</p>
|
||
</div></span>
|
||
|
||
</li>
|
||
|
||
|
||
<li class="public ">
|
||
<span class="summary_signature">
|
||
|
||
<a href="#stop-instance_method" title="#stop (instance method)">#<strong>stop</strong> ⇒ Object </a>
|
||
|
||
|
||
|
||
</span>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<span class="summary_desc"><div class='inline'>
|
||
<p>Stops the job if it’s currently running and calls its cleanup procedure.</p>
|
||
</div></span>
|
||
|
||
</li>
|
||
|
||
|
||
<li class="public ">
|
||
<span class="summary_signature">
|
||
|
||
<a href="#synchronized_cleanup-instance_method" title="#synchronized_cleanup (instance method)">#<strong>synchronized_cleanup</strong> ⇒ Object </a>
|
||
|
||
|
||
|
||
</span>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<span class="summary_desc"><div class='inline'></div></span>
|
||
|
||
</li>
|
||
|
||
|
||
</ul>
|
||
|
||
|
||
<div id="constructor_details" class="method_details_list">
|
||
<h2>Constructor Details</h2>
|
||
|
||
<div class="method_details first">
|
||
<h3 class="signature first" id="initialize-instance_method">
|
||
|
||
#<strong>initialize</strong>(container, jid, name, ctx, run_proc, clean_proc) ⇒ <tt><span class='object_link'><a href="" title="Rex::Job (class)">Job</a></span></tt>
|
||
|
||
|
||
|
||
|
||
|
||
</h3><div class="docstring">
|
||
<div class="discussion">
|
||
|
||
<p>Creates an individual job instance and initializes it with the supplied parameters.</p>
|
||
|
||
|
||
</div>
|
||
</div>
|
||
<div class="tags">
|
||
|
||
|
||
</div><table class="source_code">
|
||
<tr>
|
||
<td>
|
||
<pre class="lines">
|
||
|
||
|
||
15
|
||
16
|
||
17
|
||
18
|
||
19
|
||
20
|
||
21
|
||
22
|
||
23
|
||
24
|
||
25</pre>
|
||
</td>
|
||
<td>
|
||
<pre class="code"><span class="info file"># File 'lib/rex/job.rb', line 15</span>
|
||
|
||
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_container'>container</span><span class='comma'>,</span> <span class='id identifier rubyid_jid'>jid</span><span class='comma'>,</span> <span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_ctx'>ctx</span><span class='comma'>,</span> <span class='id identifier rubyid_run_proc'>run_proc</span><span class='comma'>,</span> <span class='id identifier rubyid_clean_proc'>clean_proc</span><span class='rparen'>)</span>
|
||
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_container'>container</span> <span class='op'>=</span> <span class='id identifier rubyid_container'>container</span>
|
||
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_jid'>jid</span> <span class='op'>=</span> <span class='id identifier rubyid_jid'>jid</span>
|
||
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span> <span class='op'>=</span> <span class='id identifier rubyid_name'>name</span>
|
||
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_run_proc'>run_proc</span> <span class='op'>=</span> <span class='id identifier rubyid_run_proc'>run_proc</span>
|
||
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_clean_proc'>clean_proc</span> <span class='op'>=</span> <span class='id identifier rubyid_clean_proc'>clean_proc</span>
|
||
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_ctx'>ctx</span> <span class='op'>=</span> <span class='id identifier rubyid_ctx'>ctx</span>
|
||
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_start_time'>start_time</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
||
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_cleanup_mutex'>cleanup_mutex</span> <span class='op'>=</span> <span class='const'>Mutex</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
|
||
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_cleaned_up'>cleaned_up</span> <span class='op'>=</span> <span class='kw'>false</span>
|
||
<span class='kw'>end</span></pre>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div id="instance_attr_details" class="attr_details">
|
||
<h2>Instance Attribute Details</h2>
|
||
|
||
|
||
<span id="clean_proc=-instance_method"></span>
|
||
<div class="method_details first">
|
||
<h3 class="signature first" id="clean_proc-instance_method">
|
||
|
||
#<strong>clean_proc</strong> ⇒ <tt>Object</tt> <span class="extras">(protected)</span>
|
||
|
||
|
||
|
||
|
||
|
||
</h3><div class="docstring">
|
||
<div class="discussion">
|
||
|
||
<p>:nodoc:</p>
|
||
|
||
|
||
</div>
|
||
</div>
|
||
<div class="tags">
|
||
|
||
|
||
</div><table class="source_code">
|
||
<tr>
|
||
<td>
|
||
<pre class="lines">
|
||
|
||
|
||
104
|
||
105
|
||
106</pre>
|
||
</td>
|
||
<td>
|
||
<pre class="code"><span class="info file"># File 'lib/rex/job.rb', line 104</span>
|
||
|
||
<span class='kw'>def</span> <span class='id identifier rubyid_clean_proc'>clean_proc</span>
|
||
<span class='ivar'>@clean_proc</span>
|
||
<span class='kw'>end</span></pre>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
|
||
|
||
<span id="cleaned_up=-instance_method"></span>
|
||
<div class="method_details ">
|
||
<h3 class="signature " id="cleaned_up-instance_method">
|
||
|
||
#<strong>cleaned_up</strong> ⇒ <tt>Object</tt> <span class="extras">(protected)</span>
|
||
|
||
|
||
|
||
|
||
|
||
</h3><div class="docstring">
|
||
<div class="discussion">
|
||
|
||
<p>:nodoc:</p>
|
||
|
||
|
||
</div>
|
||
</div>
|
||
<div class="tags">
|
||
|
||
|
||
</div><table class="source_code">
|
||
<tr>
|
||
<td>
|
||
<pre class="lines">
|
||
|
||
|
||
108
|
||
109
|
||
110</pre>
|
||
</td>
|
||
<td>
|
||
<pre class="code"><span class="info file"># File 'lib/rex/job.rb', line 108</span>
|
||
|
||
<span class='kw'>def</span> <span class='id identifier rubyid_cleaned_up'>cleaned_up</span>
|
||
<span class='ivar'>@cleaned_up</span>
|
||
<span class='kw'>end</span></pre>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
|
||
|
||
<span id="cleanup_mutex=-instance_method"></span>
|
||
<div class="method_details ">
|
||
<h3 class="signature " id="cleanup_mutex-instance_method">
|
||
|
||
#<strong>cleanup_mutex</strong> ⇒ <tt>Object</tt> <span class="extras">(protected)</span>
|
||
|
||
|
||
|
||
|
||
|
||
</h3><div class="docstring">
|
||
<div class="discussion">
|
||
|
||
<p>:nodoc:</p>
|
||
|
||
|
||
</div>
|
||
</div>
|
||
<div class="tags">
|
||
|
||
|
||
</div><table class="source_code">
|
||
<tr>
|
||
<td>
|
||
<pre class="lines">
|
||
|
||
|
||
107
|
||
108
|
||
109</pre>
|
||
</td>
|
||
<td>
|
||
<pre class="code"><span class="info file"># File 'lib/rex/job.rb', line 107</span>
|
||
|
||
<span class='kw'>def</span> <span class='id identifier rubyid_cleanup_mutex'>cleanup_mutex</span>
|
||
<span class='ivar'>@cleanup_mutex</span>
|
||
<span class='kw'>end</span></pre>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
|
||
|
||
<span id="container=-instance_method"></span>
|
||
<div class="method_details ">
|
||
<h3 class="signature " id="container-instance_method">
|
||
|
||
#<strong>container</strong> ⇒ <tt>Object</tt> <span class="extras">(protected)</span>
|
||
|
||
|
||
|
||
|
||
|
||
</h3><div class="docstring">
|
||
<div class="discussion">
|
||
|
||
<p>:nodoc:</p>
|
||
|
||
|
||
</div>
|
||
</div>
|
||
<div class="tags">
|
||
|
||
|
||
</div><table class="source_code">
|
||
<tr>
|
||
<td>
|
||
<pre class="lines">
|
||
|
||
|
||
102
|
||
103
|
||
104</pre>
|
||
</td>
|
||
<td>
|
||
<pre class="code"><span class="info file"># File 'lib/rex/job.rb', line 102</span>
|
||
|
||
<span class='kw'>def</span> <span class='id identifier rubyid_container'>container</span>
|
||
<span class='ivar'>@container</span>
|
||
<span class='kw'>end</span></pre>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
|
||
|
||
<span id="ctx=-instance_method"></span>
|
||
<div class="method_details ">
|
||
<h3 class="signature " id="ctx-instance_method">
|
||
|
||
#<strong>ctx</strong> ⇒ <tt>Object</tt>
|
||
|
||
|
||
|
||
|
||
|
||
</h3><div class="docstring">
|
||
<div class="discussion">
|
||
|
||
<p>Some job context.</p>
|
||
|
||
|
||
</div>
|
||
</div>
|
||
<div class="tags">
|
||
|
||
|
||
</div><table class="source_code">
|
||
<tr>
|
||
<td>
|
||
<pre class="lines">
|
||
|
||
|
||
95
|
||
96
|
||
97</pre>
|
||
</td>
|
||
<td>
|
||
<pre class="code"><span class="info file"># File 'lib/rex/job.rb', line 95</span>
|
||
|
||
<span class='kw'>def</span> <span class='id identifier rubyid_ctx'>ctx</span>
|
||
<span class='ivar'>@ctx</span>
|
||
<span class='kw'>end</span></pre>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
|
||
|
||
<span id="jid=-instance_method"></span>
|
||
<div class="method_details ">
|
||
<h3 class="signature " id="jid-instance_method">
|
||
|
||
#<strong>jid</strong> ⇒ <tt>Object</tt>
|
||
|
||
|
||
|
||
|
||
|
||
</h3><div class="docstring">
|
||
<div class="discussion">
|
||
|
||
<p>The job identifier as assigned by the job container.</p>
|
||
|
||
|
||
</div>
|
||
</div>
|
||
<div class="tags">
|
||
|
||
|
||
</div><table class="source_code">
|
||
<tr>
|
||
<td>
|
||
<pre class="lines">
|
||
|
||
|
||
85
|
||
86
|
||
87</pre>
|
||
</td>
|
||
<td>
|
||
<pre class="code"><span class="info file"># File 'lib/rex/job.rb', line 85</span>
|
||
|
||
<span class='kw'>def</span> <span class='id identifier rubyid_jid'>jid</span>
|
||
<span class='ivar'>@jid</span>
|
||
<span class='kw'>end</span></pre>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
|
||
|
||
<span id="job_thread=-instance_method"></span>
|
||
<div class="method_details ">
|
||
<h3 class="signature " id="job_thread-instance_method">
|
||
|
||
#<strong>job_thread</strong> ⇒ <tt>Object</tt> <span class="extras">(protected)</span>
|
||
|
||
|
||
|
||
|
||
|
||
</h3><div class="docstring">
|
||
<div class="discussion">
|
||
|
||
<p>:nodoc:</p>
|
||
|
||
|
||
</div>
|
||
</div>
|
||
<div class="tags">
|
||
|
||
|
||
</div><table class="source_code">
|
||
<tr>
|
||
<td>
|
||
<pre class="lines">
|
||
|
||
|
||
101
|
||
102
|
||
103</pre>
|
||
</td>
|
||
<td>
|
||
<pre class="code"><span class="info file"># File 'lib/rex/job.rb', line 101</span>
|
||
|
||
<span class='kw'>def</span> <span class='id identifier rubyid_job_thread'>job_thread</span>
|
||
<span class='ivar'>@job_thread</span>
|
||
<span class='kw'>end</span></pre>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
|
||
|
||
<span id="name=-instance_method"></span>
|
||
<div class="method_details ">
|
||
<h3 class="signature " id="name-instance_method">
|
||
|
||
#<strong>name</strong> ⇒ <tt>Object</tt>
|
||
|
||
|
||
|
||
|
||
|
||
</h3><div class="docstring">
|
||
<div class="discussion">
|
||
|
||
<p>The name of the job.</p>
|
||
|
||
|
||
</div>
|
||
</div>
|
||
<div class="tags">
|
||
|
||
|
||
</div><table class="source_code">
|
||
<tr>
|
||
<td>
|
||
<pre class="lines">
|
||
|
||
|
||
80
|
||
81
|
||
82</pre>
|
||
</td>
|
||
<td>
|
||
<pre class="code"><span class="info file"># File 'lib/rex/job.rb', line 80</span>
|
||
|
||
<span class='kw'>def</span> <span class='id identifier rubyid_name'>name</span>
|
||
<span class='ivar'>@name</span>
|
||
<span class='kw'>end</span></pre>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
|
||
|
||
<span id="run_proc=-instance_method"></span>
|
||
<div class="method_details ">
|
||
<h3 class="signature " id="run_proc-instance_method">
|
||
|
||
#<strong>run_proc</strong> ⇒ <tt>Object</tt> <span class="extras">(protected)</span>
|
||
|
||
|
||
|
||
|
||
|
||
</h3><div class="docstring">
|
||
<div class="discussion">
|
||
|
||
<p>:nodoc:</p>
|
||
|
||
|
||
</div>
|
||
</div>
|
||
<div class="tags">
|
||
|
||
|
||
</div><table class="source_code">
|
||
<tr>
|
||
<td>
|
||
<pre class="lines">
|
||
|
||
|
||
103
|
||
104
|
||
105</pre>
|
||
</td>
|
||
<td>
|
||
<pre class="code"><span class="info file"># File 'lib/rex/job.rb', line 103</span>
|
||
|
||
<span class='kw'>def</span> <span class='id identifier rubyid_run_proc'>run_proc</span>
|
||
<span class='ivar'>@run_proc</span>
|
||
<span class='kw'>end</span></pre>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
|
||
|
||
<span id="start_time=-instance_method"></span>
|
||
<div class="method_details ">
|
||
<h3 class="signature " id="start_time-instance_method">
|
||
|
||
#<strong>start_time</strong> ⇒ <tt>Object</tt>
|
||
|
||
|
||
|
||
|
||
|
||
</h3><div class="docstring">
|
||
<div class="discussion">
|
||
|
||
<p>The time at which this job was started.</p>
|
||
|
||
|
||
</div>
|
||
</div>
|
||
<div class="tags">
|
||
|
||
|
||
</div><table class="source_code">
|
||
<tr>
|
||
<td>
|
||
<pre class="lines">
|
||
|
||
|
||
90
|
||
91
|
||
92</pre>
|
||
</td>
|
||
<td>
|
||
<pre class="code"><span class="info file"># File 'lib/rex/job.rb', line 90</span>
|
||
|
||
<span class='kw'>def</span> <span class='id identifier rubyid_start_time'>start_time</span>
|
||
<span class='ivar'>@start_time</span>
|
||
<span class='kw'>end</span></pre>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
|
||
</div>
|
||
|
||
|
||
<div id="instance_method_details" class="method_details_list">
|
||
<h2>Instance Method Details</h2>
|
||
|
||
|
||
<div class="method_details first">
|
||
<h3 class="signature first" id="start-instance_method">
|
||
|
||
#<strong>start</strong>(async = false) ⇒ <tt>Object</tt>
|
||
|
||
|
||
|
||
|
||
|
||
</h3><div class="docstring">
|
||
<div class="discussion">
|
||
|
||
<p>Runs the job in the context of its own thread if the async flag is false. Otherwise, the job is run inline.</p>
|
||
|
||
|
||
</div>
|
||
</div>
|
||
<div class="tags">
|
||
|
||
|
||
</div><table class="source_code">
|
||
<tr>
|
||
<td>
|
||
<pre class="lines">
|
||
|
||
|
||
41
|
||
42
|
||
43
|
||
44
|
||
45
|
||
46
|
||
47
|
||
48
|
||
49
|
||
50
|
||
51
|
||
52
|
||
53
|
||
54
|
||
55
|
||
56
|
||
57
|
||
58
|
||
59
|
||
60
|
||
61
|
||
62
|
||
63</pre>
|
||
</td>
|
||
<td>
|
||
<pre class="code"><span class="info file"># File 'lib/rex/job.rb', line 41</span>
|
||
|
||
<span class='kw'>def</span> <span class='id identifier rubyid_start'>start</span><span class='lparen'>(</span><span class='id identifier rubyid_async'>async</span> <span class='op'>=</span> <span class='kw'>false</span><span class='rparen'>)</span>
|
||
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_start_time'>start_time</span> <span class='op'>=</span> <span class='op'>::</span><span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_now'>now</span>
|
||
<span class='kw'>if</span> <span class='lparen'>(</span><span class='id identifier rubyid_async'>async</span><span class='rparen'>)</span>
|
||
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_job_thread'>job_thread</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../Rex.html" title="Rex (module)">Rex</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="ThreadFactory.html" title="Rex::ThreadFactory (class)">ThreadFactory</a></span></span><span class='period'>.</span><span class='id identifier rubyid_spawn'><span class='object_link'><a href="ThreadFactory.html#spawn-class_method" title="Rex::ThreadFactory.spawn (method)">spawn</a></span></span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>JobID(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_jid'>jid</span><span class='embexpr_end'>}</span><span class='tstring_content'>)-</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_name'>name</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='kw'>false</span><span class='rparen'>)</span> <span class='lbrace'>{</span>
|
||
<span class='comment'># Deschedule our thread momentarily
|
||
</span> <span class='op'>::</span><span class='const'>IO</span><span class='period'>.</span><span class='id identifier rubyid_select'>select</span><span class='lparen'>(</span><span class='kw'>nil</span><span class='comma'>,</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='float'>0.01</span><span class='rparen'>)</span>
|
||
|
||
<span class='kw'>begin</span>
|
||
<span class='id identifier rubyid_run_proc'>run_proc</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='id identifier rubyid_ctx'>ctx</span><span class='rparen'>)</span>
|
||
<span class='kw'>ensure</span>
|
||
<span class='id identifier rubyid_synchronized_cleanup'>synchronized_cleanup</span>
|
||
<span class='id identifier rubyid_container'>container</span><span class='period'>.</span><span class='id identifier rubyid_remove_job'>remove_job</span><span class='lparen'>(</span><span class='kw'>self</span><span class='rparen'>)</span>
|
||
<span class='kw'>end</span>
|
||
<span class='rbrace'>}</span>
|
||
<span class='kw'>else</span>
|
||
<span class='kw'>begin</span>
|
||
<span class='id identifier rubyid_run_proc'>run_proc</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='id identifier rubyid_ctx'>ctx</span><span class='rparen'>)</span>
|
||
<span class='kw'>rescue</span> <span class='op'>::</span><span class='const'>Exception</span>
|
||
<span class='id identifier rubyid_container'>container</span><span class='period'>.</span><span class='id identifier rubyid_stop_job'>stop_job</span><span class='lparen'>(</span><span class='id identifier rubyid_jid'>jid</span><span class='rparen'>)</span>
|
||
<span class='id identifier rubyid_raise'>raise</span> <span class='gvar'>$!</span>
|
||
<span class='kw'>end</span>
|
||
<span class='kw'>end</span>
|
||
<span class='kw'>end</span></pre>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
|
||
<div class="method_details ">
|
||
<h3 class="signature " id="stop-instance_method">
|
||
|
||
#<strong>stop</strong> ⇒ <tt>Object</tt>
|
||
|
||
|
||
|
||
|
||
|
||
</h3><div class="docstring">
|
||
<div class="discussion">
|
||
|
||
<p>Stops the job if it’s currently running and calls its cleanup procedure</p>
|
||
|
||
|
||
</div>
|
||
</div>
|
||
<div class="tags">
|
||
|
||
|
||
</div><table class="source_code">
|
||
<tr>
|
||
<td>
|
||
<pre class="lines">
|
||
|
||
|
||
68
|
||
69
|
||
70
|
||
71
|
||
72
|
||
73
|
||
74
|
||
75</pre>
|
||
</td>
|
||
<td>
|
||
<pre class="code"><span class="info file"># File 'lib/rex/job.rb', line 68</span>
|
||
|
||
<span class='kw'>def</span> <span class='id identifier rubyid_stop'>stop</span>
|
||
<span class='kw'>if</span> <span class='lparen'>(</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_job_thread'>job_thread</span><span class='rparen'>)</span>
|
||
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_job_thread'>job_thread</span><span class='period'>.</span><span class='id identifier rubyid_kill'>kill</span>
|
||
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_job_thread'>job_thread</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
||
<span class='kw'>end</span>
|
||
|
||
<span class='id identifier rubyid_synchronized_cleanup'>synchronized_cleanup</span>
|
||
<span class='kw'>end</span></pre>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
|
||
<div class="method_details ">
|
||
<h3 class="signature " id="synchronized_cleanup-instance_method">
|
||
|
||
#<strong>synchronized_cleanup</strong> ⇒ <tt>Object</tt>
|
||
|
||
|
||
|
||
|
||
|
||
</h3><table class="source_code">
|
||
<tr>
|
||
<td>
|
||
<pre class="lines">
|
||
|
||
|
||
27
|
||
28
|
||
29
|
||
30
|
||
31
|
||
32
|
||
33
|
||
34
|
||
35</pre>
|
||
</td>
|
||
<td>
|
||
<pre class="code"><span class="info file"># File 'lib/rex/job.rb', line 27</span>
|
||
|
||
<span class='kw'>def</span> <span class='id identifier rubyid_synchronized_cleanup'>synchronized_cleanup</span>
|
||
<span class='comment'># Avoid start and stop both calling cleanup
|
||
</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_cleanup_mutex'>cleanup_mutex</span><span class='period'>.</span><span class='id identifier rubyid_synchronize'>synchronize</span> <span class='kw'>do</span>
|
||
<span class='kw'>unless</span> <span class='id identifier rubyid_cleaned_up'>cleaned_up</span>
|
||
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_cleaned_up'>cleaned_up</span> <span class='op'>=</span> <span class='kw'>true</span>
|
||
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_clean_proc'>clean_proc</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='id identifier rubyid_ctx'>ctx</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_clean_proc'>clean_proc</span>
|
||
<span class='kw'>end</span>
|
||
<span class='kw'>end</span>
|
||
<span class='kw'>end</span></pre>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div id="footer">
|
||
Generated on Fri May 8 17:04:05 2026 by
|
||
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
||
0.9.37 (ruby-3.1.5).
|
||
</div>
|
||
|
||
</div>
|
||
</body>
|
||
</html> |