Re: Running Java bridge in Envi + IDL mode [message #79908] |
Mon, 16 April 2012 14:08 |
Jim Pendleton
Messages: 165 Registered: November 2011
|
Senior Member |
|
|
On Monday, April 16, 2012 6:41:43 AM UTC-6, Matej Perše wrote:
> On Apr 15, 3:12 am, jimmyleependle...@gmail.com wrote:
>> On Friday, April 13, 2012 4:50:42 AM UTC-6, Matej Perše wrote:
>>> Hi all,
>>
>>> I have a couple of questions regarding Java bridge:
>>
>>> First: I was able to run all my scripts successfully in standard IDL
>>> server mode, however now the guys I work with have added some parts of
>>> the code that also needs ENVI.
>>> I was wondering if any of you has any experience with running the Java/
>>> IDL bridge in ENVI + IDL mode. Is it even possible to do it?
>>
>>> Second: I have tried to run two separate asynchronous java threads
>>> which call 2 different IDL functions. However when I check the
>>> resources the code is always executed in sequence - i.e. one of the
>>> processes always waits for the second one to finish. I have also
>>> checked the processes in the Task Manager and it appears that only one
>>> idl_opserver process is created for both threads. Is there any way/
>>> flag to tell the IDL to start two separate idl_opserver processes
>>> which would run in parallel?
>>
>>> Thanks for the answers,
>>> Matej
>>
>> Good news and bad news. You shouldn't have any problem calling into ENVI functionality via a Java bridge, as long as you have an ENVI license and your !path is set appropriately.
>>
>> Now for the (sort of) bad news. IDL is not thread safe. If you're calling into a single IDL process from multiple external processes, you should strongly consider a MUTEX pattern on the Java side to prevent potential conflicts.
>>
>> Jim P
>
> Thanks for the replay Jim. I have the ENVI license. Could you
> elaborate a bit more on the "path is set appropriately" (sorry, but I
> have only basic IDL knowledge and cannot find anything about the topic
> on the net). Where should I set the path - in IDl? My current path in
> IDL shows the IDL_default path + my local dirs. If I start the IDL +
> ENVI console the paths are the same.
>
> As for the multiple threads, we can go with a single thread. It is
> just that we could manage the resources better if it would be
> possible.
>
> Thanks again,
> Matej
Matej,
Take a look at the ENVI Programming documentation for "ENVI, /RESTORE_BASE_SAVE_FILES" and "ENVI_BATCH_INIT" in version 4.8 or earlier. The IDL environments that you're calling from Java will need to call these initialization routines once per instance to ensure that the ENVI API is properly set up for subsequent calls.
Of course I'm assuming when you say you have ENVI+IDL that you're actually making calls into the ENVI API, such as ENVI_OPEN_DATA_FILE. If you're not actually using ENVI API and are sticking with IDL only, then you don't need to initialize the ENVI environment at all.
Jim P.
|
|
|
Re: Running Java bridge in Envi + IDL mode [message #79915 is a reply to message #79908] |
Mon, 16 April 2012 05:41  |
Matej Perše
Messages: 5 Registered: April 2012
|
Junior Member |
|
|
On Apr 15, 3:12 am, jimmyleependle...@gmail.com wrote:
> On Friday, April 13, 2012 4:50:42 AM UTC-6, Matej Perše wrote:
>> Hi all,
>
>> I have a couple of questions regarding Java bridge:
>
>> First: I was able to run all my scripts successfully in standard IDL
>> server mode, however now the guys I work with have added some parts of
>> the code that also needs ENVI.
>> I was wondering if any of you has any experience with running the Java/
>> IDL bridge in ENVI + IDL mode. Is it even possible to do it?
>
>> Second: I have tried to run two separate asynchronous java threads
>> which call 2 different IDL functions. However when I check the
>> resources the code is always executed in sequence - i.e. one of the
>> processes always waits for the second one to finish. I have also
>> checked the processes in the Task Manager and it appears that only one
>> idl_opserver process is created for both threads. Is there any way/
>> flag to tell the IDL to start two separate idl_opserver processes
>> which would run in parallel?
>
>> Thanks for the answers,
>> Matej
>
> Good news and bad news. You shouldn't have any problem calling into ENVI functionality via a Java bridge, as long as you have an ENVI license and your !path is set appropriately.
>
> Now for the (sort of) bad news. IDL is not thread safe. If you're calling into a single IDL process from multiple external processes, you should strongly consider a MUTEX pattern on the Java side to prevent potential conflicts.
>
> Jim P
Thanks for the replay Jim. I have the ENVI license. Could you
elaborate a bit more on the "path is set appropriately" (sorry, but I
have only basic IDL knowledge and cannot find anything about the topic
on the net). Where should I set the path - in IDl? My current path in
IDL shows the IDL_default path + my local dirs. If I start the IDL +
ENVI console the paths are the same.
As for the multiple threads, we can go with a single thread. It is
just that we could manage the resources better if it would be
possible.
Thanks again,
Matej
|
|
|
Re: Running Java bridge in Envi + IDL mode [message #79920 is a reply to message #79915] |
Sat, 14 April 2012 18:12  |
Jim Pendleton
Messages: 165 Registered: November 2011
|
Senior Member |
|
|
On Friday, April 13, 2012 4:50:42 AM UTC-6, Matej Perše wrote:
> Hi all,
>
> I have a couple of questions regarding Java bridge:
>
> First: I was able to run all my scripts successfully in standard IDL
> server mode, however now the guys I work with have added some parts of
> the code that also needs ENVI.
> I was wondering if any of you has any experience with running the Java/
> IDL bridge in ENVI + IDL mode. Is it even possible to do it?
>
> Second: I have tried to run two separate asynchronous java threads
> which call 2 different IDL functions. However when I check the
> resources the code is always executed in sequence - i.e. one of the
> processes always waits for the second one to finish. I have also
> checked the processes in the Task Manager and it appears that only one
> idl_opserver process is created for both threads. Is there any way/
> flag to tell the IDL to start two separate idl_opserver processes
> which would run in parallel?
>
> Thanks for the answers,
> Matej
Good news and bad news. You shouldn't have any problem calling into ENVI functionality via a Java bridge, as long as you have an ENVI license and your !path is set appropriately.
Now for the (sort of) bad news. IDL is not thread safe. If you're calling into a single IDL process from multiple external processes, you should strongly consider a MUTEX pattern on the Java side to prevent potential conflicts.
Jim P
|
|
|