Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.quartz.simpl
Class ZeroSizeThreadPool

    java.lang.Object
      org.quartz.simpl.ZeroSizeThreadPool

All Implemented Interfaces:
  ThreadPool

    public class ZeroSizeThreadPool

extends Object
implements ThreadPool

This is class is a simple implementation of a zero size thread pool, based on the ``ThreadPool`` interface.

The pool has zero `Thread`s and does not grow or shrink based on demand. Which means it is obviously not useful for most scenarios. When it may be useful is to prevent creating any worker threads at all - which may be desirable for the sole purpose of preserving system resources in the case where the scheduler instance only exists in order to schedule jobs, but which will never execute jobs (e.g. will never have start() called on it).

Author:
  Wayne Fay

Constructor Summary
`ZeroSizeThreadPool()` Create a new `ZeroSizeThreadPool`.

Method Summary
`int` | `blockForAvailableThreads()` Determines the number of threads that are currently available in in the pool.
`org.slf4j.Logger` | `getLog()`
`int` | `getPoolSize()` Get the current number of threads in the `ThreadPool`.
`void` | `initialize()` Must be called before the `ThreadPool` is used, in order to give the it a chance to initialize.
`boolean` | `runInThread(Runnable runnable)` Execute the given ``Runnable`` in the next available `Thread`.
`void` | `setInstanceId(String schedInstId)` Inform the `ThreadPool` of the Scheduler instance's Id, prior to initialize being invoked.
`void` | `setInstanceName(String schedName)` Inform the `ThreadPool` of the Scheduler instance's name, prior to initialize being invoked.
`void` | `shutdown()`
`void` | `shutdown(boolean waitForJobsToComplete)` Called by the QuartzScheduler to inform the `ThreadPool` that it should free up all of it's resources because the scheduler is shutting down.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ZeroSizeThreadPool

    public ZeroSizeThreadPool()

  Create a new `ZeroSizeThreadPool`.

Method Detail

### getLog

    public org.slf4j.Logger getLog()

### getPoolSize

    public int getPoolSize()

  Description copied from interface: `ThreadPool`

  Get the current number of threads in the `ThreadPool`.

  Specified by:
    `getPoolSize` in interface `ThreadPool`

### initialize

    public void initialize()
                    throws SchedulerConfigException

  Description copied from interface: `ThreadPool`

  Must be called before the `ThreadPool` is used, in order to give the it a chance to initialize.

  Typically called by the `SchedulerFactory`.

  Specified by:
    `initialize` in interface `ThreadPool`
  Throws:
    `SchedulerConfigException`

### shutdown

    public void shutdown()

### shutdown

    public void shutdown(boolean waitForJobsToComplete)

  Description copied from interface: `ThreadPool`

  Called by the QuartzScheduler to inform the `ThreadPool` that it should free up all of it's resources because the scheduler is shutting down.

  Specified by:
    `shutdown` in interface `ThreadPool`

### runInThread

    public boolean runInThread(Runnable runnable)

  Description copied from interface: `ThreadPool`

  Execute the given ``Runnable`` in the next available `Thread`.

  The implementation of this interface should not throw exceptions unless there is a serious problem (i.e. a serious misconfiguration). If there are no immediately available threads `false` should be returned.

  Specified by:
    `runInThread` in interface `ThreadPool`
  Returns:
    true, if the runnable was assigned to run on a Thread.

### blockForAvailableThreads

    public int blockForAvailableThreads()

  Description copied from interface: `ThreadPool`

  Determines the number of threads that are currently available in in the pool. Useful for determining the number of times `runInThread(Runnable)` can be called before returning false.

  The implementation of this method should block until there is at least one available thread.

  Specified by:
    `blockForAvailableThreads` in interface `ThreadPool`
  Returns:
    the number of currently available threads

### setInstanceId

    public void setInstanceId(String schedInstId)

  Description copied from interface: `ThreadPool`

  Inform the `ThreadPool` of the Scheduler instance's Id, prior to initialize being invoked.

  Specified by:
    `setInstanceId` in interface `ThreadPool`

### setInstanceName

    public void setInstanceName(String schedName)

  Description copied from interface: `ThreadPool`

  Inform the `ThreadPool` of the Scheduler instance's name, prior to initialize being invoked.

  Specified by:
    `setInstanceName` in interface `ThreadPool`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright 2001-2012, Terracotta, Inc.