|
View:
New views
5 Messages
—
Rating Filter:
Alert me
|
|
|
Surviving Grails reload
Hi,
I like Grails reloading feature, but I have a problem with one of my applications. Unfortunately, I have to use a shared library, loaded with JNI in my application. Currently, I load it in the static section of a class, so that it is read only once. Like this: class MyLibrary { static { System.load("libmybrary.so"); } } But when the application is reloaded I get a java.lang.UnsatisfiedLinkError because the library is already loaded. It stops the reloading process and my application ends up in a state where nothing works (no database...). Do you see any mean to do my load() in way that would prevent my application from crashing on reload? I could catch exceptions launched by load, but I do not like this, I still want to see the true errors. --
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email
Antoine Roux NetVitesse Phone: +33 (0)1 61 37 04 24 Mobile: +33 (0)6 20 69 07 96 |
|
|
Re: Surviving Grails reloadOn 04/11/2009, at 12:10 AM, Antoine Roux wrote: > Hi, > I like Grails reloading feature, but I have a problem with one of my > applications. Unfortunately, I have to use a shared library, loaded > with JNI in my application. Currently, I load it in the static > section of a class, so that it is read only once. Like this: > > class MyLibrary { > static { > System.load("libmybrary.so"); > } > } > > But when the application is reloaded I get a > java.lang.UnsatisfiedLinkError because the library is already > loaded. It stops the reloading process and my application ends up in > a state where nothing works (no database...). > Do you see any mean to do my load() in way that would prevent my > application from crashing on reload? > I could catch exceptions launched by load, but I do not like this, I > still want to see the true errors. Does your library need to load that early? Also, is there any kind of check you can do to see if it's already loaded? --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
|
Re: Surviving Grails reloadI can try to load my library later, but that will not be much later, and
it will crash anyway when the server is reloaded. I searched but I did not find a way to know whether a library is already loaded. That would be a solution if it exists. Luke Daley a écrit : > > On 04/11/2009, at 12:10 AM, Antoine Roux wrote: > >> Hi, >> I like Grails reloading feature, but I have a problem with one of my >> applications. Unfortunately, I have to use a shared library, loaded >> with JNI in my application. Currently, I load it in the static >> section of a class, so that it is read only once. Like this: >> >> class MyLibrary { >> static { >> System.load("libmybrary.so"); >> } >> } >> >> But when the application is reloaded I get a >> java.lang.UnsatisfiedLinkError because the library is already loaded. >> It stops the reloading process and my application ends up in a state >> where nothing works (no database...). >> Do you see any mean to do my load() in way that would prevent my >> application from crashing on reload? >> I could catch exceptions launched by load, but I do not like this, I >> still want to see the true errors. > > Does your library need to load that early? > > Also, is there any kind of check you can do to see if it's already > loaded? > > --------------------------------------------------------------------- > To unsubscribe from this list, please visit: > > http://xircles.codehaus.org/manage_email > > --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
|
Re: Surviving Grails reloadAntoine Roux wrote:
> Hi, > I like Grails reloading feature, but I have a problem with one of my > applications. Unfortunately, I have to use a shared library, loaded with > JNI in my application. Currently, I load it in the static section of a > class, so that it is read only once. Like this: > > class MyLibrary { > static { > System.load("libmybrary.so"); > } > } > > But when the application is reloaded I get a > java.lang.UnsatisfiedLinkError because the library is already loaded. If you put the library-loading code into a class in a JAR file in your application's lib directory rather than in a class in your project's source directories then it would work OK, as lib JARs aren't subject to reloading. Alternatively you could maybe put this somwehere in _Events.groovy if you can find an appropriate event that gets fired the first time the app starts up but not on reload. You'd still have to have the System.load call in the usual place for production mode, but you can condition using grails.util.Environment if necessary. Ian -- Ian Roberts | Department of Computer Science i.roberts@... | University of Sheffield, UK --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
|
Re: Surviving Grails reload
Thank you very much Ian. I will try the JAR solution I guess, it looks
quite simple to implement. If it does not work I will look at the
_Events solution, but it looks less reliable.
Antoine Ian Roberts a écrit : --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_emailAntoine Roux wrote: |
| Free embeddable forum powered by Nabble | Forum Help |