Class JavaThreadPool
- java.lang.Object
-
- com.sun.star.lib.uno.environments.remote.JavaThreadPool
-
- All Implemented Interfaces:
IThreadPool
public class JavaThreadPool extends java.lang.Object implements IThreadPool
This class implements a java thread pool.- Since:
- UDK1.0
- See Also:
UnoRuntime
,NativeThreadPool
,IThreadPool
,Job
,JobQueue
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
attach()
Attaches this thread to the thread pool.java.lang.Object
attach(ThreadId threadId)
As above, but hands in an already existing instance of the threadid of the current thread.void
destroy()
Destroys the thread pool and tries to join all created threads immediately.void
detach()
Detaches this thread from the thread pool.void
detach(java.lang.Object handle, ThreadId id)
As above, but hands in an already existing instance of the threadid of the current thread and a handle returned by attach.void
dispose(java.lang.Throwable throwable)
Disposes this thread pool, thus releasing all threads by throwing aDisposedException
with the givenThrowable
cause.java.lang.Object
enter()
Lets this thread enter the thread pool.java.lang.Object
enter(java.lang.Object handle, ThreadId threadId)
As above but hands in an already existing instance of the threadid of the current thread and a handle returned by attach.ThreadId
getThreadId()
Retrieves the global threadId for the current thread.void
putJob(Job job)
Queues a job into the jobQueue of the thread belonging to the jobs threadId.
-
-
-
Method Detail
-
getThreadId
public ThreadId getThreadId()
Description copied from interface:IThreadPool
Retrieves the global threadId for the current thread.- Specified by:
getThreadId
in interfaceIThreadPool
- Returns:
- the thread id.
-
attach
public java.lang.Object attach(ThreadId threadId)
Description copied from interface:IThreadPool
As above, but hands in an already existing instance of the threadid of the current thread.The function exists for performance.
- Specified by:
attach
in interfaceIThreadPool
- Returns:
- Returns a handle which can be used in enter and detach calls.
- See Also:
IThreadPool.attach()
-
attach
public void attach()
Description copied from interface:IThreadPool
Attaches this thread to the thread pool.- Specified by:
attach
in interfaceIThreadPool
- See Also:
IThreadPool.enter()
-
detach
public void detach(java.lang.Object handle, ThreadId id)
Description copied from interface:IThreadPool
As above, but hands in an already existing instance of the threadid of the current thread and a handle returned by attach.The function exists for performance.
- Specified by:
detach
in interfaceIThreadPool
- See Also:
IThreadPool.attach()
,IThreadPool.detach()
-
detach
public void detach()
Description copied from interface:IThreadPool
Detaches this thread from the thread pool.- Specified by:
detach
in interfaceIThreadPool
- See Also:
IThreadPool.enter()
-
enter
public java.lang.Object enter() throws java.lang.Throwable
Description copied from interface:IThreadPool
Lets this thread enter the thread pool.This thread then executes all jobs put via
putJob
until a reply job arrives.- Specified by:
enter
in interfaceIThreadPool
- Throws:
java.lang.Throwable
- See Also:
IThreadPool.putJob(com.sun.star.lib.uno.environments.remote.Job)
-
enter
public java.lang.Object enter(java.lang.Object handle, ThreadId threadId) throws java.lang.Throwable
Description copied from interface:IThreadPool
As above but hands in an already existing instance of the threadid of the current thread and a handle returned by attach.This thread then executes all jobs put via
putJob
until a reply job arrives.- Specified by:
enter
in interfaceIThreadPool
- Throws:
java.lang.Throwable
- See Also:
IThreadPool.putJob(com.sun.star.lib.uno.environments.remote.Job)
-
putJob
public void putJob(Job job)
Description copied from interface:IThreadPool
Queues a job into the jobQueue of the thread belonging to the jobs threadId.- Specified by:
putJob
in interfaceIThreadPool
- Parameters:
job
- the job
-
dispose
public void dispose(java.lang.Throwable throwable)
Description copied from interface:IThreadPool
Disposes this thread pool, thus releasing all threads by throwing aDisposedException
with the givenThrowable
cause.- Specified by:
dispose
in interfaceIThreadPool
- Parameters:
throwable
- the cause
-
destroy
public void destroy()
Description copied from interface:IThreadPool
Destroys the thread pool and tries to join all created threads immediately.- Specified by:
destroy
in interfaceIThreadPool
-
-