Top Description Inners Fields Constructors Methods
com.sun.star.lib.uno.environments.remote

public Class JobQueue

extends Object
Class Inheritance
Imports
java.util.ArrayList, com.sun.star.lang.DisposedException

The JobQueue implements a queue for jobs.

For every jobs thread id exists a job queue which is registered at the ThreadPool.

A JobQueue is split into a sync job queue and an async job queue. The sync job queue is the registered queue, it delegates async jobs (put by putjob) into the async queue, which is only known by the sync queue.

Since
UDK1.0
See Also
com.sun.star.lib.uno.environments.remote.IThreadPool, com.sun.star.lib.uno.environments.remote.Job, com.sun.star.lib.uno.environments.remote.ThreadId

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv class
JobQueue.JobDispatcher

A thread for dispatching jobs.

Field Summary

Modifier and TypeField and Description
private boolean
pack-priv JobQueue
private boolean
private boolean
private Object
private Object
private JavaThreadPoolFactory
protected int
protected JobQueue
private ThreadId
private Throwable
private Thread
private static final boolean
DEBUG

When set to true, enables various debugging output.

pack-priv final ArrayList<Job>

Constructor Summary

AccessConstructor and Description
pack-priv
JobQueue(JavaThreadPoolFactory javaThreadPoolFactory, ThreadId
the thread id.
threadId
)

Constructs an async job queue with the given thread id which belongs to the given sync job queue.

pack-priv
JobQueue(JavaThreadPoolFactory javaThreadPoolFactory, ThreadId
the thread id.
threadId
,
boolean
if true, the queue creates a worker thread if needed.
createThread
)

Constructs a sync job queue with the given thread id and the given thread.

Method Summary

Modifier and TypeMethod and Description
pack-priv synchronized void
pack-priv synchronized void
dispose(Object
the dispose id.
disposeId
,
Throwable throwable)

If the given disposeId is registered, interrupts the worker thread.

pack-priv Object

Returns:

the result of the final job (reply).
enter
(Object
a dispose id.
disposeId
)

Enters the job queue.

pack-priv Object

Returns:

the result of the final job (reply).
enter
(int
the maximum amount of time to wait for a job (0 means wait infinitely).
waitTime
,
Object
a dispose id.
disposeId
)

Enters the job queue.

pack-priv ThreadId

Returns:

the thread id.
getThreadId
()

Gives the thread id of this queue.

pack-priv synchronized void
putJob(Job
the job.
job
,
Object
a dispose id.
disposeId
)

Puts a job into the queue.

pack-priv synchronized void
private Job

Returns:

a job or null if timed out.
removeJob
(int
the maximum amount of time to wait for a job.
waitTime
)

Removes a job from the queue.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_activeback to summary
private boolean _active
_async_jobQueueback to summary
pack-priv JobQueue _async_jobQueue
_createThreadback to summary
private boolean _createThread
_createThread_nowback to summary
private boolean _createThread_now
_disposeIdback to summary
private Object _disposeId
_doDisposeback to summary
private Object _doDispose
_javaThreadPoolFactoryback to summary
private JavaThreadPoolFactory _javaThreadPoolFactory
_ref_countback to summary
protected int _ref_count
_sync_jobQueueback to summary
protected JobQueue _sync_jobQueue
_threadIdback to summary
private ThreadId _threadId
_throwableback to summary
private Throwable _throwable
_worker_threadback to summary
private Thread _worker_thread
DEBUGback to summary
private static final boolean DEBUG

When set to true, enables various debugging output.

jobListback to summary
pack-priv final ArrayList<Job> jobList

Constructor Detail

JobQueueback to summary
pack-priv JobQueue(JavaThreadPoolFactory javaThreadPoolFactory, ThreadId threadId)

Constructs an async job queue with the given thread id which belongs to the given sync job queue.

Parameters
threadId:ThreadId

the thread id.

See Also
com.sun.star.lib.uno.environments.remote.ThreadId
JobQueueback to summary
pack-priv JobQueue(JavaThreadPoolFactory javaThreadPoolFactory, ThreadId threadId, boolean createThread)

Constructs a sync job queue with the given thread id and the given thread.

Parameters
threadId:ThreadId

the thread id.

createThread:boolean

if true, the queue creates a worker thread if needed.

See Also
com.sun.star.lib.uno.environments.remote.ThreadId

Method Detail

acquireback to summary
pack-priv synchronized void acquire()
disposeback to summary
pack-priv synchronized void dispose(Object disposeId, Throwable throwable)

If the given disposeId is registered, interrupts the worker thread.

Parameters
disposeId:Object

the dispose id.

enterback to summary
pack-priv Object enter(Object disposeId) throws Throwable

Enters the job queue.

Parameters
disposeId:Object

a dispose id.

Returns:Object

the result of the final job (reply).

enterback to summary
pack-priv Object enter(int waitTime, Object disposeId) throws Throwable

Enters the job queue.

Parameters
waitTime:int

the maximum amount of time to wait for a job (0 means wait infinitely).

disposeId:Object

a dispose id.

Returns:Object

the result of the final job (reply).

getThreadIdback to summary
pack-priv ThreadId getThreadId()

Gives the thread id of this queue.

Returns:ThreadId

the thread id.

See Also
com.sun.star.lib.uno.environments.remote.ThreadId
putJobback to summary
pack-priv synchronized void putJob(Job job, Object disposeId)

Puts a job into the queue.

Parameters
job:Job

the job.

disposeId:Object

a dispose id.

releaseback to summary
pack-priv synchronized void release()
removeJobback to summary
private Job removeJob(int waitTime)

Removes a job from the queue.

Parameters
waitTime:int

the maximum amount of time to wait for a job.

Returns:Job

a job or null if timed out.

com.sun.star.lib.uno.environments.remote back to summary

pack-priv Class JobQueue.JobDispatcher

extends Thread
Class Inheritance

A thread for dispatching jobs.

Field Summary

Modifier and TypeField and Description
pack-priv Object
Inherited from java.lang.Thread:
MAX_PRIORITYMIN_PRIORITYNORM_PRIORITY

Constructor Summary

AccessConstructor and Description
pack-priv
JobDispatcher(Object disposeId)

Method Summary

Modifier and TypeMethod and Description
pack-priv ThreadId
public void
run()

Overrides java.lang.Thread.run.

Implements java.lang.Runnable.run.

This method is run by the thread when it executes.

Inherited from java.lang.Thread:
activeCountcheckAccessclonecurrentThreaddumpStackenumerategetAllStackTracesgetContextClassLoadergetDefaultUncaughtExceptionHandlergetIdgetNamegetPrioritygetStackTracegetStategetThreadGroupgetUncaughtExceptionHandlerholdsLockinterruptinterruptedisAliveisDaemonisInterruptedisVirtualjoinjoinjoinjoinofPlatformofVirtualonSpinWaitsetContextClassLoadersetDaemonsetDefaultUncaughtExceptionHandlersetNamesetPrioritysetUncaughtExceptionHandlersleepsleepsleepstartstartVirtualThreadstopthreadIdtoStringyield

Field Detail

_disposeIdback to summary
pack-priv Object _disposeId

Constructor Detail

JobDispatcherback to summary
pack-priv JobDispatcher(Object disposeId)

Method Detail

getThreadIdback to summary
pack-priv ThreadId getThreadId()
runback to summary
public void run()

Overrides java.lang.Thread.run.

Implements java.lang.Runnable.run.

Doc from java.lang.Thread.run.

This method is run by the thread when it executes. Subclasses of Thread may override this method.

This method is not intended to be invoked directly. If this thread is a platform thread created with a Runnable task then invoking this method will invoke the task's run method. If this thread is a virtual thread then invoking this method directly does nothing.

Annotations
@Override