Threads
Threads are important in Jtrix because (a) we're working in a distributed
environment, and (b) excessive thread use makes a netlet more expensive
to run. Luckily Jtrix provides some rather clever tools to help manage
threads. We split them into two camps, and we'll look at both in this
chapter:
- Managing concurrency. Any netlet can be a server of some kind. For
example, our Hello2Provider (Section
)
is a netlet providing a message. It could be invoked any number of
times simultaneously by clients leading to excessive use. Fortunately,
Jtrix lets us control this.
- Asynchronous facets. Normally, invoking a method on a facet will occur
synchronously. That is, our netlet waits for the method to return
and then continues. But we can also invoke a facet method asynchronously.
That is, our netlet calls the method and returns immediately. Some
time later the method call may return, and our netlet can handle it
then.
Subsections
Nik Silver
2002-03-09