Attention java programmers: mapscript thread safety

Sean Gillies sgillies at FRII.COM
Wed Nov 24 11:05:55 EST 2004


Hi all,

I'm really happy to see more Java mapscript activity.  This next
release coming up should be a very good one, and can be made even
better if you will all download and try the 4.4.0beta3 available
from the mapserver web site:

   http://cvs.gis.umn.edu/dist/mapserver-4.4.0-beta3.tar.gz

If you discover a problem, do not delay in reporting it to the
MapServer bugzilla.

Now, about thread safety.  I've been stress testing a multi-threaded
mapscript application (Python + Zope) and identified one problem
yesterday.  The following use of the mapscript.styleObj constructor
is not safe (excuse the Python example, I'm sure you can translate :)

     # add a style to classObj 'co' and return reference
     so = mapscript.styleObj(co)

I'm not exactly sure what's up, or what the fix will be.  Instead,
you should so something like the following safe code:

     # add a new style to classObj 'co', returns the index
     new_style_index = co.insertStyle(mapscript.styleObj())

     # get reference to the added style
     so = co.getStyle(new_style_index)

There is a bug, #1086, in bugzilla for tracking this issue.

cheers,
Sean

--
Sean Gillies
sgillies at frii dot com
http://users.frii.com/sgillies



More information about the mapserver-users mailing list