Package nexj.core.util

Examples of nexj.core.util.Binary


               istream.read(nVersionCodeArray);

               if (Binary.compare(nVersionCodeArray, JOURNAL_VERSION) != 0)
               {
                  throw new JournalManagementException("err.rpc.file.versionMismatch",
                     new Object[]{new Binary(JOURNAL_VERSION).toString(),
                        new Binary(nVersionCodeArray).toString(),
                        journalDirectory.getAbsolutePath()});
               }
            }
            else
            {
               m_journal.writeData(new Binary(JOURNAL_VERSION));
            }
         }
         catch (IOException ex)
         {
            throw new JournalManagementException("err.rpc.file.journalIoErr",
View Full Code Here


      ObjectOutputStream oos = null;

      try
      {
         m_compactionJournal.truncate();
         m_compactionJournal.writeData(new Binary(JOURNAL_VERSION));
        
         OutputStream ostream = m_compactionJournal.getOutputStream();
         oos = new ObjectOutputStream(ostream);
         int nPreservedCount = 0;
         int nDiscardedCount = 0;
         RecordIterator itr = new RecordIterator(m_journal);
        
         while (itr.hasNext())
         {
            GenericJournalRecord currentRec = (GenericJournalRecord)itr.next();
            Xid currentXid = currentRec.getXid();
           
            if (m_activeXids.contains(currentXid) || m_indoubtXids.contains(currentXid))
            {
               nPreservedCount++;
               oos.writeObject(currentRec);
            }
            else
            {
               nDiscardedCount++;
            }
         }
        
         itr.close();
        
         //Finish writing new journal, ensuring that records have been written to disk
         oos.writeObject(null);
         oos.flush();
        
         //Swap the journal pointer on-disk
         writeActiveJournalPointer((m_compactionJournalFile.getName().equals(JOURNAL_FILE1_NAME)) ? (byte)1 : (byte)2);
        
         //Clears the old journal (must be done *after* swapping journal pointer on-disk)
         m_journal.writeData(new Binary(JOURNAL_VERSION));
        
         if (s_logger.isDebugEnabled())
         {
            s_logger.debug("Compaction done: " + nDiscardedCount + " records discarded, " + nPreservedCount + " preserved.");
         }
View Full Code Here

         oos.writeObject(completionRecord);
         oos.writeObject(null);
         oos.close();

         m_journal.appendData(new Binary(byteOStream.toByteArray()));
         m_journal.force();
      }
      catch (IOException ex)
      {
         throw new JournalManagementException("err.rpc.file.journalIoErr",
View Full Code Here

            oos.writeObject(recordArray[i]);
         }
        
         oos.writeObject(null);
         oos.close();
         m_journal.appendData(new Binary(byteOStream.toByteArray()));
         m_journal.force();
      }
      catch (IOException ex)
      {
         throw new JournalManagementException("err.rpc.file.journalIoErr",
View Full Code Here

      catch (IOException e)
      {
         throw new IntegrationException("err.integration.io", e);
      }

      return new Binary(ostream.toByteArray());
   }
View Full Code Here

   {
      if (m_obj == null)
      {
         if (m_ostream != null && !m_bWriter)
         {
            m_obj = new Binary(((ByteArrayOutputStream)m_ostream).toByteArray());
         }
         else if (m_writer != null)
         {
            m_obj = m_writer.toString();
         }
View Full Code Here

     
      if (m_obj instanceof String)
      {
         try
         {
            return new Binary(((String)m_obj).getBytes(m_sEncoding));
         }
         catch (UnsupportedEncodingException e)
         {
            throw new IntegrationException("err.integration.io", e);
         }
View Full Code Here

            {
               buf = new byte[8192];
            }

            IOUtil.copy(ostream, multipartStream, buf);
            paramMap.put(sName, new Binary(ostream.toByteArray()));
            paramMap.put(sName + ".filename", sFileName);
         }
      }
   }
View Full Code Here

      else // unknown content
      {
         ByteArrayOutputStream os = new ByteArrayOutputStream(part.getSize());

         part.getDataHandler().writeTo(os);
         body = new Binary(os.toByteArray());
      }

      TransferObject content = new TransferObject();

      content.setValue(Mail.FILENAME, part.getFileName());
View Full Code Here

      if (s_logger.isDumpEnabled())
      {
         s_logger.dump("Acquiring semaphore " + semaphoreDef);
      }

      final Binary resource = (Binary)semaphoreDef.getHead();
      boolean bAcquired = incrementSemaphore(resource, (Number)semaphoreDef.getTail());

      if (s_logger.isDumpEnabled())
      {
         s_logger.dump((bAcquired) ? "Acquired" : "Not acquired");
View Full Code Here

TOP

Related Classes of nexj.core.util.Binary

Copyright © 2018 www.massapicom. 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.