Package org.exoplatform.services.jcr.impl.util.io

Examples of org.exoplatform.services.jcr.impl.util.io.SpoolFile.acquire()


      int read = 0;

      try
      {
         SpoolFile sf = SpoolFile.createTempFile("jcrvd", null, tempDirectory);
         sf.acquire(this);
         sfout = new FileOutputStream(sf);

         while ((read = tmpStream.read(tmpBuff)) >= 0)
            sfout.write(tmpBuff, 0, read);
View Full Code Here


            else if (len + read > maxBufferSize && fileCleaner != null)
            {
               // threshold for keeping data in memory exceeded,
               // if have a fileCleaner create temp file and spool buffer contents.
               sf = SpoolFile.createTempFile("jcrvd", null, tempDirectory);
               sf.acquire(this);

               sfout = new FileOutputStream(sf);
               sfout.write(buffer, 0, len);
               sfout.write(tmpBuff, 0, read);
               buffer = null;
View Full Code Here

         int read = 0;

         try
         {
            SpoolFile sf = SpoolFile.createTempFile("jcrvd", null, tempDirectory);
            sf.acquire(this);
            sfout = new FileOutputStream(sf);

            while ((read = tmpStream.read(tmpBuff)) >= 0)
               sfout.write(tmpBuff, 0, read);
View Full Code Here

               else if (len + read > maxBufferSize && fileCleaner != null)
               {
                  // threshold for keeping data in memory exceeded,
                  // if have a fileCleaner create temp file and spool buffer contents.
                  sf = SpoolFile.createTempFile("jcrvd", null, tempDirectory);
                  sf.acquire(this);

                  sfout = new FileOutputStream(sf);
                  sfout.write(buffer, 0, len);
                  sfout.write(tmpBuff, 0, read);
                  buffer = null;
View Full Code Here

         int read = 0;

         try
         {
            SpoolFile sf = SpoolFile.createTempFile("jcrvd", null, tempDirectory);
            sf.acquire(this);
            sfout = new FileOutputStream(sf);

            while ((read = tmpStream.read(tmpBuff)) >= 0)
               sfout.write(tmpBuff, 0, read);
View Full Code Here

               else if (len + read > maxBufferSize && fileCleaner != null)
               {
                  // threshold for keeping data in memory exceeded,
                  // if have a fileCleaner create temp file and spool buffer contents.
                  sf = SpoolFile.createTempFile("jcrvd", null, tempDirectory);
                  sf.acquire(this);

                  sfout = new FileOutputStream(sf);
                  sfout.write(buffer, 0, len);
                  sfout.write(tmpBuff, 0, read);
                  buffer = null;
View Full Code Here

            else if (len + read > spoolConfig.maxBufferSize)
            {
               // threshold for keeping data in memory exceeded,
               // if have a fileCleaner create temp file and spool buffer contents.
               sf = SpoolFile.createTempFile("jcrvd", null, spoolConfig.tempDirectory);
               sf.acquire(this);

               sfout = PrivilegedFileHelper.fileOutputStream(sf);

               sfout.write(buffer, 0, len);
               sfout.write(tmpBuff, 0, read);
View Full Code Here

   public void testAcquireFile() throws FileNotFoundException
   {
      SpoolFile sf = new SpoolFile(DIR_NAME + FILE_NAME);

      // Add new holder of file, now file must be in use.
      sf.acquire("holder");
      assertTrue("File must be in use.", sf.inUse());

      sf.release("holder");
      sf.delete();
View Full Code Here

      sf.delete();

      // Use non-existent file.
      try
      {
         sf.acquire("anotherHolder");
         fail("FileNotFoundException should have been thrown.");
      }
      catch (FileNotFoundException e)
      {
         // Ok.
View Full Code Here

   public void testReleaseFile() throws FileNotFoundException
   {
      SpoolFile sf = new SpoolFile(DIR_NAME + FILE_NAME);

      // Add new holder of file.
      sf.acquire("holder");

      // Release file from holder.
      sf.release("holder");

      assertFalse("File should not have holders.", sf.inUse());
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.