jdk/src/share/classes/com/sun/java/util/jar/pack/PackerImpl.java

Print this page
rev 5675 : 7186946: Refine unpacker resource usage
Reviewed-by: jrose, jjh, mschoene

@@ -82,11 +82,11 @@
      * Closes its input but not its output.  (Pack200 archives are appendable.)
      * @param in a JarFile
      * @param out an OutputStream
      * @exception IOException if an error is encountered.
      */
-    public void pack(JarFile in, OutputStream out) throws IOException {
+    public synchronized void pack(JarFile in, OutputStream out) throws IOException {
         assert(Utils.currentInstance.get() == null);
         TimeZone tz = (props.getBoolean(Utils.PACK_DEFAULT_TIMEZONE))
                       ? null
                       : TimeZone.getDefault();
         try {

@@ -117,11 +117,11 @@
      * @see #DEFLATION_HINT
      * @param in a JarInputStream
      * @param out an OutputStream
      * @exception IOException if an error is encountered.
      */
-    public void pack(JarInputStream in, OutputStream out) throws IOException {
+    public synchronized void pack(JarInputStream in, OutputStream out) throws IOException {
         assert(Utils.currentInstance.get() == null);
         TimeZone tz = (props.getBoolean(Utils.PACK_DEFAULT_TIMEZONE)) ? null :
             TimeZone.getDefault();
         try {
             Utils.currentInstance.set(this);