Called to perform recovery action during a warm start of the ObjectManager.

@param objectManagerState of the ObjectManager performing recovery.
@throws ObjectManagerException
978226
public void performRecovery(ObjectManagerState objectManagerState)
                    throws ObjectManagerException {
        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.entry(this,
                        cclass,
                        "performRecovery",
                        new Object[] { objectManagerState, logicalUnitOfWork, new Integer(transactionState), token });

        // Delete the ManagedObject again using its original Transaction.
        Transaction transactionForRecovery = objectManagerState.getTransaction(logicalUnitOfWork);

        ManagedObject existingManagedObject = token.getManagedObject();
        if (existingManagedObject == null)
        {
            // The object may have already been deleted from the ObjectStore,
            // so create a dummy object to keep the transaction happy. 
            // The Token will have the ObjecStore and storedObjectIdentifier so the the correct delete in the
            // ObjectStore can take place. 
            DummyManagedObject dummyManagedObject = new DummyManagedObject("Created by TransactionDeleteLogRecord.performRecovery()");
            existingManagedObject = token.setManagedObject(dummyManagedObject);
            existingManagedObject.state = ManagedObject.stateReady;
        } // if (existingManagedObject == null).   

        // Redo the delete. 
        transactionForRecovery.delete(existingManagedObject);
        // No need to reset the transaction state because Delete can only be executed before
        // the transaction is prepared.
        // transactionForRecovery.internalTransaction.resetState(transactionState);

        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.exit(this, cclass, "performRecovery");
    }
787124
protected void close()
                    throws ObjectManagerException
    {
        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.entry(this, cclass
                        , "close"
                            );

        if (flushHelper != null)
            flushHelper.shutdown(); // Complete outstanding work.
        if (notifyHelper != null)
            notifyHelper.shutdown(); // No longer need a notify thread.

        logFile = null;

        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.exit(this, cclass
                       , "close"
                            );
    }
380333
public void performRecovery(ObjectManagerState objectManagerState)
                    throws ObjectManagerException {
        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.entry(this,
                        cclass,
                        "performRecovery",
                        objectManagerState);

        if (Tracing.isAnyTracingEnabled() && trace.isDebugEnabled())
            trace.debug(this,
                        cclass,
                        "logicalUnitOfWork=" + logicalUnitOfWork + "(LogicalUnitOfWork)"
                                        + "\n transactionState=" + transactionState + "(int)"
                                        + "\n tokensToAdd=" + tokensToAdd + "(java.util.Collection)"
                                        + "\n tokensToReplace=" + tokensToReplace + "(java.util.Collecton)"
                                        + "\n serializedBytesToReplace=" + serializedBytesToReplace + "(java.util.Collection)"
                                        + "\n tokensToOptimisticReplace=" + tokensToOptimisticReplace + "(java.util.Collection)"
                                        + "\n tokensToDelete=" + tokensToDelete + "(java.util.Collection)"
                                        + "\n tokensToNotify=" + tokensToNotify + "(java.util.Collection)");

        // In principle we should test to see if objectManagerState.checkpointEndSee is true, 
        // because if it is we dont need to do this processing because the transaction is 
        // already in its correct state, however there is also no harm in processing this again. 
        // We have started an new checkpoint but not completed it.

        // Redo the operations of the ManagedObject using its original Transaction.
        Transaction transactionForRecovery = objectManagerState.getTransaction(logicalUnitOfWork);

        // Recover the Added ManagedObjects.
        for (java.util.Iterator tokenIterator = tokensToAdd.iterator(); tokenIterator.hasNext();) {
            Token token = (Token) tokenIterator.next();
            ManagedObject existingManagedObject = token.getManagedObject();
            // If a subsequent transaction has deleted the ManagedObject we dont need to recover it.
            if (existingManagedObject != null) {
                // Revert to constructed state.
                existingManagedObject.state = ManagedObject.stateConstructed;
                transactionForRecovery.addFromCheckpoint(existingManagedObject);
            } // if(existingManagedObject != null).
        } // for ... tokensToAdd.

        // Recover the Replace ManagedObjects.
        java.util.Iterator serializedBytesIterator = serializedBytesToReplace.iterator();
        for (java.util.Iterator tokenIterator = tokensToReplace.iterator(); tokenIterator.hasNext();) {
            Token token = (Token) tokenIterator.next();
            ManagedObject existingManagedObject = token.getManagedObject();
            byte[] managedObjectBytes = (byte[]) serializedBytesIterator.next();
            ManagedObject replacementManagedObject = ManagedObject.restoreFromSerializedBytes(managedObjectBytes,
                                                                                              objectManagerState);
            // If a subsequent transaction has deleted the ManagedObject we dont need to recover it.
            if (existingManagedObject != null) {
                // Replace what we already have with this version.
                transactionForRecovery.lock(existingManagedObject);
                // Make the underlying object the way it was when we made the original transaction.replace()
                // call.
                token.setManagedObject(replacementManagedObject);
                transactionForRecovery.replaceFromCheckpoint(existingManagedObject,
                                                             managedObjectBytes);
            } // if(existingManagedObject != null).
        } // for ... tokensToReplace.

        // Recover the Optimistic Replace ManagedObjects.
        for (java.util.Iterator tokenIterator = tokensToOptimisticReplace.iterator(); tokenIterator.hasNext();) {
            Token token = (Token) tokenIterator.next();
            ManagedObject existingManagedObject = token.getManagedObject();
            // If a subsequent transaction has deleted the ManagedObject we dont need to recover it.
            if (existingManagedObject != null) {
                transactionForRecovery.optimisticReplaceFromCheckpoint(existingManagedObject);
            } // if(existingManagedObject != null).
        } // for ... tokensToOptimisticReplace.

        // Recover the Delete ManagedObjects.
        for (java.util.Iterator tokenIterator = tokensToDelete.iterator(); tokenIterator.hasNext();) {
            Token token = (Token) tokenIterator.next();
            ManagedObject existingManagedObject = token.getManagedObject();
            // If the object has already been deleted we need not do anything.
            if (existingManagedObject != null) {
                transactionForRecovery.deleteFromCheckpoint(existingManagedObject);
            } // if(existingManagedObject != null).
        } // for ... tokensToDelete.

        // Recover the Notify ManagedObjects.
        for (java.util.Iterator tokenIterator = tokensToNotify.iterator(); tokenIterator.hasNext();) {
            Token token = (Token) tokenIterator.next();
            ManagedObject existingManagedObject = token.getManagedObject();
            // If the object has already been deleted we need not do anything.
            if (existingManagedObject != null) {
                transactionForRecovery.notifyFromCheckpoint(token);
            } // if(existingManagedObject != null).
        } // for ... tokensToNotify.

        transactionForRecovery.internalTransaction.resetState(transactionState);

        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.exit(this,
                       cclass,
                       "performRecovery");
    }
1133617
protected synchronized void clear()
                    throws ObjectManagerException {
        final String methodName = "clear";
        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.entry(this, cclass, methodName);

        // No call to super.clear() because we use a WeakValueHashMap.
        inMemoryTokens.clear();
        cachedManagedObjects = new java.lang.ref.SoftReference[cachedManagedObjectsSize];
        managedObjectsToWrite.clear();
        tokensToDelete.clear();
        // No need to clear newFreeSpace because the existing one is cleared just before we flush anyway.

        // Allow for two headers to be written at the front of the file.
        storeFileSizeUsed = pageSize * 2;
        freeSpaceByAddressHead = null;
        freeSpaceByLength = new java.util.TreeSet(new LengthComparator());
        freeSpaceStoreArea = null;

        // Sequence numbers 0-200 are reserved.    
        sequenceNumber = initialSequenceNumber;

        directory = makeDirectory(initialDirectoryMinimumNodeSize, 0, 0);
        directoryReservedSize = directory.spaceRequired();
        reservedSize.set(0);
        setAllocationAllowed();

        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.exit(this, cclass, methodName);
    }
802516
protected void performColdStart()
                    throws ObjectManagerException
    {
        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.entry(this,
                        cclass,
                        "performColdStart");

        // This is presumably the first startup of this ObjectManager.
        // Record the name of the log file.
        coldStartLogFileName = logFileName;
        // Record the time.
        coldStartTime = System.currentTimeMillis();

        // Access the log files for forward processing.
        switch (logFileType) {
            case (ObjectManager.LOG_FILE_TYPE_FILE):
            case (ObjectManager.LOG_FILE_TYPE_CLEAR):
                logOutput = new FileLogOutput(logFile,
                                              this);
                break;

            case (ObjectManager.LOG_FILE_TYPE_NONE):
                // Note that by default this Dummy log has a filesize of zero, when used with
                // a save on shutdown store this means that the store file is increneted as each
                // object is added rather than in chunks according to the log file size.
                logOutput = new DummyLogOutput();
                break;

            default:
                if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
                    trace.exit(this,
                               cclass,
                               "performColdStart",
                               new Integer(logFileType));
                throw new InvalidLogFileTypeException(this,
                                                      logFileType);
        } // switch (logFileType).

        trace.debug(cclass, "performColdStart", "ObjectManager using logFile " + logFileName + " was cold started");
        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.exit(this,
                       cclass,
                       "performColdStart",
                       new Object[] { coldStartLogFileName, new java.util.Date(coldStartTime) });
    }
548828
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) {
                // Use ManagedObjectInpuStream so as to get the correct classloader.
                java.io.ObjectInputStream objectInputStream = new ManagedObjectInputStream(dataInputStream, objectManagerState);
                comparator = (java.util.Comparator) objectInputStream.readObject();
                objectInputStream.close();
            } // if (dataInputStream.readByte() == 1).
            if (dataInputStream.readByte() == 1) {
                root = 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:2412:1.44");

            if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
                trace.exit(this, cclass, methodName, exception);
            throw new PermanentIOException(this, exception);

        } catch (java.lang.ClassNotFoundException exception) {
            // No FFDC Code Needed.
            ObjectManager.ffdc.processException(this, cclass, methodName, exception, "1:2420:1.44");

            if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
                trace.exit(this, cclass, methodName, new Object[] { "ClassNotFoundException:2423",
                                                                   exception });
            throw new com.ibm.ws.objectManager.ClassNotFoundException(this, exception);
        } // try.

        availableSize = size; // Start as last commited.

        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.exit(this, cclass, methodName);
    }
925003
public void setModificationState(ModificationState newModificationState)
    {
        if(newModificationState != modificationState)
        {
            if(log.isDebugEnabled())
            {
                log.debug("object state transition for object " + this.oid + " ("
                        + modificationState + " --> " + newModificationState + ")");
//                try{throw new Exception();}catch(Exception e)
//                {
//                e.printStackTrace();
//                }
            }
            modificationState = newModificationState;
        }
    }
97148
public void restoreState(FacesContext context, Object state) {

        if (context == null) {
            throw new NullPointerException();
        }
        if (state == null) {
            return;
        }
        methodExpressionOneArg = (MethodExpression) ((Object[]) state)[0];
        methodExpressionZeroArg = (MethodExpression) ((Object[]) state)[1];

    }
963063
public synchronized void open(ObjectManagerState objectManagerState)
                    throws ObjectManagerException {
        final String methodName = "open";
        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.entry(this, cclass, methodName, objectManagerState);

        super.open(objectManagerState);

        sharedBuffer = java.nio.ByteBuffer.allocateDirect(1024 * 1024);
        storeChannel = storeFile.getChannel();

        // Make sure no one else can write to the file.
        // Obtain an exclusive lock on the storeFileChannel.
        try {
            storeFileLock = storeChannel.tryLock();
        } catch (java.io.IOException exception) {
            // No FFDC Code Needed.
            ObjectManager.ffdc.processException(this, cclass, "<init>", exception, "1:137:1.39");

            if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
                trace.exit(this,
                           cclass,
                           methodName,
                           new Object[] { exception });
            throw new PermanentIOException(this,
                                           exception);
        } // catch (java.io.IOException exception).
        if (storeFileLock == null) { // Did we get the lock?
            if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
                trace.exit(this,
                           cclass,
                           methodName,
                           "via StoreFileInUseException, storeName=" + storeName + "(String)");
            throw new StoreFileInUseException(this,
                                              storeName);
        } // (fileLock == null).

        // Now look at the file and initialise the ObjectStore.
        // Read the header, to find the directory and free space map.
        try {
            java.nio.ByteBuffer storeHeader = java.nio.ByteBuffer.allocate(pageSize);
            storeChannel.read(storeHeader);
            storeHeader.flip();

            int versionRead = storeHeader.getInt();

            // Read a known number of signature charaters.
            char[] signatureRead = new char[signature.length()];
            for (int i = 0; i < signature.length(); i++)
                signatureRead[i] = storeHeader.getChar();
            if (!(new String(signatureRead).equals(signature))) {
                if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
                    trace.exit(this,
                               cclass,
                               "open"
                               , new Object[] { signatureRead });
                throw new InvalidStoreSignatureException(this,
                                                         new String(signatureRead), signature);
            } // if(!(new String(signatureRead).equals(signature))).

            long objectStoreIdentifierRead = storeHeader.getLong();
            if (Tracing.isAnyTracingEnabled() && trace.isDebugEnabled())
                trace.debug(this,
                            cclass,
                            methodName,
                            new Object[] { new Integer(versionRead),
                                          new String(signatureRead),
                                          new Long(objectStoreIdentifierRead)
                            }
                                );
            // Use the saved value if we are a new store.
            if (objectStoreIdentifier == IDENTIFIER_NOT_SET)
                objectStoreIdentifier = (int) objectStoreIdentifierRead;

            // The byte address of the directory root.
            long directoryRootByteAddress = storeHeader.getLong();
            // The current number of bytes in the directory root.
            long directoryRootLength = storeHeader.getLong();
            // The minimumNodeSize of the directory BTree.
            int directoryMinimumNodeSize = storeHeader.getInt();
            long freeSpaceStoreAreaByteAddress = storeHeader.getLong();
            long freeSpaceStoreAreaLength = storeHeader.getLong();
            // The actual number of free space entries since we have to overestimate the space we need to store them.
            long freeSpaceCount = storeHeader.getLong();

            sequenceNumber = storeHeader.getLong();
            // This is the length we assume we have written.
            storeFileSizeUsed = storeHeader.getLong();
            // Administered limits on store file size.
            minimumStoreFileSize = storeHeader.getLong();
            maximumStoreFileSize = storeHeader.getLong();
            cachedManagedObjectsSize = storeHeader.getInt();

            storeFileSizeAllocated = storeFile.length();

            if (Tracing.isAnyTracingEnabled() && trace.isDebugEnabled())
                trace.debug(this,
                            cclass,
                            methodName,
                            new Object[] { new Long(directoryRootByteAddress)
                                          , new Long(directoryRootLength)
                                          , new Integer(directoryMinimumNodeSize)
                                          , new Long(freeSpaceStoreAreaByteAddress)
                                          , new Long(freeSpaceStoreAreaLength)
                                          , new Long(freeSpaceCount)
                                          , new Long(sequenceNumber)
                                          , new Long(storeFileSizeUsed)
                                          , new Long(minimumStoreFileSize)
                                          , new Long(maximumStoreFileSize)
                                          , new Integer(cachedManagedObjectsSize)
                                          , new Long(storeFileSizeAllocated)
                            }
                                );

            // Are we interested in what's already on the disk?
            if (storeStrategy == STRATEGY_KEEP_ALWAYS
                || storeStrategy == STRATEGY_SAVE_ONLY_ON_SHUTDOWN) {
                // Create the array that locks recently used ManagedObjects into memory.
                cachedManagedObjects = new java.lang.ref.SoftReference[cachedManagedObjectsSize];
                directory = new Directory(directoryMinimumNodeSize,
                                          directoryRootByteAddress,
                                          directoryRootLength);
                if (freeSpaceStoreAreaByteAddress != 0)
                    freeSpaceStoreArea = directory.makeStoreArea(freeSpaceIdentifier,
                                                                 freeSpaceStoreAreaByteAddress,
                                                                 freeSpaceStoreAreaLength);
                readFreeSpaceMap(freeSpaceCount);

            } else if (storeStrategy == STRATEGY_KEEP_UNTIL_NEXT_OPEN) {
                if (Runtime.getRuntime().totalMemory() < Integer.MAX_VALUE)
                    reservedSize = new Atomic32BitLong(0);
                else
                    reservedSize = new Atomic64BitLong(0);
                clear();
            } // if (storeStrategy...

        } catch (java.nio.BufferUnderflowException exception) {
            // The file is empty or did not exist.
            // No FFDC Code Needed, this may be first use of a store.
            if (Tracing.isAnyTracingEnabled() && trace.isEventEnabled())
                trace.event(this,
                            cclass,
                            methodName,
                            exception);

            if (objectManagerState.getObjectManagerStateState() == ObjectManagerState.stateReplayingLog) {
                ObjectManager.ffdc.processException(this, cclass, methodName, exception, "1:267:1.39");

                if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
                    trace.exit(this, cclass, methodName, new Object[] { "Buffer underflow:270" });
                throw new PermanentNIOException(this,
                                                exception);
            } // if.

            // Set initial values.
            minimumStoreFileSize = 0;
            maximumStoreFileSize = Long.MAX_VALUE;
            cachedManagedObjectsSize = initialCachedManagedObjectsSize;
            cachedManagedObjects = new java.lang.ref.SoftReference[cachedManagedObjectsSize];

            directory = new Directory(initialDirectoryMinimumNodeSize, 0, 0);
            freeSpaceByAddressHead = null;
            freeSpaceByLength = new java.util.TreeSet(new AbstractSingleFileObjectStore.LengthComparator());
            freeSpaceStoreArea = null;

            // Sequence numbers 0-200 are reserved.
            sequenceNumber = initialSequenceNumber;

            // Allow for two headers to be written at the front of the file.
            storeFileSizeUsed = pageSize * 2;
            storeFileSizeAllocated = storeFileSizeUsed;
            // allocateSpace() is now initialized,

            // Make sure there is a valid header on the disk, in case we fail after this.
            // It is fatal for the ObjectManager to fail after we extend the file system
            // in setAllocationAllowed() without writing a header as the header will contain zeros.
            writeHeader();
            force();

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

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

        directoryReservedSize = directory.spaceRequired();
        if (Runtime.getRuntime().totalMemory() < Integer.MAX_VALUE)
            reservedSize = new Atomic32BitLong(0);
        else
            reservedSize = new Atomic64BitLong(0);

        // Assume we have already reserved enough space to completely rewrite the directory so any number of
        // node splits or deletions are already accounted for. We now need to say how much space is needed
        // each time an object is added or replaced in the store. This will include enough space to also 
        // complete its removal.
        addSpaceOverhead = 4 + 1 // Space for a new Node, numberOfKeys + flagIsLeaf/flagIsNotLeaf.
                           + 5 * 8 // Space for a new Entry, Identifier,address,length,childAddress,childLength.
                           + 2 * 8 // An entry in the free space map for the node when it is rewritten.
                           + 2 * 8; // An entry in the free space map when the ManagedObject is removed.  
        // For debugging add guardBytes before and after the Node metadata and  before and after the payload.
        if (useGuardBytes)
            addSpaceOverhead = addSpaceOverhead + 2 * 2 * guardBytesLength;

        setAllocationAllowed();

        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.exit(this,
                       cclass,
                       methodName);
    }
1084807
public void checkpoint(ObjectEnvelope mod) throws PersistenceBrokerException
    {
        mod.doInsert();
        mod.setModificationState(StateOldClean.getInstance());
    }
1369867
@Override
    public void init(RestoreManagerConfig config, SnapshotJobManager jobManager) {
        this.config = config;
        this.jobManager = jobManager;
    }
314742
public void restoreState(FacesContext context, Object state) {

        if (context == null) {
            throw new NullPointerException();
        }
        if (state == null) {
            return;
        }
        
        if (!component.initialStateMarked() && !defaultMap.isEmpty())
        {
            defaultMap.clear();
            if(deltaMap != null && !deltaMap.isEmpty())
            {
                deltaMap.clear();
            }
        }
        
        Object[] savedState = (Object[]) state;
        if (savedState[savedState.length - 1] != null) {
            component.initialState = (Boolean) savedState[savedState.length - 1];
        }
        int length = (savedState.length-1)/2;
        for (int i = 0; i < length; i++) {
           Object value = savedState[i * 2 + 1];
            Serializable serializable = (Serializable) savedState[i * 2];
            if (value != null) {
                if (value instanceof Collection) {
                    value = restoreAttachedState(context, value);
                } else if (value instanceof StateHolderSaver) {
                    value = ((StateHolderSaver) value).restore(context);
                } else {
                    value = (value instanceof Serializable
                             ? value
                             : restoreAttachedState(context, value));
                }
            }
            if (value instanceof Map) {
                for (Map.Entry<String, Object> entry : ((Map<String, Object>) value)
                      .entrySet()) {
                    this.put(serializable, entry.getKey(), entry.getValue());
                }
            } else if (value instanceof List) {
                List<Object> list = (List) get(serializable);
                for (Object o : ((List<Object>) value)) {
                    if (list == null || !list.contains(o)) {
                        this.add(serializable, o);
                    }
                }
            } else {
                put(serializable, value);
            }
        }
    }
829866
void preBackout(Transaction transaction)
                    throws ObjectManagerException
    {
        throw new InvalidStateException(this, InternalTransaction.stateTerminated, InternalTransaction.stateNames[InternalTransaction.stateTerminated]);
    }
569688
protected synchronized void optimisticReplace(java.util.List managedObjectsToAddReplace,
                                                  java.util.List managedObjectsToReplace,
                                                  java.util.List managedObjectsToDelete,
                                                  java.util.List tokensToNotify,
                                                  Transaction transaction,
                                                  long logSpaceReservedDelta)
                    throws ObjectManagerException
    {
        throw new InvalidStateException(this, InternalTransaction.stateTerminated, InternalTransaction.stateNames[InternalTransaction.stateTerminated]);
    }
460442
public void init(ObjectMapper objectMapper) {
        if (resultFactory == null) {
            resultFactory = new ImmediateResultFactory();
        }
        PreconditionUtil.verifyEquals(InitializedState.NOT_INITIALIZED, initializedState, "already initialized");
        this.initializedState = InitializedState.INITIALIZING;
        this.objectMapper = objectMapper;
        this.objectMapper.registerModules(getJacksonModules());
        typeParser.setObjectMapper(objectMapper);

        initializeModules();

        if (isServer) {
            applyRepositoryRegistrations();
            applyResourceRegistrations();
        }

        ExceptionMapperLookup exceptionMapperLookup = getExceptionMapperLookup();
        ExceptionMapperRegistryBuilder mapperRegistryBuilder = new ExceptionMapperRegistryBuilder();
        exceptionMapperRegistry = mapperRegistryBuilder.build(exceptionMapperLookup);

        filterBehaviorProvider =
                new ResourceFilterDirectoryImpl(aggregatedModule.getResourceFilters(), httpRequestContextProvider,
                        resourceRegistry);
        this.initializedState = InitializedState.INITIALIZED;
    }
71744
protected synchronized void shutdown()
                    throws ObjectManagerException
    {
        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.entry(this, cclass
                        , "shutDown"
                            );

        setState(nextStateForShutdown);
        // Any attempt by any therad to do anything with this Transaction
        // from now on will result in a InvalidStateException.

        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.exit(this, cclass
                       , "shutdown"
                            );
    }
812304
@Override
    @SuppressWarnings("unchecked")
    protected void restoreState(Object[] objects) {
        if (objects != null && objects.length != 0) {
            variable = (Variable) objects[0];
            constants = (List<Variable>) objects[1];
            lastObjectHash = (Map<String, Object>) objects[2];
        }
    }