Table of Contents Previous Next
Logo
Developing a File System Server in C++ : 9.3 Summary
Copyright © 2003-2009 ZeroC, Inc.

9.3 Summary

This chapter showed how to implement a complete server for the file system we defined in Chapter 5. Note that the server is remarkably free of code that relates to distribution: most of the server code is simply application logic that would be present just the same for a non-distributed version. Again, this is one of the major advantages of Ice: distribution concerns are kept away from application code so that you can concentrate on developing application logic instead of networking infrastructure.
Note that the server code we presented here is not quite correct as it stands: if two clients access the same file in parallel, each via a different thread, one thread may read the _lines data member while another thread updates it. Obviously, if that happens, we may write or return garbage or, worse, crash the server. However, it is trivial to make the read and write operations thread-safe: a single data member and two lines of source code are sufficient to achieve this. We discuss how to write thread-safe servant implementations in Chapter 31.
Table of Contents Previous Next
Logo