rt/emul/compact/src/main/java/java/util/concurrent/ExecutorService.java
author Jaroslav Tulach <jaroslav.tulach@apidesign.org>
Sat, 19 Mar 2016 10:46:31 +0100
branchjdk7-b147
changeset 1890 212417b74b72
permissions -rw-r--r--
Bringing in all concurrent package from JDK7-b147
jaroslav@1890
     1
/*
jaroslav@1890
     2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
jaroslav@1890
     3
 *
jaroslav@1890
     4
 * This code is free software; you can redistribute it and/or modify it
jaroslav@1890
     5
 * under the terms of the GNU General Public License version 2 only, as
jaroslav@1890
     6
 * published by the Free Software Foundation.  Oracle designates this
jaroslav@1890
     7
 * particular file as subject to the "Classpath" exception as provided
jaroslav@1890
     8
 * by Oracle in the LICENSE file that accompanied this code.
jaroslav@1890
     9
 *
jaroslav@1890
    10
 * This code is distributed in the hope that it will be useful, but WITHOUT
jaroslav@1890
    11
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
jaroslav@1890
    12
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
jaroslav@1890
    13
 * version 2 for more details (a copy is included in the LICENSE file that
jaroslav@1890
    14
 * accompanied this code).
jaroslav@1890
    15
 *
jaroslav@1890
    16
 * You should have received a copy of the GNU General Public License version
jaroslav@1890
    17
 * 2 along with this work; if not, write to the Free Software Foundation,
jaroslav@1890
    18
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
jaroslav@1890
    19
 *
jaroslav@1890
    20
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
jaroslav@1890
    21
 * or visit www.oracle.com if you need additional information or have any
jaroslav@1890
    22
 * questions.
jaroslav@1890
    23
 */
jaroslav@1890
    24
jaroslav@1890
    25
/*
jaroslav@1890
    26
 * This file is available under and governed by the GNU General Public
jaroslav@1890
    27
 * License version 2 only, as published by the Free Software Foundation.
jaroslav@1890
    28
 * However, the following notice accompanied the original version of this
jaroslav@1890
    29
 * file:
jaroslav@1890
    30
 *
jaroslav@1890
    31
 * Written by Doug Lea with assistance from members of JCP JSR-166
jaroslav@1890
    32
 * Expert Group and released to the public domain, as explained at
jaroslav@1890
    33
 * http://creativecommons.org/publicdomain/zero/1.0/
jaroslav@1890
    34
 */
jaroslav@1890
    35
jaroslav@1890
    36
package java.util.concurrent;
jaroslav@1890
    37
import java.util.List;
jaroslav@1890
    38
import java.util.Collection;
jaroslav@1890
    39
import java.security.PrivilegedAction;
jaroslav@1890
    40
import java.security.PrivilegedExceptionAction;
jaroslav@1890
    41
jaroslav@1890
    42
/**
jaroslav@1890
    43
 * An {@link Executor} that provides methods to manage termination and
jaroslav@1890
    44
 * methods that can produce a {@link Future} for tracking progress of
jaroslav@1890
    45
 * one or more asynchronous tasks.
jaroslav@1890
    46
 *
jaroslav@1890
    47
 * <p> An <tt>ExecutorService</tt> can be shut down, which will cause
jaroslav@1890
    48
 * it to reject new tasks.  Two different methods are provided for
jaroslav@1890
    49
 * shutting down an <tt>ExecutorService</tt>. The {@link #shutdown}
jaroslav@1890
    50
 * method will allow previously submitted tasks to execute before
jaroslav@1890
    51
 * terminating, while the {@link #shutdownNow} method prevents waiting
jaroslav@1890
    52
 * tasks from starting and attempts to stop currently executing tasks.
jaroslav@1890
    53
 * Upon termination, an executor has no tasks actively executing, no
jaroslav@1890
    54
 * tasks awaiting execution, and no new tasks can be submitted.  An
jaroslav@1890
    55
 * unused <tt>ExecutorService</tt> should be shut down to allow
jaroslav@1890
    56
 * reclamation of its resources.
jaroslav@1890
    57
 *
jaroslav@1890
    58
 * <p> Method <tt>submit</tt> extends base method {@link
jaroslav@1890
    59
 * Executor#execute} by creating and returning a {@link Future} that
jaroslav@1890
    60
 * can be used to cancel execution and/or wait for completion.
jaroslav@1890
    61
 * Methods <tt>invokeAny</tt> and <tt>invokeAll</tt> perform the most
jaroslav@1890
    62
 * commonly useful forms of bulk execution, executing a collection of
jaroslav@1890
    63
 * tasks and then waiting for at least one, or all, to
jaroslav@1890
    64
 * complete. (Class {@link ExecutorCompletionService} can be used to
jaroslav@1890
    65
 * write customized variants of these methods.)
jaroslav@1890
    66
 *
jaroslav@1890
    67
 * <p>The {@link Executors} class provides factory methods for the
jaroslav@1890
    68
 * executor services provided in this package.
jaroslav@1890
    69
 *
jaroslav@1890
    70
 * <h3>Usage Examples</h3>
jaroslav@1890
    71
 *
jaroslav@1890
    72
 * Here is a sketch of a network service in which threads in a thread
jaroslav@1890
    73
 * pool service incoming requests. It uses the preconfigured {@link
jaroslav@1890
    74
 * Executors#newFixedThreadPool} factory method:
jaroslav@1890
    75
 *
jaroslav@1890
    76
 * <pre>
jaroslav@1890
    77
 * class NetworkService implements Runnable {
jaroslav@1890
    78
 *   private final ServerSocket serverSocket;
jaroslav@1890
    79
 *   private final ExecutorService pool;
jaroslav@1890
    80
 *
jaroslav@1890
    81
 *   public NetworkService(int port, int poolSize)
jaroslav@1890
    82
 *       throws IOException {
jaroslav@1890
    83
 *     serverSocket = new ServerSocket(port);
jaroslav@1890
    84
 *     pool = Executors.newFixedThreadPool(poolSize);
jaroslav@1890
    85
 *   }
jaroslav@1890
    86
 *
jaroslav@1890
    87
 *   public void run() { // run the service
jaroslav@1890
    88
 *     try {
jaroslav@1890
    89
 *       for (;;) {
jaroslav@1890
    90
 *         pool.execute(new Handler(serverSocket.accept()));
jaroslav@1890
    91
 *       }
jaroslav@1890
    92
 *     } catch (IOException ex) {
jaroslav@1890
    93
 *       pool.shutdown();
jaroslav@1890
    94
 *     }
jaroslav@1890
    95
 *   }
jaroslav@1890
    96
 * }
jaroslav@1890
    97
 *
jaroslav@1890
    98
 * class Handler implements Runnable {
jaroslav@1890
    99
 *   private final Socket socket;
jaroslav@1890
   100
 *   Handler(Socket socket) { this.socket = socket; }
jaroslav@1890
   101
 *   public void run() {
jaroslav@1890
   102
 *     // read and service request on socket
jaroslav@1890
   103
 *   }
jaroslav@1890
   104
 * }
jaroslav@1890
   105
 * </pre>
jaroslav@1890
   106
 *
jaroslav@1890
   107
 * The following method shuts down an <tt>ExecutorService</tt> in two phases,
jaroslav@1890
   108
 * first by calling <tt>shutdown</tt> to reject incoming tasks, and then
jaroslav@1890
   109
 * calling <tt>shutdownNow</tt>, if necessary, to cancel any lingering tasks:
jaroslav@1890
   110
 *
jaroslav@1890
   111
 * <pre>
jaroslav@1890
   112
 * void shutdownAndAwaitTermination(ExecutorService pool) {
jaroslav@1890
   113
 *   pool.shutdown(); // Disable new tasks from being submitted
jaroslav@1890
   114
 *   try {
jaroslav@1890
   115
 *     // Wait a while for existing tasks to terminate
jaroslav@1890
   116
 *     if (!pool.awaitTermination(60, TimeUnit.SECONDS)) {
jaroslav@1890
   117
 *       pool.shutdownNow(); // Cancel currently executing tasks
jaroslav@1890
   118
 *       // Wait a while for tasks to respond to being cancelled
jaroslav@1890
   119
 *       if (!pool.awaitTermination(60, TimeUnit.SECONDS))
jaroslav@1890
   120
 *           System.err.println("Pool did not terminate");
jaroslav@1890
   121
 *     }
jaroslav@1890
   122
 *   } catch (InterruptedException ie) {
jaroslav@1890
   123
 *     // (Re-)Cancel if current thread also interrupted
jaroslav@1890
   124
 *     pool.shutdownNow();
jaroslav@1890
   125
 *     // Preserve interrupt status
jaroslav@1890
   126
 *     Thread.currentThread().interrupt();
jaroslav@1890
   127
 *   }
jaroslav@1890
   128
 * }
jaroslav@1890
   129
 * </pre>
jaroslav@1890
   130
 *
jaroslav@1890
   131
 * <p>Memory consistency effects: Actions in a thread prior to the
jaroslav@1890
   132
 * submission of a {@code Runnable} or {@code Callable} task to an
jaroslav@1890
   133
 * {@code ExecutorService}
jaroslav@1890
   134
 * <a href="package-summary.html#MemoryVisibility"><i>happen-before</i></a>
jaroslav@1890
   135
 * any actions taken by that task, which in turn <i>happen-before</i> the
jaroslav@1890
   136
 * result is retrieved via {@code Future.get()}.
jaroslav@1890
   137
 *
jaroslav@1890
   138
 * @since 1.5
jaroslav@1890
   139
 * @author Doug Lea
jaroslav@1890
   140
 */
jaroslav@1890
   141
public interface ExecutorService extends Executor {
jaroslav@1890
   142
jaroslav@1890
   143
    /**
jaroslav@1890
   144
     * Initiates an orderly shutdown in which previously submitted
jaroslav@1890
   145
     * tasks are executed, but no new tasks will be accepted.
jaroslav@1890
   146
     * Invocation has no additional effect if already shut down.
jaroslav@1890
   147
     *
jaroslav@1890
   148
     * <p>This method does not wait for previously submitted tasks to
jaroslav@1890
   149
     * complete execution.  Use {@link #awaitTermination awaitTermination}
jaroslav@1890
   150
     * to do that.
jaroslav@1890
   151
     *
jaroslav@1890
   152
     * @throws SecurityException if a security manager exists and
jaroslav@1890
   153
     *         shutting down this ExecutorService may manipulate
jaroslav@1890
   154
     *         threads that the caller is not permitted to modify
jaroslav@1890
   155
     *         because it does not hold {@link
jaroslav@1890
   156
     *         java.lang.RuntimePermission}<tt>("modifyThread")</tt>,
jaroslav@1890
   157
     *         or the security manager's <tt>checkAccess</tt> method
jaroslav@1890
   158
     *         denies access.
jaroslav@1890
   159
     */
jaroslav@1890
   160
    void shutdown();
jaroslav@1890
   161
jaroslav@1890
   162
    /**
jaroslav@1890
   163
     * Attempts to stop all actively executing tasks, halts the
jaroslav@1890
   164
     * processing of waiting tasks, and returns a list of the tasks
jaroslav@1890
   165
     * that were awaiting execution.
jaroslav@1890
   166
     *
jaroslav@1890
   167
     * <p>This method does not wait for actively executing tasks to
jaroslav@1890
   168
     * terminate.  Use {@link #awaitTermination awaitTermination} to
jaroslav@1890
   169
     * do that.
jaroslav@1890
   170
     *
jaroslav@1890
   171
     * <p>There are no guarantees beyond best-effort attempts to stop
jaroslav@1890
   172
     * processing actively executing tasks.  For example, typical
jaroslav@1890
   173
     * implementations will cancel via {@link Thread#interrupt}, so any
jaroslav@1890
   174
     * task that fails to respond to interrupts may never terminate.
jaroslav@1890
   175
     *
jaroslav@1890
   176
     * @return list of tasks that never commenced execution
jaroslav@1890
   177
     * @throws SecurityException if a security manager exists and
jaroslav@1890
   178
     *         shutting down this ExecutorService may manipulate
jaroslav@1890
   179
     *         threads that the caller is not permitted to modify
jaroslav@1890
   180
     *         because it does not hold {@link
jaroslav@1890
   181
     *         java.lang.RuntimePermission}<tt>("modifyThread")</tt>,
jaroslav@1890
   182
     *         or the security manager's <tt>checkAccess</tt> method
jaroslav@1890
   183
     *         denies access.
jaroslav@1890
   184
     */
jaroslav@1890
   185
    List<Runnable> shutdownNow();
jaroslav@1890
   186
jaroslav@1890
   187
    /**
jaroslav@1890
   188
     * Returns <tt>true</tt> if this executor has been shut down.
jaroslav@1890
   189
     *
jaroslav@1890
   190
     * @return <tt>true</tt> if this executor has been shut down
jaroslav@1890
   191
     */
jaroslav@1890
   192
    boolean isShutdown();
jaroslav@1890
   193
jaroslav@1890
   194
    /**
jaroslav@1890
   195
     * Returns <tt>true</tt> if all tasks have completed following shut down.
jaroslav@1890
   196
     * Note that <tt>isTerminated</tt> is never <tt>true</tt> unless
jaroslav@1890
   197
     * either <tt>shutdown</tt> or <tt>shutdownNow</tt> was called first.
jaroslav@1890
   198
     *
jaroslav@1890
   199
     * @return <tt>true</tt> if all tasks have completed following shut down
jaroslav@1890
   200
     */
jaroslav@1890
   201
    boolean isTerminated();
jaroslav@1890
   202
jaroslav@1890
   203
    /**
jaroslav@1890
   204
     * Blocks until all tasks have completed execution after a shutdown
jaroslav@1890
   205
     * request, or the timeout occurs, or the current thread is
jaroslav@1890
   206
     * interrupted, whichever happens first.
jaroslav@1890
   207
     *
jaroslav@1890
   208
     * @param timeout the maximum time to wait
jaroslav@1890
   209
     * @param unit the time unit of the timeout argument
jaroslav@1890
   210
     * @return <tt>true</tt> if this executor terminated and
jaroslav@1890
   211
     *         <tt>false</tt> if the timeout elapsed before termination
jaroslav@1890
   212
     * @throws InterruptedException if interrupted while waiting
jaroslav@1890
   213
     */
jaroslav@1890
   214
    boolean awaitTermination(long timeout, TimeUnit unit)
jaroslav@1890
   215
        throws InterruptedException;
jaroslav@1890
   216
jaroslav@1890
   217
jaroslav@1890
   218
    /**
jaroslav@1890
   219
     * Submits a value-returning task for execution and returns a
jaroslav@1890
   220
     * Future representing the pending results of the task. The
jaroslav@1890
   221
     * Future's <tt>get</tt> method will return the task's result upon
jaroslav@1890
   222
     * successful completion.
jaroslav@1890
   223
     *
jaroslav@1890
   224
     * <p>
jaroslav@1890
   225
     * If you would like to immediately block waiting
jaroslav@1890
   226
     * for a task, you can use constructions of the form
jaroslav@1890
   227
     * <tt>result = exec.submit(aCallable).get();</tt>
jaroslav@1890
   228
     *
jaroslav@1890
   229
     * <p> Note: The {@link Executors} class includes a set of methods
jaroslav@1890
   230
     * that can convert some other common closure-like objects,
jaroslav@1890
   231
     * for example, {@link java.security.PrivilegedAction} to
jaroslav@1890
   232
     * {@link Callable} form so they can be submitted.
jaroslav@1890
   233
     *
jaroslav@1890
   234
     * @param task the task to submit
jaroslav@1890
   235
     * @return a Future representing pending completion of the task
jaroslav@1890
   236
     * @throws RejectedExecutionException if the task cannot be
jaroslav@1890
   237
     *         scheduled for execution
jaroslav@1890
   238
     * @throws NullPointerException if the task is null
jaroslav@1890
   239
     */
jaroslav@1890
   240
    <T> Future<T> submit(Callable<T> task);
jaroslav@1890
   241
jaroslav@1890
   242
    /**
jaroslav@1890
   243
     * Submits a Runnable task for execution and returns a Future
jaroslav@1890
   244
     * representing that task. The Future's <tt>get</tt> method will
jaroslav@1890
   245
     * return the given result upon successful completion.
jaroslav@1890
   246
     *
jaroslav@1890
   247
     * @param task the task to submit
jaroslav@1890
   248
     * @param result the result to return
jaroslav@1890
   249
     * @return a Future representing pending completion of the task
jaroslav@1890
   250
     * @throws RejectedExecutionException if the task cannot be
jaroslav@1890
   251
     *         scheduled for execution
jaroslav@1890
   252
     * @throws NullPointerException if the task is null
jaroslav@1890
   253
     */
jaroslav@1890
   254
    <T> Future<T> submit(Runnable task, T result);
jaroslav@1890
   255
jaroslav@1890
   256
    /**
jaroslav@1890
   257
     * Submits a Runnable task for execution and returns a Future
jaroslav@1890
   258
     * representing that task. The Future's <tt>get</tt> method will
jaroslav@1890
   259
     * return <tt>null</tt> upon <em>successful</em> completion.
jaroslav@1890
   260
     *
jaroslav@1890
   261
     * @param task the task to submit
jaroslav@1890
   262
     * @return a Future representing pending completion of the task
jaroslav@1890
   263
     * @throws RejectedExecutionException if the task cannot be
jaroslav@1890
   264
     *         scheduled for execution
jaroslav@1890
   265
     * @throws NullPointerException if the task is null
jaroslav@1890
   266
     */
jaroslav@1890
   267
    Future<?> submit(Runnable task);
jaroslav@1890
   268
jaroslav@1890
   269
    /**
jaroslav@1890
   270
     * Executes the given tasks, returning a list of Futures holding
jaroslav@1890
   271
     * their status and results when all complete.
jaroslav@1890
   272
     * {@link Future#isDone} is <tt>true</tt> for each
jaroslav@1890
   273
     * element of the returned list.
jaroslav@1890
   274
     * Note that a <em>completed</em> task could have
jaroslav@1890
   275
     * terminated either normally or by throwing an exception.
jaroslav@1890
   276
     * The results of this method are undefined if the given
jaroslav@1890
   277
     * collection is modified while this operation is in progress.
jaroslav@1890
   278
     *
jaroslav@1890
   279
     * @param tasks the collection of tasks
jaroslav@1890
   280
     * @return A list of Futures representing the tasks, in the same
jaroslav@1890
   281
     *         sequential order as produced by the iterator for the
jaroslav@1890
   282
     *         given task list, each of which has completed.
jaroslav@1890
   283
     * @throws InterruptedException if interrupted while waiting, in
jaroslav@1890
   284
     *         which case unfinished tasks are cancelled.
jaroslav@1890
   285
     * @throws NullPointerException if tasks or any of its elements are <tt>null</tt>
jaroslav@1890
   286
     * @throws RejectedExecutionException if any task cannot be
jaroslav@1890
   287
     *         scheduled for execution
jaroslav@1890
   288
     */
jaroslav@1890
   289
jaroslav@1890
   290
    <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks)
jaroslav@1890
   291
        throws InterruptedException;
jaroslav@1890
   292
jaroslav@1890
   293
    /**
jaroslav@1890
   294
     * Executes the given tasks, returning a list of Futures holding
jaroslav@1890
   295
     * their status and results
jaroslav@1890
   296
     * when all complete or the timeout expires, whichever happens first.
jaroslav@1890
   297
     * {@link Future#isDone} is <tt>true</tt> for each
jaroslav@1890
   298
     * element of the returned list.
jaroslav@1890
   299
     * Upon return, tasks that have not completed are cancelled.
jaroslav@1890
   300
     * Note that a <em>completed</em> task could have
jaroslav@1890
   301
     * terminated either normally or by throwing an exception.
jaroslav@1890
   302
     * The results of this method are undefined if the given
jaroslav@1890
   303
     * collection is modified while this operation is in progress.
jaroslav@1890
   304
     *
jaroslav@1890
   305
     * @param tasks the collection of tasks
jaroslav@1890
   306
     * @param timeout the maximum time to wait
jaroslav@1890
   307
     * @param unit the time unit of the timeout argument
jaroslav@1890
   308
     * @return a list of Futures representing the tasks, in the same
jaroslav@1890
   309
     *         sequential order as produced by the iterator for the
jaroslav@1890
   310
     *         given task list. If the operation did not time out,
jaroslav@1890
   311
     *         each task will have completed. If it did time out, some
jaroslav@1890
   312
     *         of these tasks will not have completed.
jaroslav@1890
   313
     * @throws InterruptedException if interrupted while waiting, in
jaroslav@1890
   314
     *         which case unfinished tasks are cancelled
jaroslav@1890
   315
     * @throws NullPointerException if tasks, any of its elements, or
jaroslav@1890
   316
     *         unit are <tt>null</tt>
jaroslav@1890
   317
     * @throws RejectedExecutionException if any task cannot be scheduled
jaroslav@1890
   318
     *         for execution
jaroslav@1890
   319
     */
jaroslav@1890
   320
    <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks,
jaroslav@1890
   321
                                  long timeout, TimeUnit unit)
jaroslav@1890
   322
        throws InterruptedException;
jaroslav@1890
   323
jaroslav@1890
   324
    /**
jaroslav@1890
   325
     * Executes the given tasks, returning the result
jaroslav@1890
   326
     * of one that has completed successfully (i.e., without throwing
jaroslav@1890
   327
     * an exception), if any do. Upon normal or exceptional return,
jaroslav@1890
   328
     * tasks that have not completed are cancelled.
jaroslav@1890
   329
     * The results of this method are undefined if the given
jaroslav@1890
   330
     * collection is modified while this operation is in progress.
jaroslav@1890
   331
     *
jaroslav@1890
   332
     * @param tasks the collection of tasks
jaroslav@1890
   333
     * @return the result returned by one of the tasks
jaroslav@1890
   334
     * @throws InterruptedException if interrupted while waiting
jaroslav@1890
   335
     * @throws NullPointerException if tasks or any element task
jaroslav@1890
   336
     *         subject to execution is <tt>null</tt>
jaroslav@1890
   337
     * @throws IllegalArgumentException if tasks is empty
jaroslav@1890
   338
     * @throws ExecutionException if no task successfully completes
jaroslav@1890
   339
     * @throws RejectedExecutionException if tasks cannot be scheduled
jaroslav@1890
   340
     *         for execution
jaroslav@1890
   341
     */
jaroslav@1890
   342
    <T> T invokeAny(Collection<? extends Callable<T>> tasks)
jaroslav@1890
   343
        throws InterruptedException, ExecutionException;
jaroslav@1890
   344
jaroslav@1890
   345
    /**
jaroslav@1890
   346
     * Executes the given tasks, returning the result
jaroslav@1890
   347
     * of one that has completed successfully (i.e., without throwing
jaroslav@1890
   348
     * an exception), if any do before the given timeout elapses.
jaroslav@1890
   349
     * Upon normal or exceptional return, tasks that have not
jaroslav@1890
   350
     * completed are cancelled.
jaroslav@1890
   351
     * The results of this method are undefined if the given
jaroslav@1890
   352
     * collection is modified while this operation is in progress.
jaroslav@1890
   353
     *
jaroslav@1890
   354
     * @param tasks the collection of tasks
jaroslav@1890
   355
     * @param timeout the maximum time to wait
jaroslav@1890
   356
     * @param unit the time unit of the timeout argument
jaroslav@1890
   357
     * @return the result returned by one of the tasks.
jaroslav@1890
   358
     * @throws InterruptedException if interrupted while waiting
jaroslav@1890
   359
     * @throws NullPointerException if tasks, or unit, or any element
jaroslav@1890
   360
     *         task subject to execution is <tt>null</tt>
jaroslav@1890
   361
     * @throws TimeoutException if the given timeout elapses before
jaroslav@1890
   362
     *         any task successfully completes
jaroslav@1890
   363
     * @throws ExecutionException if no task successfully completes
jaroslav@1890
   364
     * @throws RejectedExecutionException if tasks cannot be scheduled
jaroslav@1890
   365
     *         for execution
jaroslav@1890
   366
     */
jaroslav@1890
   367
    <T> T invokeAny(Collection<? extends Callable<T>> tasks,
jaroslav@1890
   368
                    long timeout, TimeUnit unit)
jaroslav@1890
   369
        throws InterruptedException, ExecutionException, TimeoutException;
jaroslav@1890
   370
}