/usr/share/doc/polyorb-doc/html/polyorb_ug/Most-Features-in-One-Example.html is in polyorb-doc 2.11~20140418-3.2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- This is free software; you can redistribute it and/or modify it under
terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version. This software is distributed in the hope that it will be
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. -->
<!-- Created by GNU Texinfo 6.3, http://www.gnu.org/software/texinfo/ -->
<head>
<title>PolyORB User’s Guide: Most Features in One Example</title>
<meta name="description" content="PolyORB User’s Guide: Most Features in One Example">
<meta name="keywords" content="PolyORB User’s Guide: Most Features in One Example">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="About-This-Guide.html#About-This-Guide" rel="start" title="About This Guide">
<link href="Index.html#Index" rel="index" title="Index">
<link href="About-This-Guide.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="DSA.html#DSA" rel="up" title="DSA">
<link href="A-small-example-of-a-DSA-application.html#A-small-example-of-a-DSA-application" rel="next" title="A small example of a DSA application">
<link href="Abortion-and-Termination.html#Abortion-and-Termination" rel="prev" title="Abortion and Termination">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smalllisp {margin-left: 3.2em}
kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: initial; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
ul.no-bullet {list-style: none}
-->
</style>
</head>
<body lang="en">
<a name="Most-Features-in-One-Example"></a>
<div class="header">
<p>
Next: <a href="A-small-example-of-a-DSA-application.html#A-small-example-of-a-DSA-application" accesskey="n" rel="next">A small example of a DSA application</a>, Previous: <a href="Partition-Communication-Subsystem.html#Partition-Communication-Subsystem" accesskey="p" rel="prev">Partition Communication Subsystem</a>, Up: <a href="DSA.html#DSA" accesskey="u" rel="up">DSA</a> [<a href="About-This-Guide.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Index.html#Index" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<a name="Most-Features-in-One-Example-1"></a>
<h3 class="section">8.3 Most Features in One Example</h3>
<p>The example shown on the following figure highlights most of the
features of DSA. The system is based on a set of factories and workers
and a storage. Each entity is a partition itself. A factory hires a
worker from a pool of workers (hire - 1) and assigns a job (query - 2)
to him. The worker performs the job and saves the result (reply - 3) in
a storage common to all the factories. The worker notifies the factory
of the end of his job (notify - 4).
</p>
<br>
<br>
<img src="full-ex.fig.png" alt="full-ex.fig">
<br>
<p>When a worker has completed his job, the result must be saved in a
common storage. To do this, we define a protected area in SP package
Storage (see following code). An entryless protected object ensures
atomic access to this area.
</p>
<div class="smallexample">
<pre class="smallexample">
<b>package</b> Storage <b>is</b>
<b>pragma</b> Shared_Passive;
<b>protected</b> Queue <b>is</b>
<b>procedure</b> Insert (Q, R : Integer);
<b>procedure</b> Remove
(Q : <b>in</b> Integer;
R : <b>out</b> Integer);
<b>private</b>
-- implementation removed
<b>end</b> Storage;
</pre></div>
<p>Common is a Remote_Types package that defines most of the remote
services of the above system (see following code). First, we define a
way for the workers to signal the completion of his job. This callback
mechanism is implemented using RAS Notify.
</p>
<div class="smallexample">
<pre class="smallexample">
<b>with</b> Storage; <b>use</b> Storage;
<b>package</b> Common <b>is</b>
<b>pragma</b> Remote_Types;
<b>type</b> Notify <b>is</b>
<b>access</b> <b>procedure</b> (Q : Integer);
<b>pragma</b> Asynchronous (Notify);
<b>type</b> Worker <b>is</b>
<b>abstract</b> <b>tagged</b> <b>limited</b> <b>private</b>;
<b>procedure</b> Assign
(W : <b>access</b> Worker;
Q : <b>in</b> Integer;
N : <b>in</b> Notify) <b>is</b> <b>abstract</b>;
<b>type</b> Any_Worker <b>is</b>
<b>access</b> <b>all</b> Worker'Class;
<b>pragma</b> Asynchronous (Any_Worker);
<b>private</b>
-- implementation removed
<b>end</b> Common;
</pre></div>
<p>We define an abstract tagged type Worker which is intended to be the
root type of the whole distributed objects hierarchy. Assign allows a
factory to specify a job to a worker and a way for the worker to signal
its employer the completion of this job. Any_Worker is a remote access
to class wide type (RACW). In other words, it is a reference to a
distributed object of any derived type from Worker class. Note that the
two remote access types (Any_Worker and Notify) are declared as
asynchronous. Therefore, any override of Assign will be executed
asynchronously. To be asynchronous, an object of type Notify has to be a
reference to an asynchronous procedure.
</p>
<p>NewWorker is derived from type Worker and Assign is overridden.
</p>
<div class="smallexample">
<pre class="smallexample">
<b>with</b> Common, Storage; <b>use</b> Common, Storage;
<b>package</b> NewWorkers <b>is</b>
<b>pragma</b> Remote_Types;
<b>type</b> NewWorker <b>is</b> <b>new</b> Worker <b>with</b> <b>private</b>;
<b>procedure</b> Assign
(W : <b>access</b> NewWorker;
Q : Integer;
N : Notify);
<b>private</b>
-- implementation removed
<b>end</b> NewWorkers;
</pre></div>
<p>The following code shows how to derive a second generation of workers
NewNewWorker from the first generation NewWorker. As mentioned above,
this RT package can be duplicated on several partitions to produce
several types of workers and also several remote workers.
</p>
<div class="smallexample">
<pre class="smallexample">
<b>with</b> Common, Storage, NewWorkers; <b>use</b> Common, Storage, NewWorkers;
<b>package</b> NewNewWorkers <b>is</b>
<b>pragma</b> Remote_Types;
<b>type</b> NewNewWorker <b>is</b> <b>new</b> NewWorker <b>with</b> <b>private</b>;
<b>procedure</b> Assign
(W : <b>access</b> NewNewWorker;
Q : Integer;
N : Notify);
<b>private</b>
-- implementation removed
<b>end</b> NewNewWorkers;
</pre></div>
<p>In the following code, we define a unique place where workers wait for
jobs. WorkerCity is a Remote_Call_Interface package with services to
hire and free workers. Unlike Remote_Types packages,
Remote_Call_Interface packages cannot be duplicated, and are assigned to
one specific partition.
</p>
<div class="smallexample">
<pre class="smallexample">
<b>with</b> Common; <b>use</b> Common;
<b>package</b> WorkerCity <b>is</b>
<b>pragma</b> Remote_Call_Interface;
<b>procedure</b> Insert (W : <b>in</b> Any_Worker);
<b>procedure</b> Remove (W : <b>out</b> Any_Worker);
<b>end</b> WorkerCity;
</pre></div>
<p>In order to use even more DSA features, Factory is defined as a generic
RCI package (see sample above). Any instantiation defines a new factory
(see sample above). To be RCI, this instantiation has to be categorized
once again.
</p>
<div class="smallexample">
<pre class="smallexample">
<b>with</b> Storage; <b>use</b> Storage;
<b>generic</b>
<b>package</b> Factory <b>is</b>
<b>pragma</b> Remote_Call_Interface;
<b>procedure</b> Notify (Q : Integer);
<b>pragma</b> Asynchronous (Notify);
<b>end</b> Factory;
</pre></div>
<div class="smallexample">
<pre class="smallexample">
<b>with</b> Factory;
<b>package</b> NewFactory <b>is</b> <b>new</b> Factory;
<b>pragma</b> Remote_Call_Interface (NewFactory);
</pre></div>
<hr>
<div class="header">
<p>
Next: <a href="A-small-example-of-a-DSA-application.html#A-small-example-of-a-DSA-application" accesskey="n" rel="next">A small example of a DSA application</a>, Previous: <a href="Partition-Communication-Subsystem.html#Partition-Communication-Subsystem" accesskey="p" rel="prev">Partition Communication Subsystem</a>, Up: <a href="DSA.html#DSA" accesskey="u" rel="up">DSA</a> [<a href="About-This-Guide.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Index.html#Index" title="Index" rel="index">Index</a>]</p>
</div>
</body>
</html>
|