Package org.apache.openjpa.kernel

Examples of org.apache.openjpa.kernel.PCState


        OpenJPAEntityManager pm = getPM();

        List l = ((Extent) pm.createExtent(RuntimeTest1.class, true)).list();
        pm.retrieveAll(l);
        for (Iterator iter = l.iterator(); iter.hasNext();) {
            PCState s = getStateManager(iter.next(), pm).getPCState();
            assertEquals(PCState.PNONTRANS, s);
        }
        pm.evictAll();
        for (Iterator iter = l.iterator(); iter.hasNext();) {
            PCState s = getStateManager(iter.next(), pm).getPCState();
            assertEquals(PCState.HOLLOW, s);
        }
    }
View Full Code Here


        OpenJPAEntityManager pm = getPM();

        List l = ((Extent) pm.createExtent(RuntimeTest1.class, true)).list();
        pm.retrieveAll(l);
        for (Iterator iter = l.iterator(); iter.hasNext();) {
            PCState s = getStateManager(iter.next(), pm).getPCState();
            assertEquals(PCState.PNONTRANS, s);
        }
        pm.evictAll(l);
        for (Iterator iter = l.iterator(); iter.hasNext();) {
            PCState s = getStateManager(iter.next(), pm).getPCState();
            assertEquals(PCState.HOLLOW, s);
        }
    }
View Full Code Here

        OpenJPAEntityManager pm = getPM();

        List l = ((Extent) pm.createExtent(RuntimeTest1.class, true)).list();
        pm.retrieveAll(l);
        for (Iterator iter = l.iterator(); iter.hasNext();) {
            PCState s = getStateManager(iter.next(), pm).getPCState();
            assertEquals(PCState.PNONTRANS, s);
        }
        pm.evictAll(RuntimeTest1.class);
        for (Iterator iter = l.iterator(); iter.hasNext();) {
            PCState s = getStateManager(iter.next(), pm).getPCState();
            assertEquals(PCState.HOLLOW, s);
        }
    }
View Full Code Here

        OpenJPAEntityManager pm = getPM();

        List l = ((Extent) pm.createExtent(RuntimeTest1.class, true)).list();
        pm.retrieveAll(l);
        for (Iterator iter = l.iterator(); iter.hasNext();) {
            PCState s = getStateManager(iter.next(), pm).getPCState();
            assertEquals(PCState.PNONTRANS, s);
        }
        pm.evictAll(RuntimeTest2.class);
        boolean foundPNONTRANS = false;
        for (Iterator iter = l.iterator(); iter.hasNext();) {
            PCState s = getStateManager(iter.next(), pm).getPCState();
            if (s == PCState.PNONTRANS) {
                foundPNONTRANS = true;
                break;
            }
        }
View Full Code Here

        OpenJPAEntityManager pm = getPM();

        List l = ((Extent) pm.createExtent(RuntimeTest1.class, true)).list();
        pm.retrieveAll(l);
        for (Iterator iter = l.iterator(); iter.hasNext();) {
            PCState s = getStateManager(iter.next(), pm).getPCState();
            assertEquals(PCState.PNONTRANS, s);
        }
        pm.evictAll(pm.createExtent(RuntimeTest1.class, true));
        for (Iterator iter = l.iterator(); iter.hasNext();) {
            PCState s = getStateManager(iter.next(), pm).getPCState();
            assertEquals(PCState.HOLLOW, s);
        }

        pm.retrieveAll(l);
        for (Iterator iter = l.iterator(); iter.hasNext();) {
            PCState s = getStateManager(iter.next(), pm).getPCState();
            assertEquals(PCState.PNONTRANS, s);
        }
        pm.evictAll(pm.createExtent(RuntimeTest1.class, false));
        for (Iterator iter = l.iterator(); iter.hasNext();) {
            Object o = iter.next();
            if (o.getClass() == RuntimeTest1.class) {
                PCState s = getStateManager(o, pm).getPCState();
                assertEquals(PCState.HOLLOW, s);
            }
        }
    }
View Full Code Here

            // get DomainTypeHandler from StateManager
            NdbOpenJPADomainTypeHandlerImpl<?> domainTypeHandler = getDomainTypeHandler(sm);
            // get the value handler for the StateManager
            ValueHandler valueHandler = domainTypeHandler.getValueHandler(sm, this);
            // now flush based on current PCState
            PCState pcState = sm.getPCState();
            try {
                if (pcState == PCState.PNEW) {
                    // flush new instance
                    session.insert(domainTypeHandler, valueHandler);
                } else if (pcState == PCState.PDELETED) {
                    // flush deleted instance
                    session.delete(domainTypeHandler, valueHandler);
                } else if (pcState == PCState.PDIRTY) {
                    // flush dirty instance
                    session.update(domainTypeHandler, valueHandler);
                } else if (pcState == PCState.PNEWFLUSHEDDELETED) {
                    // flush new flushed deleted instance
                    session.delete(domainTypeHandler, valueHandler);
                } else if (pcState == PCState.PNEWFLUSHEDDELETEDFLUSHED) {
                    // nothing to do
                } else {
                    throw new ClusterJUserException(
                            local.message("ERR_Unsupported_Flush_Operation",
                            pcState.toString()));
                }
            } catch (Exception ex) {
                if (logger.isDebugEnabled()) {
                    logger.debug("Exception caught: " + ex.toString());
                }
View Full Code Here

    public Collection<Exception> flush(Collection<OpenJPAStateManager> sms) {
        LinkedHashSet<OpenJPAStateManager> passingThrough = null;
        for (OpenJPAStateManager sm : sms) {
            if (cacheAble(sm)) {
                PCState newState = sm.getPCState();
                if (newState == PCState.PDELETEDFLUSHED) {
                    newState = PCState.PDELETED; // effectively reset the flush
                }
                inFlightSMs.add(new StateManagerImpl((StateManagerImpl)sm, newState));
            } else {
View Full Code Here

TOP

Related Classes of org.apache.openjpa.kernel.PCState

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.