Writes an object to hardened storage, but may return before the write completes.

@param managedObject to be written.
@throws ObjectManagerException
355229
private void write(ManagedObject managedObject)
                    throws ObjectManagerException
    {
        final String methodName = "write";
        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.entry(this,
                        cclass,
                        methodName,
                        new Object[] { managedObject });

        // Pick up and write the latest serialized bytes.
        ObjectManagerByteArrayOutputStream serializedBytes = null;
        if (usesSerializedForm) {
            // Pick up and write the latest serialized bytes.

            // It is possible that several threads requested a write one after the
            // other each getting the request added to a different managedObjetsToWrite table,
            // however the first of these through here will clear serializedBytes.
            // It is also possible that the transaction state of the managed object
            // was restored from a checkpoint, in which case the serialized object
            // may already be in the ObjectStore, and the serializedBytes will again be null.

            // Is the Object deleted? It may have got deleted after we release the
            // synchronize lock when we
            // captured the tokensToWrite hashtable but before we actually try to write it.
            if (managedObject.state != ManagedObject.stateDeleted)
                serializedBytes = managedObject.freeLatestSerializedBytes();

        } else {
            // Not logged so use the current serialized bytes, as long as its not part of a transaction.
            // If it is part of a transaction then the transaction will hold the ManagedObject in memory.
            // Not locked because this is only used by SAVE_ONLY_ON_SHUTDOWN stores at shutdown
            // when no appliaction threads are active.
            if (managedObject.state == ManagedObject.stateReady)
                serializedBytes = managedObject.getSerializedBytes();
        } // if ( usesSerializedForm ).

        // It is possible that several threads requested a write one after the other each getting the request added
        // to a different tokensToWrite table, however the first of these through here will clear serializedBytes.
        if (serializedBytes != null) { // Already done by another thread?
            try {
                java.io.FileOutputStream storeFileOutputStream = new java.io.FileOutputStream(storeDirectoryName
                                                                                              + java.io.File.separator
                                                                                              + managedObject.owningToken.storedObjectIdentifier);
                storeFileOutputStream.write(serializedBytes.getBuffer(), 0, serializedBytes.getCount());
                storeFileOutputStream.flush();
                storeFileOutputStream.close();

            } catch (java.io.IOException exception) {
                // No FFDC Code Needed.
                ObjectManager.ffdc.processException(this,
                                                    cclass,
                                                    methodName,
                                                    exception,
                                                    "1:656:1.17");

                if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
                    trace.exit(this,
                               cclass,
                               methodName,
                               new Object[] { exception });
                throw new PermanentIOException(this,
                                               exception);
            } // catch java.io.IOException.

            managedObjectsOnDisk.add(new Long(managedObject.owningToken.storedObjectIdentifier));
        } // if (serializedBytes != null ).

        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.exit(this,
                       cclass,
                       methodName);
    }
102291
private void writeObject(ObjectOutputStream out) throws IOException {
		super.write(out);
		out.writeUTF(mapredOutputFormat.getClass().getName());
		jobConf.write(out);
	}
1031880
public void write(ObjectWriter out, ItemState itemState) throws IOException
   {
      // write id
      out.writeInt(SerializationConstants.ITEM_STATE);

      out.writeInt(itemState.getState());
      out.writeBoolean(itemState.isPersisted());
      out.writeBoolean(itemState.isEventFire());

      if (itemState.getOldPath() == null)
      {
         out.writeInt(SerializationConstants.NULL_DATA);
      }
      else
      {
         out.writeInt(SerializationConstants.NOT_NULL_DATA);
         byte[] buf = itemState.getOldPath().getAsString().getBytes(Constants.DEFAULT_ENCODING);
         out.writeInt(buf.length);
         out.write(buf);
      }

      // write flag isNodeData and ItemData
      ItemData data = itemState.getData();

      boolean isNodeData = (data instanceof PersistedNodeData);
      out.writeBoolean(isNodeData);
      if (isNodeData)
      {
         PersistedNodeDataWriter wr = new PersistedNodeDataWriter();
         wr.write(out, (PersistedNodeData)data);
      }
      else
      {
         PersistedPropertyDataWriter wr = new PersistedPropertyDataWriter();
         wr.write(out, (PersistedPropertyData)data);
      }
   }
961929
public synchronized void close()
                    throws ObjectManagerException
    {
        // Invalidate out all ManagedObjects in inMemory Tokens to prevent them
        // from being used after shutdown.
        for (java.util.Iterator tokenIterator = inMemoryTokens.values().iterator(); tokenIterator.hasNext();) {
            java.lang.ref.Reference reference = (java.lang.ref.Reference) tokenIterator.next();
            if (reference != null) {
                Token token = (Token) reference.get();
                if (token != null)
                    token.invalidate();
            } // if (reference != null).
        } // for inMemoryTokens.

        // Help garbage collection. 
        inMemoryTokens.clear();
        inMemoryTokens = null;
    }
67791
@Override
  public void writeImpl(ObjectStoreOperation operation) throws IOException {
    operation.execute(this.getObjectStoreClient());
    this.operationsExecuted.inc();
  }
5601
@Override
    public void writeObject(Object object)
        throws IOException
    {
        if (object == null) {
            writeNull();
            return;
        }

        Serializer serializer = findSerializerFactory().getObjectSerializer(object.getClass());

        serializer.writeObject(object, this);
    }
940572
private void writeObject(java.io.ObjectOutputStream out) throws IOException
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            Tr.entry(tc, "writeObject : " + this); // d468174

        out.writeObject(ivPuRefId);
        out.writeObject(ivJ2eeName); // d510184
        out.writeObject(ivRefName); // d510184
        out.writeObject(ivProperties);
        out.writeBoolean(ivUnsynchronized);

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            Tr.exit(tc, "writeObject : " + this);
    }
370774
public void writeObject(DataOutputStream dataOutputStream) throws ObjectManagerException, IOException
    {
        super.writeObject(dataOutputStream);

        // Write out our serialVersionUID
        dataOutputStream.writeLong(serialVersionUID);

        if (_dataSlices != null)
        {
            // Write the number of slices we have
            dataOutputStream.writeInt(_dataSlices.size());
    
            // Write each slice out
            for (DataSlice slice : _dataSlices)
            {
                dataOutputStream.writeInt(slice.getLength());
                dataOutputStream.write(slice.getBytes(), slice.getOffset(), slice.getLength());
            }
        }
        else
        {
            // We have no slices so just write a 
            // zero so we don't try to read any in
            // at readObject time.
            dataOutputStream.writeInt(0);
        }
    }
1355548
public void writeObjects(boolean reuse) throws TransactionAbortedException, LockNotGrantedException
    {
        PersistenceBroker broker = transaction.getBroker();
        ConnectionManagerIF connMan = broker.serviceConnectionManager();
        boolean saveBatchMode = connMan.isBatchMode();

        try
        {
            if(log.isDebugEnabled())
            {
                log.debug(
                        "PB is in internal tx: "
                                + broker.isInTransaction()
                                + "  broker was: "
                                + broker);
            }
            // all neccessary db operations are executed within a PersistenceBroker transaction:
            if(!broker.isInTransaction())
            {
                log.error("PB associated with current odmg-tx is not in tx");
                throw new TransactionAbortedException("Underlying PB is not in tx, was begin call done before commit?");
            }

            // Committing has to be done in two phases. First implicitly upgrade to lock on all related
            // objects of objects in this transaction. Then the list of locked objects has to be
            // reordered to solve referential integrity dependencies, then the objects are
            // written into the database.

            // 0. turn on the batch mode
            connMan.setBatchMode(true);

            // 1. mark objects no longer available in collection
            // for delete and add new found objects
            checkAllEnvelopes(broker);

            // 2. mark all dependend objects for cascading insert/delete
            cascadingDependents();

            // 3. upgrade implicit locks.
            //upgradeImplicitLocksAndCheckIfCommitIsNeeded();
            upgradeLockIfNeeded();

            // 4. Reorder objects
            reorder();
//            System.out.println("## ordering: ");
//            for(int i = 0; i < mvOrderOfIds.size(); i++)
//            {
//                System.out.println("" + mvOrderOfIds.get(i));
//            }
//            System.out.println("## ordering end");

            // 5. write objects.
            writeAllEnvelopes(reuse);

            // 6. execute batch
            connMan.executeBatch();

            // 7. Update all Envelopes to new CleanState
            prepareForReuse(reuse);

            // 6. commit cleanup
            afterWriteCleanup();

        }
        catch(Exception e)
        {
            connMan.clearBatch();
            /*
            arminw:
            log only a warn message, because in top-level methods
            a error log will be done ditto
            */
            if(e instanceof OptimisticLockException)
            {
                // make error log to show the full stack trace one time
                log.error("Optimistic lock exception while write objects", e);
                // PB OptimisticLockException should be clearly signalled to the user
                Object sourceObject = ((OptimisticLockException) e).getSourceObject();
                throw new LockNotGrantedException("Optimistic lock exception occur, source object was (" + sourceObject + ")," +
                        " message was (" + e.getMessage() + ")");
            }
            else if(!(e instanceof RuntimeException))
            {
                log.warn("Error while write objects for tx " + transaction, e);
                throw new ODMGRuntimeException("Unexpected error while write objects: " + e.getMessage());
            }
            else
            {
                log.warn("Error while write objects for tx " + transaction, e);
                throw (RuntimeException) e;
            }
        }
        finally
        {
            needsCommit = false;
            connMan.setBatchMode(saveBatchMode);
        }
    }
845389
public void write(ObjectWriter out, PersistedValueData vd) throws IOException
   {
      out.writeInt(SerializationConstants.PERSISTED_VALUE_DATA);
      out.writeInt(vd.getOrderNumber());

      boolean isByteArray = vd.isByteArray();
      out.writeBoolean(isByteArray);

      if (isByteArray)
      {
         byte[] data = vd.getAsByteArray();
         out.writeInt(data.length);
         out.write(data);
      }
      else
      {
         // write file content
         FilePersistedValueData streamed = (FilePersistedValueData)vd;

         InputStream in = null;

         if (streamed.getFile() == null && vd instanceof StreamPersistedValueData)
         {
            if (((StreamPersistedValueData)vd).getTempFile() != null)
            {
               in = PrivilegedFileHelper.fileInputStream(((StreamPersistedValueData)vd).getTempFile());
            }
         }
         else
         {
            in = streamed.getAsStream();
         }

         if (streamed.getFile() instanceof SerializationSpoolFile)
         {
            SerializationSpoolFile ssf = (SerializationSpoolFile)streamed.getFile();
            out.writeString(ssf.getId());
            out.writeLong(0);
         }
         else
         {
            // write property id - used for reread data optimization
            String id = IdGenerator.generate();
            out.writeString(id);

            if (in == null)
            {
               // Deleted state usecase
               out.writeLong(SerializationConstants.NULL_FILE);
            }
            else
            {
               out.writeLong(vd.getLength());
               try
               {
                  byte[] buf = new byte[SerializationConstants.INTERNAL_BUFFER_SIZE];
                  int l = 0;
                  while ((l = in.read(buf)) >= 0)
                  {
                     out.write(buf, 0, l);
                  }
               }
               finally
               {
                  in.close();
               }
            }
         }
      }
   }
353549
public void readObject(java.io.DataInputStream dataInputStream,
                           ObjectManagerState objectManagerState)
                    throws ObjectManagerException {
        final String methodName = "readObject";
        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.entry(this,
                        cclass,
                        methodName,
                        new Object[] { dataInputStream,
                                      objectManagerState });

        try {
            byte version = dataInputStream.readByte();
            if (Tracing.isAnyTracingEnabled() && trace.isDebugEnabled())
                trace.debug(this,
                            cclass,
                            methodName,
                            new Object[] { new Byte(version) });
            super.readObject(dataInputStream,
                             objectManagerState);
            if (dataInputStream.readByte() == 1) {
                // The first element in the list.
                head = Token.restore(dataInputStream,
                                     objectManagerState);
                //      The final element in the list.
                tail = Token.restore(dataInputStream,
                                     objectManagerState);
            } // if (dataInputStream.readByte() == 1).
            size = dataInputStream.readLong();
        } catch (java.io.IOException exception) {
            // No FFDC Code Needed.
            ObjectManager.ffdc.processException(this,
                                                cclass,
                                                methodName,
                                                exception,
                                                "1:1620:1.40");

            if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
                trace.exit(this,
                           cclass,
                           methodName,
                           new Object[] { exception });
            throw new PermanentIOException(this,
                                           exception);
        } // catch (java.io.IOException exception).

        // We cannot set the available head during recovery because the links may get deleted before
        // recovery is complete, instead force a scan when we use availableHead for the first time.
        availableHead = null;
        availableSize = size; // All links are initially available.

        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.exit(this,
                       cclass,
                       methodName);
    }
1058007
private int writeBuffer(java.nio.ByteBuffer byteBuffer,
                            long byteAddress)
                    throws ObjectManagerException
    {
        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.entry(this,
                        cclass,
                        "writeBuffer",
                        new Object[] { new Integer(byteBuffer.hashCode()), new Long(byteAddress) }
                            );

        // Write the bytes.
        int bytesWritten = 0;
        try {
            while (byteBuffer.hasRemaining()) {
                bytesWritten = bytesWritten + storeChannel.write(byteBuffer,
                                                                 byteAddress + bytesWritten);
            } // while (byteBuffer.hasRemaining()).
        } catch (java.io.IOException exception) {
            // No FFDC Code Needed.
            ObjectManager.ffdc.processException(this, cclass, "writeBuffer", exception, "1:833:1.39");

            if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
                trace.exit(this,
                           cclass,
                           "writeBuffer");

            // cannot continue
            objectManagerState.requestShutdown();
            throw new PermanentIOException(this,
                                           exception);
        } // catch.

        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.exit(this,
                       cclass,
                       "writeBuffer",
                       new Object[] { new Integer(bytesWritten) });
        return bytesWritten;
    }
467112
protected void backout(boolean reUse,
                           Transaction transaction)
                    throws ObjectManagerException {
        final String methodName = "backout";
        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.entry(this, cclass, methodName, new Object[] { new Boolean(reUse),
                                                                transaction });

        boolean persistentWorkDone = false;
        ManagedObject[] lockedManagedObjects;
        int numberOfLockedManagedObjects = 0;

        synchronized (this) {
            // To defend against two application threads completing the same transaction and trying to
            // continue with it at the same time we check that the Transaction still refers to this one,
            // now that we are synchronized on the InternalTransaction.
            if (transaction.internalTransaction != this) {
                if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
                    trace.exit(this, cclass,
                               methodName,
                               new Object[] { "via InvalidTransactionException", transaction.internalTransaction }
                                    );
                // Same behaviour as if the transaction was completed and replaced by
                // objectManagerState.dummyInternalTransaction.
                throw new InvalidStateException(this,
                                                InternalTransaction.stateTerminated,
                                                InternalTransaction.stateNames[InternalTransaction.stateTerminated]);

            } // if (transaction.internalTransaction != this).

            // Only call prePrepare if we have not already prepared the transaction.
            if (state == stateInactive
                || state == stateActiveNonPersistent
                || state == stateActivePersistent) {
                prePrepare(transaction);
            } // If already prepared.

            testState(nextStateForStartBackout);
            setState(nextStateForStartBackout);

            preBackout(transaction); // Tell ManagedObjects the outcome.

            // Is there any logging to do?
            if (state == stateBackingOutPersistent) {
                persistentWorkDone = true;

                TransactionBackoutLogRecord transactionBackoutLogRecord = new TransactionBackoutLogRecord(this);
                objectManagerState.logOutput.writeNext(transactionBackoutLogRecord,
                                                       -logSpaceReserved,
                                                       true,
                                                       true);
                logSpaceReserved = 0;
            } // If logging work to do.

            // Drive the backout method for the included objects.
            // The synchronized block prevents us from taking a checkpoint until all of the
            // ManagedObjects have had their opportunity to update the ObjectStore. If a
            // checkpoint is currently active we will update the current checkpoint set in
            // the ObjectStore, if not we will update the next set of updates.
            lockedManagedObjects = new ManagedObject[includedManagedObjects.size()];

            boolean requiresCurrentPersistentCheckpoint = requiresPersistentCheckpoint
                                                          || (objectManagerState.checkpointStarting == ObjectManagerState.CHECKPOINT_STARTING_PERSISTENT);

            for (java.util.Iterator managedObjectIterator = includedManagedObjects.values().iterator(); managedObjectIterator.hasNext();) {
                ManagedObject managedObject = (ManagedObject) managedObjectIterator.next();
                long managedObjectSequenceNumber = ((Long) managedObjectSequenceNumbers.get(managedObject.owningToken)).longValue();

                if (managedObject.lockedBy(transaction)) {
                    managedObject.backout(transaction,
                                          managedObjectSequenceNumber,
                                          requiresCurrentPersistentCheckpoint);
                    lockedManagedObjects[numberOfLockedManagedObjects++] = managedObject;
                } else {
                    ObjectManagerByteArrayOutputStream serializedBytes = (ObjectManagerByteArrayOutputStream) loggedSerializedBytes.get(managedObject.owningToken);
                    managedObject.optimisticReplaceBackout(transaction,
                                                           serializedBytes,
                                                           managedObjectSequenceNumber,
                                                           requiresCurrentPersistentCheckpoint);
                } // if(managedObject.lockedBy(transaction)).

            } // for... includedManagedObjects.

            setState(nextStateForBackout);
            transactionLock.unLock(objectManagerState);
            postBackout(transaction); // Tell ManagedObjects the outcome is complete.
            // Tidy up the transaction.
            complete(reUse,
                     transaction);
        } // synchronized (this).

        // We don't want to clear the transaction lock held by the managedObject otherwise
        // ManagedObject.wasLocked() will not be able to give the past locked state. The
        // Unlock point wa noted above so now notify the ManagedObject and give a new
        // waiter a chance to acquire the lock. If a new transaction acquires the lock then
        // ManagedObject.wasLocked will return its result for the new transaction and
        // wasLocked() will then be true for an even later time.  Do this after we have release the
        // synchronize lock on InternalTransaction so that we avoid deadlock with ManagedObjects
        // that invoke synchronized InternalTransaction methods.
        for (int i = 0; i < numberOfLockedManagedObjects; i++) {
            synchronized (lockedManagedObjects[i]) {
                lockedManagedObjects[i].notify();
            } // synchronized (lockedManagedObjects[i]).
        } // for... lockedManagedObjects.

        // Tell the ObjectManager that we are done, once the transaction is unlocked
        // in case it is needed for checkpoint.
        objectManagerState.transactionCompleted(this,
                                                persistentWorkDone);
        // See if we need to delay while a checkpoint completes. Applications amy ask to reUSe
        // the same transaction, if so we introduce the delay here. Internal transactions are never
        // reUsed so we don't need to wory about blocking them. This call must be made when we
        // are not synchronized on the transaction because it might block waiting for a checkpoint
        // to complete if the log is full.
        if (reUse)
            objectManagerState.transactionPacing();

        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.exit(this, cclass, methodName);
    }
1163730
private void writeObject(final ObjectOutputStream out) throws IOException {
        out.defaultWriteObject();
        out.writeInt(size());
        for (final E e : this) {
            out.writeObject(e);
        }
    }
1005357
public final ManagedObject getManagedObject()
                    throws ObjectManagerException {
//    final String methodName = "getManagedObject";
//    if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
//      trace.entry(this,
//                  cclass,
//                  methodName);

        // Get the object if is already in memory.
        ManagedObject managedObject = null;
        if (managedObjectReference != null)
            managedObject = (ManagedObject) managedObjectReference.get();

        if (managedObject == null) { // See if we can avoid synchronizing.
            synchronized (this) {
                if (managedObjectReference != null)
                    managedObject = (ManagedObject) managedObjectReference.get();
                if (managedObject == null) {
                    managedObject = objectStore.get(this);
                    if (managedObject != null) {
                        managedObject.owningToken = this; // PM22584 Set the owning token first
                        managedObjectReference = new java.lang.ref.WeakReference(managedObject);
                    } // if (managedObject != null). 
                } // if (managedObject == null).
            } // synchronize (this).
        } // if (managedObject == null).

//    if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
//      trace.exit(this,
//                 cclass,
//                 methodName,
//                 new Object[] {managedObject}); 
        return managedObject;
    }
593946
final void writeHeader()
                    throws ObjectManagerException
    {
        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.entry(this,
                        cclass,
                        "writeHeader");

        byteArrayOutputStream.reset();
        java.io.DataOutputStream dataOutputStream = new java.io.DataOutputStream(byteArrayOutputStream);

        // Write the header.
        try {
            dataOutputStream.writeInt(version);
            dataOutputStream.writeChars(signature);
            dataOutputStream.writeLong(objectStoreIdentifier);
            dataOutputStream.writeLong(((Directory.Node) directory.root).byteAddress);
            dataOutputStream.writeLong(((Directory.Node) directory.root).length);
            dataOutputStream.writeInt(directory.getMinimumNodeSize());
            if (freeSpaceStoreArea == null) {
                dataOutputStream.writeLong(0);
                dataOutputStream.writeLong(0);
            } else {
                dataOutputStream.writeLong(freeSpaceStoreArea.byteAddress);
                dataOutputStream.writeLong(freeSpaceStoreArea.length);
            }
            dataOutputStream.writeLong((long) freeSpaceByLength.size());
            dataOutputStream.writeLong(sequenceNumber);
            dataOutputStream.writeLong(storeFileSizeUsed);
            dataOutputStream.writeLong(minimumStoreFileSize);
            dataOutputStream.writeLong(maximumStoreFileSize);
            dataOutputStream.writeInt(cachedManagedObjectsSize);

            dataOutputStream.flush();
            byteArrayOutputStream.flush();
        } catch (java.io.IOException exception) {
            // No FFDC Code Needed.
            ObjectManager.ffdc.processException(this, cclass, "writeHeader", exception, "1:836:1.35");

            if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
                trace.exit(this,
                           cclass,
                           "flush");
            throw new PermanentIOException(this,
                                           exception);
        } // catch.

        byte[] buffer = byteArrayOutputStream.getBuffer();
        int length = byteArrayOutputStream.getCount();
        writeBuffer(buffer,
                    0,
                    length,
                    0);
        // Write the header twice.
        writeBuffer(buffer,
                    0,
                    length,
                    pageSize);

        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.exit(this,
                       cclass,
                       "writeHeader"
                            );
    }
657387
@Override
    public void readObject(DataInputStream dataInputStream, ObjectManagerState objectManagerState) throws ObjectManagerException, IOException
    {
    	final String methodName = "readObject";
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, methodName, "bytes available==" + dataInputStream.available());

        super.readObject(dataInputStream, objectManagerState);

        long serialVersionUIDRead = dataInputStream.readLong();
       
        _uniqueID = dataInputStream.readLong();
        _streamID = dataInputStream.readLong();
        _lockID = dataInputStream.readLong();
        _referredID = dataInputStream.readLong();
        _sequence = dataInputStream.readLong();
        _expiryTime = dataInputStream.readLong();

        // redeliveredCount was added for serialVersionUIDV1 and later.
        // otherwise set it to 0.
        if (serialVersionUIDRead == serialVersionUIDV0)
          _redeliveredCount = 0;
        else
          _redeliveredCount = dataInputStream.readInt();

        _storageStrategy = dataInputStream.readInt();
        _priority = dataInputStream.readInt();
        _persistentSize = dataInputStream.readInt();
        _maxDepth = dataInputStream.readInt();

        _canExpireSilently = dataInputStream.readBoolean();
        _containsExpirables = dataInputStream.readBoolean();

        // Read the strings in but only if they were
        // not null on the write.
        boolean read = dataInputStream.readBoolean();
        if (read)
        {
            _type = dataInputStream.readUTF();
        }
        read = dataInputStream.readBoolean();
        if (read)
        {
            _className = dataInputStream.readUTF();
        }

        // In order to read in the tran ID we need to read
        // its length so we can create the byte array.
        int length = dataInputStream.readInt();

        if (length != -1)
        {
            _transactionId = new byte[length];

            dataInputStream.readFully(_transactionId, 0, length);
        }

        // Call the Tokens to read themselves in but
        // only if the flag preceding them says that
        // they exist in the stream.
        read = dataInputStream.readBoolean();
        if (read)
        {
            _streamListToken = Token.restore(dataInputStream, objectManagerState);
        }
        read = dataInputStream.readBoolean();
        if (read)
        {
            _itemListToken = Token.restore(dataInputStream, objectManagerState);
        }
        read = dataInputStream.readBoolean();
        if (read)
        {
            _rawDataToken = Token.restore(dataInputStream, objectManagerState);
        }
        read = dataInputStream.readBoolean();
        if (read)
        {
            _streamListEntryToken = Token.restore(dataInputStream, objectManagerState);
        }
        read = dataInputStream.readBoolean();
        if (read)
        {
            _itemListEntryToken = Token.restore(dataInputStream, objectManagerState);
        }

        // _deliveryDelayTime was added for serialVersionUID=2 and serialVersionUIDV1 
        // in releases 8.5.6 and higher.
        if (serialVersionUIDRead == serialVersionUIDV0) {
        	_deliveryDelayTime = 0;
        } else if (serialVersionUIDRead == serialVersionUIDV1) {
        	
        	// _deliveryDelayTime was initially added without changing serialVersionUID, so 
        	// PersistableMetaData was stored using serialVersionUIDV1 and may or may not contain 
        	// _deliveryDelayTime. If there are fewer than 8 bytes remaining in the dataInputStream 
        	// then we can safely assume the _deliveryDelayTime was not stored.
            if (dataInputStream.available() >= 8 && _className.equals("com.ibm.ws.sib.processor.impl.store.items.MessageItem")) {
                _deliveryDelayTime = dataInputStream.readLong();
                // We could have just read garbage from spare space in the ObjectStore.
                _deliveryDelayTimeIsSuspect = true;
            }
            else 
        	    _deliveryDelayTime = 0;  
        } else {
        	_deliveryDelayTime = dataInputStream.readLong();
        }

        // Reset _estimatedLength so that it is re-calculated
        // when it is needed.
        _estimatedLength = -1;
        
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, methodName, "serialVersionUIDRead="+serialVersionUIDRead+" bytes available==" + dataInputStream.available());
    }