I have a class(MapLoader) which loads a map.
public class MapLoader{
statci Map aMap;
static{
//does some processing to load this map
}
This map is being used by two different jobs which runs parallely. These jobs are unix batch jobs which calls two different jar files.
Jar 1:
public class ABC{
public static void main(String args[]){
//uses MapLoader.aMap
}
Jar 2:
public class XYZ{
public static void main(String args[]){
//uses MapLoader.aMap
}
These jar files uses that map of class MapLoader.
Is there any way only one instance of MapLoader is created by both processes. Kindly suggest.
**Kindly ignore java syntax if any, I just wrote the code for explaining my issue.