org.amino
Class Runtime

java.lang.Object
  extended by org.amino.Runtime

public final class Runtime
extends java.lang.Object

Controlling Runtime class for Amino project. Controls many aspects of underlying implementation of Amino packages.

Author:
donawa

Method Summary
static int getMajorVersion()
          Return major version number.
static int getMaxAvailableWorkerThreads()
          Return maximum number of worker threads.
static int getMinorVersion()
          Return minor version number.
static int getNumberAvailableWorkerThreads()
          Return number of available worker threads.
static java.lang.String getVersion()
          Return current version of Amino package.
static boolean manageWorkerThreads()
          Return whether Amino Runtime is managing worker threads.
static int releaseThreads(int numberThreads)
          Increase count of threads available to participate in work.
static int reserveThreads(int numberThreads)
          Decrease count of threads available to participate in work if manageWorkerThreads returns true.
static void setManageWorkerThreads(boolean b)
          Used to determine whether the Amino Runtime controls how many worker threads are active at any one time within Amino packages.
static void setMaxAvailableWorkerThreads(int n)
          Set upper limit of threads available to work within Amino packages.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getMajorVersion

public static int getMajorVersion()
Return major version number.

Returns:
Major version number

getMinorVersion

public static int getMinorVersion()
Return minor version number.

Returns:
Minor version number

getVersion

public static java.lang.String getVersion()
Return current version of Amino package.

Returns:
Version string in the form "Major.Minor".

manageWorkerThreads

public static boolean manageWorkerThreads()
Return whether Amino Runtime is managing worker threads.

Returns:
true if the Amino Runtime settings have an effect on worker threads within the Amino packages

setManageWorkerThreads

public static void setManageWorkerThreads(boolean b)
Used to determine whether the Amino Runtime controls how many worker threads are active at any one time within Amino packages. Useful to minimize thread spawning in a recursively parallel environment.

Parameters:
b - true if Amino packages should check the Runtime settings for how they use worker threads.

getNumberAvailableWorkerThreads

public static int getNumberAvailableWorkerThreads()
Return number of available worker threads.

Returns:
current number of threads available to work within Amino packages

getMaxAvailableWorkerThreads

public static int getMaxAvailableWorkerThreads()
Return maximum number of worker threads.

Returns:
maximum number of threads available to work within Amino packages

setMaxAvailableWorkerThreads

public static void setMaxAvailableWorkerThreads(int n)
Set upper limit of threads available to work within Amino packages.

Parameters:
n - Maximum number of threads to be available for work within Amino packages.

reserveThreads

public static int reserveThreads(int numberThreads)
Decrease count of threads available to participate in work if manageWorkerThreads returns true.

Parameters:
numberThreads - Number of threads to remove from total count of available worker threads
Returns:
Number of threads actually reserved for work
See Also:
manageWorkerThreads()

releaseThreads

public static int releaseThreads(int numberThreads)
Increase count of threads available to participate in work. If manageWorkerThreads returns true, then at most getMaxAvailableWorkerThreads() - getNumberAvailableWorkerThreads() can be released.

Parameters:
numberThreads - Number of additional threads now available
Returns:
Total amount of threads actually released
See Also:
getMaxAvailableWorkerThreads(), getMaxAvailableWorkerThreads(), manageWorkerThreads()


Copyright © 2008. All Rights Reserved.