Use existing c++ dll in Web Application

Hi, i have a existing system in c++.
I have Many not thread safe dll´s.
I want to call them from my java web application.

Is there a better way to then use SingleThreadModel and isThreadSafe = "false"?

Is there a better way than copying, renaming and reloading the dll for every user?

I can´t make the dll´s thread safe. this would take me too long. (very much code to check)
the SingleThreadModel would be to slow (yes, i tried it :-( )

creating a new process with Runtime and connect to it with rmi is also too slow (i also tried that :-( )
LVL 5
Koma666Asked:
Who is Participating?
 
moduloConnect With a Mentor Commented:
PAQed with points refunded (250)

modulo
Community Support Moderator
0
 
petmagdyCommented:
Hello I have a suggestion that may help:

1- Create a Single Tone Java Class to wrap the Native DLL APIs and make all the methods synchronized

the single tone class looks like this:

class MySingleTone
{
 
  private static MySingleTone instance = null;

  private MySingleTone()
  {
     // Initialize
  }
 
   public static MySingleTone getInstance()
   {
     if(instance == null)
     {
        instance = MySingleTone();
     }
     return instance;
   }

   public synchronized callDllMethod()
   {
     // call ur DLL functions
   }

}
0
 
Koma666Author Commented:
I can´t do that.
The dll has to be initiated for every user.
It´ll crash if i use one instance for all users.
0
 
Koma666Author Commented:
I found a way
I found a way to speed up the single thread model by using more cach funktions.
So it´s not the best way but it´s fast enough to use it.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.