Package com.sun.jdo.spi.persistence.support.sqlstore

Examples of com.sun.jdo.spi.persistence.support.sqlstore.PersistenceManager


            if (_caller.owner != null) {
                // Mark the field as dirty
                StateManager stateManager = _caller.owner.jdoGetStateManager();

                if (stateManager != null) {
                    PersistenceManager pm = (PersistenceManager) stateManager.getPersistenceManagerInternal();

                    pm.acquireShareLock();

                    try {
                        pm.acquireFieldUpdateLock();
                        try
                        {
                            stateManager.makeDirty(_caller.fieldName);

                            _iterator.remove();

                            if (added.remove(lastReturned) == false) {
                                removed.add(lastReturned);
                            }

                            stateManager.applyUpdates(_caller.fieldName, _caller);

                        } finally {
                            pm.releaseFieldUpdateLock();
                        }
                    }
                    finally
                    {
                        pm.releaseShareLock();
                    }
                }
            } else {
                // No owner - regular HashSet operation.
                _iterator.remove();
View Full Code Here


    {
      StateManager stateManager = owner.jdoGetStateManager();
     
      if (stateManager != null)
      {
        PersistenceManager pm = (PersistenceManager) stateManager.getPersistenceManagerInternal();

        pm.acquireShareLock();
       
        try
        {
          synchronized (stateManager)
          { 
            //
            // Need to recheck owner because it could be set to
            // null before we lock the stateManager.
            //
            if (owner != null)
            {
              stateManager.makeDirty(fieldName);
              return stateManager;
            }
          }
        }
        finally
        {
          pm.releaseShareLock();
        }
      }
    }
    return null;
     }  
View Full Code Here

        {
      StateManager stateManager = owner.jdoGetStateManager();
     
      if (stateManager != null)
      {
        PersistenceManager pm = (PersistenceManager) stateManager.getPersistenceManagerInternal();

        pm.acquireShareLock();
       
        try
        {
          synchronized (stateManager)
          {
            //
            // Need to recheck owner because it could be set to
            // null before we lock the stateManager.
            //
            if (owner != null)
            {
              stateManager.makeDirty(fieldName);
              return stateManager;
            }
          }
        }
        finally
        {
          pm.releaseShareLock();
        }
      }
    }
        return null;
     }  
View Full Code Here

        {
            StateManager stateManager = owner.jdoGetStateManager();

            if (stateManager != null)
            {
                PersistenceManager pm = (PersistenceManager) stateManager.getPersistenceManagerInternal();

                pm.acquireShareLock();

                boolean modified = false;

                try
                {
                    pm.acquireFieldUpdateLock();
                    try
                    {
                       // Mark the field as dirty
                       stateManager.makeDirty(fieldName);

                       modified = super.add(o);

                       if (modified)
                       {
                           if (removed.remove(o) == false)
                           {
                               added.add(o);
                           }
                           stateManager.applyUpdates(fieldName, this);
                       }
                       return modified;
                    }
                    finally
                    {
                        pm.releaseFieldUpdateLock();
                    }

                }
                catch (JDOUserException e)
                {
                    Object[] failedObjects = e.getFailedObjectArray();

                    if (modified && (failedObjects != null))
                    {
                        //
                        // The failedObjects array may contain objects other
                        // than the one added. We iterate through it to find
                        // the one added and remove it from the collection.
                        //
                        for (int i = 0; i < failedObjects.length; i++)
                        {
                            Object failedObject = failedObjects[i];

                            if (failedObject == o)
                            {
                                super.remove(failedObject);
                                break;
                            }
                        }
                    }

                    throw e;
                }
                finally
                {
                    pm.releaseShareLock();
                }
            }
        }

        return super.add(o);
View Full Code Here

        {
            StateManager stateManager = owner.jdoGetStateManager();

            if (stateManager != null)
            {
                PersistenceManager pm = (PersistenceManager) stateManager.getPersistenceManagerInternal();

                pm.acquireShareLock();

                try
                {
                    pm.acquireFieldUpdateLock();
                    try
                    {
                        // Mark the field as dirty
                        stateManager.makeDirty(fieldName);

                        for (Iterator iter = c.iterator(); iter.hasNext();)
                        {
                            Object o = iter.next();
                            if (!super.contains(o))
                            {
                                if (removed.remove(o) == false)
                                {
                                    added.add(o);
                                }

                                super.add(o);
                                modified = true;
                            }
                        }

                        // Apply updates
                        if (modified)
                        {
                            stateManager.applyUpdates(fieldName, this);
                        }
                        return modified;
                    }
                    finally
                    {
                        pm.releaseFieldUpdateLock();
                    }
                }
                catch (JDOUserException e)
                {
                    Object[] failedObjects = e.getFailedObjectArray();

                    if (modified && (failedObjects != null))
                    {
                        for (int i = 0; i < failedObjects.length; i++)
                        {
                            super.remove(failedObjects[i]);
                        }
                    }

                    throw e;
                }
                finally
                {
                    pm.releaseShareLock();
                }
            }
        }

        return super.addAll(c);
View Full Code Here

        {
            StateManager stateManager = owner.jdoGetStateManager();

            if (stateManager != null)
            {
                PersistenceManager pm = (PersistenceManager) stateManager.getPersistenceManagerInternal();

                pm.acquireShareLock();

                try
                {
                    pm.acquireFieldUpdateLock();
                    try
                    {
                        stateManager.makeDirty(fieldName);

                        boolean modified = super.remove(o);

                        if (modified)
                        {
                            if (added.remove(o) == false)
                            {
                                removed.add(o);
                            }

                            stateManager.applyUpdates(fieldName, this);
                        }

                        return modified;
                    }
                    finally
                    {
                        pm.releaseFieldUpdateLock();
                    }
                }
                finally
                {
                    pm.releaseShareLock();
                }
            }
        }

        return super.remove(o);
View Full Code Here

        {
            StateManager stateManager = owner.jdoGetStateManager();

            if (stateManager != null)
            {
                PersistenceManager pm = (PersistenceManager) stateManager.getPersistenceManagerInternal();

                pm.acquireShareLock();

                try
                {
                    pm.acquireFieldUpdateLock();
                    try
                    {
                        stateManager.makeDirty(fieldName);

                        for (Iterator iter = c.iterator(); iter.hasNext();)
                        {
                            Object o = iter.next();
                            if (super.contains(o))
                            {
                                if (added.remove(o) == false)
                                {
                                    removed.add(o);
                                }
                            }
                        }

                        boolean modified = super.removeAll(c);

                        // Apply updates
                        if (modified)
                        {
                            stateManager.applyUpdates(fieldName, this);
                        }

                        return modified;
                    }
                    finally
                    {
                        pm.releaseFieldUpdateLock();
                    }
                }
                finally
                {
                    pm.releaseShareLock();
                }
            }
        }

        return super.removeAll(c);
View Full Code Here

        {
            StateManager stateManager = owner.jdoGetStateManager();

            if (stateManager != null)
            {
                PersistenceManager pm = (PersistenceManager) stateManager.getPersistenceManagerInternal();

                pm.acquireShareLock();

                try
                {
                    pm.acquireFieldUpdateLock();
                    try
                    {
                        // Mark the field as dirty
                        stateManager.makeDirty(fieldName);

                        for (Iterator iter = super.iterator(); iter.hasNext();)
                        {
                            Object o = iter.next();
                            if (!c.contains(o))
                            {
                                if (added.remove(o) == false)
                                {
                                    removed.add(o);
                                }
                            }
                        }

                        boolean modified = super.retainAll(c);

                        // Apply updates

                        if (modified)
                        {
                            stateManager.applyUpdates(fieldName, this);
                        }

                        return modified;
                    }
                    finally
                    {
                        pm.releaseFieldUpdateLock();
                    }
                }
                finally
                {
                    pm.releaseShareLock();
                }
            }
        }

        return super.retainAll(c);
View Full Code Here

        {
            StateManager stateManager = owner.jdoGetStateManager();

            if (stateManager != null)
            {
                PersistenceManager pm = (PersistenceManager) stateManager.getPersistenceManagerInternal();

                pm.acquireShareLock();

                try
                {
                    pm.acquireFieldUpdateLock();
                    try
                    {
                        // Mark the field as dirty
                        stateManager.makeDirty(fieldName);

                        removed.clear();
                        added.clear();

                        for (Iterator iter = super.iterator(); iter.hasNext();)
                        {
                            removed.add(iter.next());
                        }

                        super.clear();

                        // Apply updates
                        stateManager.applyUpdates(fieldName, this);
                        return;
                    }
                    finally
                    {
                        pm.releaseFieldUpdateLock();
                    }
                }
                finally
                {
                    pm.releaseShareLock();
                }
            }
        }

        super.clear();
View Full Code Here

            if (_caller.owner != null) {
                // Mark the field as dirty
                StateManager stateManager = _caller.owner.jdoGetStateManager();

                if (stateManager != null) {
                    PersistenceManager pm = (PersistenceManager) stateManager.getPersistenceManagerInternal();

                    pm.acquireShareLock();

                    try {
                        pm.acquireFieldUpdateLock();
                        try
                        {
                            stateManager.makeDirty(_caller.fieldName);

                            _iterator.remove();

                            if (added.remove(lastReturned) == false) {
                                removed.add(lastReturned);
                            }

                            stateManager.applyUpdates(_caller.fieldName, _caller);

                        } finally {
                            pm.releaseFieldUpdateLock();
                        }
                    }
                    finally
                    {
                        pm.releaseShareLock();
                    }
                }
            } else {
                // No owner - regular HashSet operation.
                _iterator.remove();
View Full Code Here

TOP

Related Classes of com.sun.jdo.spi.persistence.support.sqlstore.PersistenceManager

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.