[Proj] proj JNI wrapping

Andrea Antonello moovida at katamail.com
Wed Oct 13 17:03:02 EDT 2004


Hy Martin,
thanks for your reply.

>  -- It's inside a commercial product.

I suspected that, but you never know... :)

>  -- GDAL and Proj both use the C runtime library extensively and the C
> runtime is not threadsafe, but java is thread safe and therefore if you
> have multiple java threads trying to use your JNI functions you will get
> strange/random behaviors (including crashing) of your app.  The way to
> solve this is easy, you simply mark your java functions as syncronized
> using the syncronized key word.  It will be slower under multiple user
> conditions, but at least it will never crash from threading issues.

Alright, I'll take this into account.

>  -- Yes, Before you try to do anything with java, create a class in c++
> that does exactly wht you want to do with gdal/proj.  Once you know that
> works, you can attempt to expose that class to java with jni.  I say
> this because a lot of programmers try to do everything at once and then
> they end up having a hard time debugging their code because it's mixed
> across java and c++.  It is possible to step from java to c++ code in
> debug mode, but this requires you are an expert at using both your java
> and c++ compilers.  Is this what you were looking for?

Ok, I got it. Will for sure start it that way.

>
>  -- Let me know if you have more questions.
>

Lots of thanks for your advises. I'll try to apply them. 
But first I'll take some time to better understand what I want to do. 
Til that moment comes I'm pretty sure I will have more doubts to propose 
you :)

Best regards
Andrea


-- 
____________________________________________________________________________
HydroloGIS - Environmental Open Source Solutions
www.hydrologis.com

Andrea Antonello
Environmental Engineer
mobile:  +393288497722

"Let it be as much a great honour to take as to give learning,
if you want to be called wise."
Skuggsja' - The King's mirror - 1240 Reykjavik
____________________________________________________________________________





More information about the Proj mailing list