jaxws/src/share/jaf_classes/javax/activation/MailcapCommandMap.java
changeset 23959 f37ffa18553c
parent 22678 ac1ea46be942
child 25840 c2002453eec3
equal deleted inserted replaced
23816:b47e02119575 23959:f37ffa18553c
   118  */
   118  */
   119 
   119 
   120 public class MailcapCommandMap extends CommandMap {
   120 public class MailcapCommandMap extends CommandMap {
   121     /*
   121     /*
   122      * We manage a collection of databases, searched in order.
   122      * We manage a collection of databases, searched in order.
   123      * The default database is shared between all instances
   123      */
   124      * of this class.
       
   125      * XXX - Can we safely share more databases between instances?
       
   126      */
       
   127     private static MailcapFile defDB = null;
       
   128     private MailcapFile[] DB;
   124     private MailcapFile[] DB;
   129     private static final int PROG = 0;  // programmatically added entries
   125     private static final int PROG = 0;  // programmatically added entries
   130 
   126 
   131     /**
   127     /**
   132      * The default Constructor.
   128      * The default Constructor.
   162         LogSupport.log("MailcapCommandMap: load JAR");
   158         LogSupport.log("MailcapCommandMap: load JAR");
   163         // load from the app's jar file
   159         // load from the app's jar file
   164         loadAllResources(dbv, "META-INF/mailcap");
   160         loadAllResources(dbv, "META-INF/mailcap");
   165 
   161 
   166         LogSupport.log("MailcapCommandMap: load DEF");
   162         LogSupport.log("MailcapCommandMap: load DEF");
   167         synchronized (MailcapCommandMap.class) {
   163         mf = loadResource("/META-INF/mailcap.default");
   168             // see if another instance has created this yet.
   164 
   169             if (defDB == null)
   165         if (mf != null)
   170                 defDB = loadResource("/META-INF/mailcap.default");
   166             dbv.add(mf);
   171         }
       
   172 
       
   173         if (defDB != null)
       
   174             dbv.add(defDB);
       
   175 
   167 
   176         DB = new MailcapFile[dbv.size()];
   168         DB = new MailcapFile[dbv.size()];
   177         DB = (MailcapFile[])dbv.toArray(DB);
   169         DB = (MailcapFile[])dbv.toArray(DB);
   178     }
   170     }
   179 
   171