merge the formfield patch from ooo-build
[ooovba.git] / jurt / com / sun / star / lib / uno / environments / remote / IThreadPool.java
blobddd770ef96a3033f2c4d1b8fe7b5173b78333924
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: IThreadPool.java,v $
10 * $Revision: 1.7 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 package com.sun.star.lib.uno.environments.remote;
33 /**
34 * This interface is an abstraction of the various
35 * threadpool implementations.
36 * <p>
37 * @version $Revision: 1.7 $ $ $Date: 2008-04-11 11:20:01 $
38 * @author Joerg Budischewski
39 * @author Kay Ramme
40 * @see com.sun.star.lib.uno.environments.remote.ThreadPoolFactory
41 * @see com.sun.star.lib.uno.environments.remote.IThreadPoolFactory
42 * @since UDK1.0
44 public interface IThreadPool {
45 /**
46 * Retrieves the global threadId for the current thread.
47 * <p>
48 * @return the thread id
50 ThreadId getThreadId();
52 /**
53 * Attaches this thread to the thread pool.
54 * <p>
55 * @see #enter
57 public void attach();
59 /**
60 * As above, but hands in an already existing
61 * instance of the threadid of the current thread.
62 * Returns a handle which can be used in enter and
63 * detach calls.<p>
64 * The function exists for performance
65 * optimization reasons.
66 * @see #attach
68 public Object attach( ThreadId id );
70 /**
71 * Detaches this thread from the thread pool.
72 * @see #enter
74 public void detach();
76 /**
77 * As above, but hands in an already existing
78 * instance of the threadid of the current thread
79 * and a handle returned by attach.
80 * The function exists for performance
81 * optimization reasons.
82 * @see #attach,#detach
84 public void detach( Object handle, ThreadId id );
86 /**
87 * Lets this thread enter the thread pool.
88 * This thread then executes all jobs put via
89 * <code>putJob</code> until a reply job arrives.
90 * <p>
91 * @see #putJob
93 public Object enter() throws Throwable;
95 /**
96 * as above but hands in an already existing
97 * instance of the threadid of the current thread
98 * and a handle returned by attach.
99 * This thread then executes all jobs put via
100 * <code>putJob</code> until a reply job arrives.
101 * <p>
102 * @see #putJob
104 public Object enter( Object handle, ThreadId id ) throws Throwable;
107 * Queues a job into the jobQueue of the thread belonging
108 * to the jobs threadId.
109 * <p>
110 * @param job the job
112 public void putJob(Job job);
115 * Disposes this thread pool, thus releasing
116 * all threads by throwing the given
117 * <code>Throwable</code>.
118 * <p>
119 * @param throwing the Throwable
121 public void dispose(Throwable throwable);
125 * Destroys the thread pool and tries
126 * to join all created threads immediatly.
128 public void destroy();