Jump to content
Excelsior Forums
Sign in to follow this  
ALESSANDRO.MOREIRA

share native complilation

Recommended Posts

Hello,

The code and data in executables and dynamic libraries (DLL/.so) produced by Excelsior JET are shared among different processes, so you need not do anything special for it.

Regards.

Share this post


Link to post
Share on other sites

My test application is a Java Swing and It runs on a terminal server. I want that the application to be share among the user, without create a new instance to each one. In memory will have just one application been shared.

I don't know if I make me clear! If not I try to tell another way.

Thanks for helping!

Share this post


Link to post
Share on other sites

Regards,

We need to compile Java application natively for optimizing memory consumption and share code.

As We use Terminal service (LTSP) we have many clients hang on the server and there are several instance of Java application been loaded. Therefore each instance is a new Java application duplicating the memory consumption. it makes impracticable! Thus, we are experimenting Excelsior JET for compile Java Natively.

Excelsior Jet Tutorial in "Dynamic Linking" chapter says that:

a)  "... components are shared between processes, that is, only one copy of code and constant data from a DLL is load into memory".

B)  "Java 2 API is shared between the process established by JET-Compiled executables. ...This effectively means that you already have a JVM  capable of sharing constant data and code between several running Java".

As in our application we use third-party Java API, I choosed for building multi-component applications.

After all steps are followed, I hoped to get an native application sharing code and DLL, but I don't. Every time I invoked a new instance it was created a whole new application comsuption the same memory quantity of another.

Our objective is to get an native application like OpenOffice, which we can open several instance but there is just one running and being shared.

To test I made use of JGoodies Forms and Looks library like third-party one.

Projects builded:

-------------------

1. Looks.prj {Lib - component}

%Looks Dynamic Lib Project

+NOLAUNCHPAD

-OUTPUTNAME=looks

-GENDLL+

-CLASSABSENCE=HANDLE

-IGNOREMEMBERABSENCE+

-LOOKUP=*.sym=./sym_$(outputname)

-LOOKUP=*.rdf=./rdf_$(outputname)

-LOOKUP=*.bod=./bod_$(outputname)

-LOOKUP=*.obj=./obj_$(outputname)

-LOOKUP=*.jar=./lib

!CLASSPATHENTRY looks-2.0.4.jar

-PACK=NONCOMPILED

-OPTIMIZE=ALL

-PROTECT=NOMATTER

!END

---------------------------------------

2. Forms.prj {Lib - component}

%Forms Dynamic Lib Project

+NOLAUNCHPAD

-OUTPUTNAME=forms

-GENDLL+

-CLASSABSENCE=HANDLE

-IGNOREMEMBERABSENCE+

-LOOKUP=*.sym=./sym_$(outputname)

-LOOKUP=*.rdf=./rdf_$(outputname)

-LOOKUP=*.bod=./bod_$(outputname)

-LOOKUP=*.obj=./obj_$(outputname)

-LOOKUP=*.jar=./lib

!CLASSPATHENTRY forms-1.0.7.jar

-PACK=NONCOMPILED

-OPTIMIZE=ALL

-PROTECT=NOMATTER

!END

--------------------------------

3. Slice.prj {Executable}

%Slice Executable Project

+NOLAUNCHPAD

-OUTPUTNAME=Slice

-CLASSABSENCE=HANDLE

-IGNOREMEMBERABSENCE+

-LOOKUP=*.sym=./sym_$(outputname)

-LOOKUP=*.rdf=./rdf_$(outputname)

-LOOKUP=*.bod=./bod_$(outputname)

-LOOKUP=*.obj=./obj_$(outputname)

-LOOKUP=*.jar=.

-MAIN=br/com/flf/linguagens/Slice

!CLASSPATHENTRY Slice.jar

-PACK=NONCOMPILED

-OPTIMIZE=ALL

-PROTECT=NOMATTER

!END

-----------------------------------------

JET Command for compilation: (in order)

# jc =p Looks.prj --> Looks.so

# jc =p Forms.prj --> Forms.so

# jc =p Slice.prj --> Slice

Linux commands and yours results are below:

Testing several OpenOffice instances*.

# oowriter &

# oowriter &

# oowriter &

# oowriter &

# oowriter &

# ps -u user uf | grep openoffice

Result:

CPU%  Memory%

1074      5317  8.7  2.8 170448 58980 pts/9    Sl  10:13  0:06  \_ /usr/lib/openoffice.org2.0/program/swriter.bin -writer

-----------------------------------------------

Testing several Jet application instances*.

# ./Slice

# ./Slice

# ./Slice

# ./Slice

# ./Slice

# ps -u user uf | grep Slice

Result:

        CPU% Memory%

1074      3086 0.4  2.0 365336 42164 pts/9    Sl  09:43  0:06      \_ ./Slice

1074      3110  0.4  2.4 365364 50892 pts/9    Sl  09:43  0:05      \_ ./Slice

1074      3129  0.5  2.4 364340 50928 pts/9    Sl  09:44  0:07      \_ ./Slice

1074      3140  0.5  2.5 366224 52092 pts/9    Sl  09:44  0:07      \_ ./Slice

1074      3152  0.6  2.5 366184 52056 pts/9    Sl  09:44  0:08      \_ ./Slice

--------------------------------------

Testing Sun Java results:

CPU%  Memory%

1074      4663  1.3  1.1 277012 24488 pts/9    Sl  10:04  0:00      \_ java -jar slice.jar

1074      4689  1.8  1.1 276520 24436 pts/9    Sl  10:05  0:01      \_ java -jar slice.jar

1074      4703  2.1  1.1 275980 24508 pts/9    Sl  10:05  0:01      \_ java -jar slice.jar

1074      4713  1.7  1.1 276020 24360 pts/9    Sl  10:05  0:01      \_ java -jar slice.jar

1074      4735  1.6  1.1 277012 24432 pts/9    Sl  10:05  0:00      \_ java -jar slice.jar

------------------------------------------------------

* System Monitor program was used to get the memory results.

Exculse-me for going at this point, but it is very important to us. And I'd really enjoy your help. If I'm not been clear, please ask me for any clarification or doubts. I'm strengthening to resolve this situation and get your product.

More one time, thanks for helping!!!

Alessandro Moreira - Brasil, Aspec S/A.

Share this post


Link to post
Share on other sites

I am very sad! It is a so important doubt e after so many time, no answer!

Even though I am trying to resolve styding the guide because I don't find examples in the NET. It was almost a month I am trying to really compile a java application without load new instances but sharing it and I have not sucessed.

Thus I sorry for my relief, but I sure it is too much important to us here.

Alessandro Moreira, Aspec S/A.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×