com.gc.iotools.stream.base
Enum ExecutionModel

java.lang.Object
  extended by java.lang.Enum<ExecutionModel>
      extended by com.gc.iotools.stream.base.ExecutionModel
All Implemented Interfaces:
Serializable, Comparable<ExecutionModel>

public enum ExecutionModel
extends Enum<ExecutionModel>

This class enumerates the policies for instantiating Threads in classes of EasyStream library that needs of them.

Since:
1.0
Author:
dvd.smnt
See Also:
#com.gc.iotools.stream.is.InputStreamFromOutputStream, #com.gc.iotools.stream.os.OutputStreamToInputStream

Enum Constant Summary
SINGLE_THREAD
           Only one thread is shared by all instances (slow).
STATIC_THREAD_POOL
           Threads are taken from a static pool.
THREAD_PER_INSTANCE
           One thread per instance of class.
 
Method Summary
static ExecutionModel valueOf(String name)
          Returns the enum constant of this type with the specified name.
static ExecutionModel[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

STATIC_THREAD_POOL

public static final ExecutionModel STATIC_THREAD_POOL

Threads are taken from a static pool.

Some slow thread might lock up the pool and other processes might be slowed down.

See Also:
ThreadPoolExecutor

THREAD_PER_INSTANCE

public static final ExecutionModel THREAD_PER_INSTANCE

One thread per instance of class. Slow but each instance can work in isolation. Also if some thread is not correctly closed there might be threads leaks.


SINGLE_THREAD

public static final ExecutionModel SINGLE_THREAD

Only one thread is shared by all instances (slow).

Method Detail

values

public static ExecutionModel[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (ExecutionModel c : ExecutionModel.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static ExecutionModel valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
IllegalArgumentException - if this enum type has no constant with the specified name
NullPointerException - if the argument is null


Copyright © 2008-2009. All Rights Reserved.