Sharing

If the Instances/Sharing option is enabled in the EAServer Manager Component Properties dialog box, a single instance serves all client requests. You can also set this property as com.sybase.jaguar.component.sharing using jagtool.

For best performance, this option requires that you also enable the concurrency option. However, if your component has read-write static or instance variables, you must synchronize all access to them. This can create bottlenecks where threads wait to access synchronized data or methods. Such bottlenecks can reduce performance and may lead to larger problems such as deadlock or starvation. Also, in a cluster, the component is not a true singleton object: while one instance runs per server, multiple instances run in the cluster, one instance per server. For these reasons, Sybase recommends that you avoid the Sharing/Singleton pattern if your implementation has read/write static or instance variables.

You can use sharing and concurrency without synchronization if your implementation has no read/write static or instance variables. This can reduce memory use since only one instance is loaded. However, the effect is likely to be negligible unless the implementation class is very large.