I went around this topic a lot, but all I could find was related to connecting to the database, etc.
I am creating a web service that downloads a Shapefile and uses the GeoTools library to make some funky files based on location. What I would like to do is load the Shapefile once, get all the “functions” in memory for the Shapefile, and then just be able to check this collection every time - note that a huge amount of shapefile files are currently loaded.
I wrapped my Geo-based material in the class by loading shapefiles into the collection when I instantiated the class. My @WebService class checks to see if myGeoClass is created, otherwise it creates it and loads the files into memory. These files never change, so I would like to keep the same instance of the object between several requests, but I added some traces and it seems to create a new instance with each request.
Is there a way to keep one instance in memory common to all requests?
Hooray!
source share