Chapter 1 Introducing Jaguar CTS


Thread-safety features

Since Jaguar CTS is a multithreaded environment, component instances that share resources and volatile data must be coded or configured to avoid problems with inconsistent state. For example, if all instances of a component write to the same file, you must take steps to ensure that the file is "locked" before each instance writes to it and "unlocked" when the write completes. If writes to the file are allowed to occur simultaneously, then output from two component instances may be mixed together within the file.

Whenever possible, avoid the use of volatile global variables (in C) or static class variables (in Java or C++). Also avoid sharing stateful (being able to maintain information about the state of a resource) resources such as database connections or file descriptors. In cases where data and resources are shared, there are two ways to ensure thread safety in a component:

 


Copyright © 2000 Sybase, Inc. All rights reserved.