equal
deleted
inserted
replaced
125 * A multi-threaded application should either allocate multiple |
125 * A multi-threaded application should either allocate multiple |
126 * packer engines, or else serialize use of one engine with a lock. |
126 * packer engines, or else serialize use of one engine with a lock. |
127 * |
127 * |
128 * @return A newly allocated Packer engine. |
128 * @return A newly allocated Packer engine. |
129 */ |
129 */ |
130 public synchronized static Packer newPacker() { |
130 public static synchronized Packer newPacker() { |
131 return (Packer) newInstance(PACK_PROVIDER); |
131 return (Packer) newInstance(PACK_PROVIDER); |
132 } |
132 } |
133 |
133 |
134 |
134 |
135 /** |
135 /** |
686 private static final String UNPACK_PROVIDER = "java.util.jar.Pack200.Unpacker"; |
686 private static final String UNPACK_PROVIDER = "java.util.jar.Pack200.Unpacker"; |
687 |
687 |
688 private static Class<?> packerImpl; |
688 private static Class<?> packerImpl; |
689 private static Class<?> unpackerImpl; |
689 private static Class<?> unpackerImpl; |
690 |
690 |
691 private synchronized static Object newInstance(String prop) { |
691 private static synchronized Object newInstance(String prop) { |
692 String implName = "(unknown)"; |
692 String implName = "(unknown)"; |
693 try { |
693 try { |
694 Class<?> impl = (PACK_PROVIDER.equals(prop))? packerImpl: unpackerImpl; |
694 Class<?> impl = (PACK_PROVIDER.equals(prop))? packerImpl: unpackerImpl; |
695 if (impl == null) { |
695 if (impl == null) { |
696 // The first time, we must decide which class to use. |
696 // The first time, we must decide which class to use. |