The threads in a thread pool provide asynchronous client and component notification. You can create thread pools using EAServer Manager—see Chapter 8, “Setting up the Message Service,” in the EAServer System Administration Guide. You can also create a thread pool within your application. This example creates a thread pool and sets the thread values of readers, writers, and workers to “0”. If the thread pool already exists, its configuration is unchanged.
void create (THREAD_POOL, “Thread_Pool_Name” );
To use a thread pool for client notification, set the thread values of readers to “3”, writers to “2”, and workers to “0”. To use a thread pool for component notification, set the thread values of both readers and writers to “0”, and set the value of workers to “1”. If you want to enable parallel message processing for component notification, set workers to a value greater than “1”.
This code fragment sets the value of workers in the system.tp1 thread pool to “1”:
props = _cms.getProperties(THREAD_POOL.value, “system.tp1”); for (int i = 0; i < props.length; i++) { Property p = props[i]; if (p.name.equals("workers")) { if (p.value.longValue() != 1) { p.value.longValue(1); _cms.setProperties(THREAD_POOL.value, “system.tp1”, props); break; } } }
Copyright © 2005. Sybase Inc. All rights reserved. |