CONTENTS | PREV | NEXT

2.2 Non-Goals

Thread Safety A particular instance of an ImageReader or ImageWriter is not required to support re-entrant (simultaneous) calls to its methods (with the exception of the abort method that requests current read or writes to halt). However, it must be possible for multiple instances of the same plug-in class to operate simultaneously. For the sake of brevity, we will only discuss reader plug-ins below.

Supporting full re-entrancy would require that the reader bundle all of its state information (e.g., the current input source) into a separate state object, which would allow methods in progress to continue to work with the settings that were in effect at the time they began, while allowing a separate thread to modify the state to be used by the next operation.

Rather than forcing each ImageReader to keep track of its state in this way, it is simpler to require the application to instantiate multiple instances of the same ImageReader class if it wishes to perform multithreaded processing. This means that the state of an ImageReader must be maintained using non-static instance variables only, which should not be a burden for plug-in developers.



CONTENTS | PREV | NEXT

Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.