←
^
→
Designing RMI Applications
Threading
Start with code that works for a single client.
Ensure data integrity.
Minimize time in synchronized blocks.
Be careful when using container classes.
Use containers to mediate inter-thread communication.
Immutable objects are automatically threadsafe.
String
Always have a safe way to stop your threads.
Release all locks and resources before quitting.
Background threads should have low priority.
Pay careful attention to what you serialize.
Serialization takes time and objects could change in the meantime.
Use threading to reduce response-time variance.
Starting a new thread can allow you to return to client quickly (e.g., web server).
Limit the number of objects a thread touches.
Make it easier to debug.
Acquire locks in a fixed order.
User worker threads to prevent deadlocks.
José M. Vidal
.
32 of 49