bump product version to 5.0.4.1
[LibreOffice.git] / jurt / com / sun / star / lib / uno / environments / remote / IThreadPool.java
blobf862655a643a6005b3655412c427c22a46e0cc7c
1 /*
2 * This file is part of the LibreOffice project.
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 * This file incorporates work covered by the following license notice:
10 * Licensed to the Apache Software Foundation (ASF) under one or more
11 * contributor license agreements. See the NOTICE file distributed
12 * with this work for additional information regarding copyright
13 * ownership. The ASF licenses this file to you under the Apache
14 * License, Version 2.0 (the "License"); you may not use this file
15 * except in compliance with the License. You may obtain a copy of
16 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 package com.sun.star.lib.uno.environments.remote;
21 /**
22 * This interface is an abstraction of the various threadpool implementations.
24 * @see com.sun.star.lib.uno.environments.remote.ThreadPoolFactory
25 * @see com.sun.star.lib.uno.environments.remote.IThreadPoolFactory
26 * @since UDK1.0
28 public interface IThreadPool {
29 /**
30 * Retrieves the global threadId for the current thread.
32 * @return the thread id.
34 ThreadId getThreadId();
36 /**
37 * Attaches this thread to the thread pool.
39 * @see #enter
41 void attach();
43 /**
44 * As above, but hands in an already existing instance of the threadid of
45 * the current thread.
47 * <p>The function exists for performance.</p>
49 * @return Returns a handle which can be used in enter and detach calls.
50 * @see #attach
52 Object attach( ThreadId id );
54 /**
55 * Detaches this thread from the thread pool.
56 * @see #enter
58 void detach();
60 /**
61 * As above, but hands in an already existing instance of the threadid of
62 * the current thread and a handle returned by attach.
64 * <p>The function exists for performance.</p>
66 * @see #attach()
67 * @see #detach()
69 void detach( Object handle, ThreadId id );
71 /**
72 * Lets this thread enter the thread pool.
74 * <p>This thread then executes all jobs put via <code>putJob</code> until
75 * a reply job arrives.</p>
77 * @see #putJob
79 Object enter() throws Throwable;
81 /**
82 * As above but hands in an already existing instance of the threadid of
83 * the current thread and a handle returned by attach.
85 * <p>This thread then executes all jobs put via <code>putJob</code> until
86 * a reply job arrives.</p>
88 * @see #putJob
90 Object enter( Object handle, ThreadId id ) throws Throwable;
92 /**
93 * Queues a job into the jobQueue of the thread belonging to the jobs
94 * threadId.
96 * @param job the job
98 void putJob(Job job);
101 * Disposes this thread pool, thus releasing all threads by throwing a
102 * <code>DisposedException</code> with the given <code>Throwable</code> cause.
104 * @param throwable the cause
106 void dispose(Throwable throwable);
110 * Destroys the thread pool and tries to join all created threads immediately.
112 void destroy();