public class StackUtils extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
BLOCKING_WORK_EXECUTOR_NAME_PATTERN
Naming pattern for the
getBlockingWorkExecutor() thread names. |
static String |
NON_BLOCKING_WORK_EXECUTOR_NAME_PATTERN
Naming pattern for the
getNonBlockingWorkExecutor() thread names. |
static Random |
RANDOM
Deprecated.
Use
ThreadLocalRandom instead. |
static String |
SELECTOR_NAME_PATTERN
Name used for the Thread of
getSelector(). |
static int |
TCP_PROTOCOL_VERSION
Constant
TCP_PROTOCOL_VERSION=0 |
static String |
UA_TIMER_NAME_PATTERN
Name used for the Thread in
TimerUtil. |
| Constructor and Description |
|---|
StackUtils() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
barrierWait(AsyncResult<?>[] requests,
long timeout)
Wait for a group to requests to go into final state
|
static int |
cores()
cores.
|
static Executor |
createBlockingWorkExecutor(String name,
int maxThreadPoolSize)
Get Executor for long term and potentially blocking operations.
|
static Integer |
getAsyncSelectorThreadPriority()
|
static int |
getBlockingWorkerThreadPoolCoreSize()
Getter for the field
blockingWorkerThreadPoolCoreSize. |
static long |
getBlockingWorkerThreadPoolTimeout()
Getter for the field
blockingWorkerThreadPoolTimeout. |
static Executor |
getBlockingWorkExecutor()
Get Executor for long term and potentially blocking operations.
|
static Integer |
getBlockingWorkExecutorThreadPriority()
|
static Executor |
getNonBlockingWorkExecutor()
Get Executor for non-blocking operations.
|
static Integer |
getNonBlockingWorkExecutorThreadPriority()
|
static Executor |
getRejectionExecutor()
Get Executor that handles tasks that are rejected by blocking work executor
|
static UnsignedInteger |
getSecurityTokenLifetimeMax()
Default maximum SecureChannel lifetime (in milliseconds) for
MessageSecurityModes other
than MessageSecurityMode.None. |
static UnsignedInteger |
getSecurityTokenLifetimeMin()
Default minimum SecureChannel lifetime (in milliseconds).
|
static AsyncSelector |
getSelector()
getSelector.
|
static Thread.UncaughtExceptionHandler |
getUncaughtExceptionHandler()
The handler that is called, if any of the worker threads encounter an exception that is not
handled.
|
static void |
logStatus()
logStatus.
|
static ThreadFactory |
newNamedThreadFactory(String name)
newNamedThreadFactory.
|
static void |
setAsyncSelectorThreadPriority(Integer asyncSelectorThreadPriority)
Set given value is set for the Thread that
getSelector() uses. |
static void |
setBlockingWorkerThreadPoolCoreSize(int blockingWorkerThreadPoolCoreSize)
Setter for the field
blockingWorkerThreadPoolCoreSize. |
static void |
setBlockingWorkerThreadPoolTimeout(long blockingWorkerThreadPoolTimeout)
Define the timeout (in seconds) of the thread pool for BlockingWorkerExecutor.
|
static void |
setBlockingWorkExecutorThreadPriority(Integer blockingWorkExecutorThreadPriority)
Set given value is set for the Thread that
getBlockingWorkExecutor() uses. |
static void |
setNonBlockingWorkExecutorThreadPriority(Integer nonBlockingWorkExecutorThreadPriority)
Set given value is set for the Thread that
getNonBlockingWorkExecutor() uses. |
static void |
setSecurityTokenLifetimeMax(UnsignedInteger securityTokenLifetimeMax)
|
static void |
setSecurityTokenLifetimeMin(UnsignedInteger securityTokenLifetimeMin)
|
static void |
setUncaughtExceptionHandler(Thread.UncaughtExceptionHandler uncaughtexceptionhandler)
Define the handler that is called, if any of the worker threads encounter an exception that is
not handled.
|
static void |
shutdown()
Perform a "context shutdown" to clean up the Stack resources.
|
static ServiceResultException |
toServiceResultException(Exception e)
toServiceResultException.
|
@Deprecated public static Random RANDOM
ThreadLocalRandom instead.ThreadLocalRandom instead.public static final int TCP_PROTOCOL_VERSION
TCP_PROTOCOL_VERSION=0public static String NON_BLOCKING_WORK_EXECUTOR_NAME_PATTERN
getNonBlockingWorkExecutor() thread names. Can include a single
%d for the number of the thread.public static String BLOCKING_WORK_EXECUTOR_NAME_PATTERN
getBlockingWorkExecutor() thread names. Can include a single %d
for the number of the thread.public static String UA_TIMER_NAME_PATTERN
TimerUtil.public static String SELECTOR_NAME_PATTERN
getSelector().public static boolean barrierWait(AsyncResult<?>[] requests, long timeout) throws InterruptedException
requests - a group of requeststimeout - timeout in secondsInterruptedException - if any.public static int cores()
cores.
public static Executor createBlockingWorkExecutor(String name, int maxThreadPoolSize)
public static Integer getAsyncSelectorThreadPriority()
public static int getBlockingWorkerThreadPoolCoreSize()
Getter for the field blockingWorkerThreadPoolCoreSize.
public static long getBlockingWorkerThreadPoolTimeout()
Getter for the field blockingWorkerThreadPoolTimeout.
public static Executor getBlockingWorkExecutor()
Calls getBlockingWorkExecutor(getDefaultMaxBlockingWorkerThreadPoolSize())
public static Integer getBlockingWorkExecutorThreadPriority()
public static Executor getNonBlockingWorkExecutor()
public static Integer getNonBlockingWorkExecutorThreadPriority()
public static Executor getRejectionExecutor()
public static UnsignedInteger getSecurityTokenLifetimeMax()
MessageSecurityModes other
than MessageSecurityMode.None. Default is 3600000 i.e. one hour. This is used to revise
values the Client gives in OpenSecureChannelRequest.getRequestedLifetime() to the
Server.public static UnsignedInteger getSecurityTokenLifetimeMin()
OpenSecureChannelRequest.getRequestedLifetime() to the Server.public static AsyncSelector getSelector()
getSelector.
AsyncSelector object.public static Thread.UncaughtExceptionHandler getUncaughtExceptionHandler()
public static void logStatus()
logStatus.
public static ThreadFactory newNamedThreadFactory(String name)
newNamedThreadFactory.
name - a String object.ThreadFactory object.public static void setAsyncSelectorThreadPriority(Integer asyncSelectorThreadPriority)
getSelector() uses. Values must be between
Thread.MIN_PRIORITY and Thread.MAX_PRIORITY. If null is given (is also the
default value), then the Threads use default priority. IMPORTANT! Must be called before other
calls to the SDK, otherwise the set values are only used after shutdown() is
called.public static void setBlockingWorkerThreadPoolCoreSize(int blockingWorkerThreadPoolCoreSize)
Setter for the field blockingWorkerThreadPoolCoreSize.
blockingWorkerThreadPoolCoreSize - a int.public static void setBlockingWorkerThreadPoolTimeout(long blockingWorkerThreadPoolTimeout)
Default: 3
blockingWorkerThreadPoolTimeout - a long.public static void setBlockingWorkExecutorThreadPriority(Integer blockingWorkExecutorThreadPriority)
getBlockingWorkExecutor() uses. Values must
be between Thread.MIN_PRIORITY and Thread.MAX_PRIORITY. If null is given (is
also the default value), then the Threads use default priority. IMPORTANT! Must be called
before other calls to the SDK, otherwise the set values are only used after
shutdown() is called.public static void setNonBlockingWorkExecutorThreadPriority(Integer nonBlockingWorkExecutorThreadPriority)
getNonBlockingWorkExecutor() uses. Values
must be between Thread.MIN_PRIORITY and Thread.MAX_PRIORITY. If null is given
(is also the default value), then the Threads use default priority. IMPORTANT! Must be called
before other calls to the SDK, otherwise the set values are only used after
shutdown() is called.public static void setSecurityTokenLifetimeMax(UnsignedInteger securityTokenLifetimeMax)
getSecurityTokenLifetimeMax(). Throws IllegalArgumentException if given
null.public static void setSecurityTokenLifetimeMin(UnsignedInteger securityTokenLifetimeMin)
getSecurityTokenLifetimeMin(). Throws IllegalArgumentException if given
null.public static void setUncaughtExceptionHandler(Thread.UncaughtExceptionHandler uncaughtexceptionhandler)
The default handler will just log the exception with ERROR level to the log.
Set the handler to provide custom behavior in your application.
The handler is set when new worker threads are started and setting the value will not affect already running threads.
uncaughtexceptionhandler - the uncaughtexceptionhandler to setpublic static void shutdown()
Shuts down BLOCKING_EXECUTOR and NON_BLOCKING_EXECUTOR, closes
SELECTOR and cancels TimerUtil.getTimer().
public static ServiceResultException toServiceResultException(Exception e)
toServiceResultException.
e - a Exception object.ServiceResultException object.Copyright © 2026. All rights reserved.