Examples of LockManager


Examples of org.apache.jackrabbit.jcr2spi.lock.LockManager

     * @param wspManager
     * @param itemManager
     * @return a new <code>LockManager</code> instance.
     */
    protected LockManager createLockManager(WorkspaceManager wspManager, ItemManager itemManager) {
        LockManager lMgr = new LockManagerImpl(wspManager, itemManager, session.getCacheBehaviour());
        session.addListener((LockManagerImpl) lMgr);
        return lMgr;
    }
View Full Code Here

Examples of org.apache.karaf.main.lock.LockManager

            System.out.println(config.startupMessage);
        }
        BootstrapLogManager.setProperties(config.props);
        Lock lock = createLock();
        KarafLockCallback lockCallback = new KarafLockCallback();
        lockManager = new LockManager(lock, lockCallback, config.lockDelay);
        InstanceHelper.updateInstancePid(config.karafHome, config.karafBase);
        LOG.addHandler(BootstrapLogManager.getDefaultHandler());

        for (String provider : config.securityProviders) {
            addSecurityProvider(provider);
View Full Code Here

Examples of org.apache.ojb.broker.locking.LockManager

    {
        long timeout = conf.getInteger("LockTimeout", 60000);
        log.info("LockTimeout=" + timeout);
        try
        {
            LockManager lm = (LockManager) ClassHelper.newInstance(lockManagerClass);
            lm.setLockTimeout(timeout);
            lockManager = new LockManagerOdmgImpl(lm);
        }
        catch(Exception e)
        {
            throw new OJBRuntimeException("Can't setup odmg lock manager instance", e);
View Full Code Here

Examples of org.apache.ojb.odmg.locking.LockManager

     *
     * @exception  LockNotGrantedException    Description of Exception
     */
    void doSingleLock(ClassDescriptor cld, Object obj, Identity oid, int lockMode) throws LockNotGrantedException
    {
        LockManager lm = implementation.getLockManager();
        if (cld.isAcceptLocks())
        {
            if (lockMode == Transaction.READ)
            {
                if (log.isDebugEnabled()) log.debug("Do READ lock on object: " + oid);
                if(!lm.readLock(this, oid, obj))
                {
                    throw new LockNotGrantedException("Can not lock for READ: " + oid);
                }
            }
            else if (lockMode == Transaction.WRITE)
            {
                if (log.isDebugEnabled()) log.debug("Do WRITE lock on object: " + oid);
                if(!lm.writeLock(this, oid, obj))
                {
                    throw new LockNotGrantedException("Can not lock for WRITE: " + oid);
                }
            }
            else if (lockMode == Transaction.UPGRADE)
            {
                if (log.isDebugEnabled()) log.debug("Do UPGRADE lock on object: " + oid);
                if(!lm.upgradeLock(this, oid, obj))
                {
                    throw new LockNotGrantedException("Can not lock for UPGRADE: " + oid);
                }
            }
        }
View Full Code Here

Examples of org.apache.ojb.otm.lock.LockManager

    private ContextEntry insertInternal(Identity oid, Object userObject,
            int lock, boolean canCreate, Identity insertBeforeThis, Stack stack)
            throws LockingException
    {
        ContextEntry entry;
        LockManager lockManager;
        Swizzling swizzlingStrategy;
        IndirectionHandler handler = null;
        OTMKit kit = _tx.getKit();
        // Are we building object's relations for the userObject in the transaction?
        // Otherwise we just get data from the "userObject" and put it into
        // the previously loaded/created object in the transaction
        boolean buildingObject = false;
        boolean lazySwizzle = false;

        if (lock == LockType.NO_LOCK)
        {
            return null;
        }

        entry = (ContextEntry) _objects.get(oid);

        if (userObject == null)
        {
            // invalidating object...
            _original.remove(oid);
            _checkpointed.remove(oid);
            if (entry != null)
            {
                entry.userObject = null;
                entry.cacheObject = null;
            }
            return entry;
        }

        lockManager = LockManager.getInstance();
        swizzlingStrategy = kit.getSwizzlingStrategy();

        handler = ProxyHelper.getIndirectionHandler(userObject);
        if ((handler != null) && handler.alreadyMaterialized())
        {
            userObject = handler.getRealSubject();
            handler = null;
        }

        if ((entry == null) || (entry.userObject == null))
        {
            // first insertion of the userObject into editing context
            Object swizzledObject = swizzlingStrategy.swizzle(userObject, null, _pb, this);
            entry = new ContextEntry(swizzledObject);
            if (entry.handler != null)
            {
                ObjectCopyStrategy copyStrategy = _tx.getKit().getCopyStrategy(oid);
                entry.cacheObject = copyStrategy.copy(userObject, _pb);
                // Assume that object exists, otherwise were the proxy came from?
                _objects.put(oid, entry);
                lockManager.ensureLock(oid, _tx, lock, _pb); // lock after _objects.put to avoid hanged locks
                entry.handler.addListener(this);
            }
            else
            {
                Object origCacheObj = _pb.getObjectByIdentity(oid);

                if ((origCacheObj == null) && !canCreate)
                {
                    // we don't create the objects by reachability
                    throw new IllegalStateException("Related object is neither persistent, nor otm-depentent: " + oid);
                }
                if (origCacheObj != null)
                {
                    entry.cacheObject = origCacheObj;
                }
                buildingObject = true;
                _objects.put(oid, entry);
                lockManager.ensureLock(oid, _tx, lock, _pb); // lock after _objects.put to avoid hanged locks

                if (userObject != null)
                {
                    if ((origCacheObj == null) && canCreate)
                    {
                        ObjectCopyStrategy copyStrategy = _tx.getKit().getCopyStrategy(oid);
                        entry.cacheObject = copyStrategy.copy(userObject, _pb);
                        entry.state = State.PERSISTENT_NEW;
                        if (kit.isEagerInsert(userObject)
                                || hasBidirectionalAssociation(userObject.getClass()))
                        {
                            _pb.store(entry.cacheObject, entry.state);
                            entry.state = State.PERSISTENT_CLEAN;
                            origCacheObj = entry.cacheObject;
                        }
                    }

                    if (origCacheObj != null)
                    {
                        _original.put(oid, getFields(userObject, false, true));
                    }
                }
            }
            if (insertBeforeThis != null)
            {
                int insertIndex = _order.indexOf(insertBeforeThis);
                _order.add(insertIndex, oid);
            }
            else
            {
                _order.add(oid);
            }
        }
        else
        {
            // The object in context is the same object attempted an insert on
            // Ensure we have the correct lock level
            lockManager.ensureLock(oid, _tx, lock, _pb);

            if (handler == null)
            {
                if (!swizzlingStrategy.isSameInstance(entry.userObject, userObject))
                {
View Full Code Here

Examples of org.apache.openjpa.kernel.LockManager

     */
    public static Collection loadAll(Collection sms, StoreManager store,
        PCState state, int load, FetchConfiguration fetch, Object context) {
        Collection failed = null;
        OpenJPAStateManager sm;
        LockManager lm;
        for (Iterator itr = sms.iterator(); itr.hasNext();) {
            sm = (OpenJPAStateManager) itr.next();
            if (sm.getManagedInstance() == null) {
                if (!store.initialize(sm, state, fetch, context))
                    failed = addFailedId(sm, failed);
            } else if (load != StoreManager.FORCE_LOAD_NONE
                || sm.getPCState() == PCState.HOLLOW) {
                lm = sm.getContext().getLockManager();
                if (!store.load(sm, sm.getUnloaded(fetch), fetch,
                    lm.getLockLevel(sm), context))
                    failed = addFailedId(sm, failed);
            } else if (!store.exists(sm, context))
                failed = addFailedId(sm, failed);
        }
        return (failed == null) ? Collections.EMPTY_LIST : failed;
View Full Code Here

Examples of org.apache.openjpa.kernel.LockManager

        _ctx = ctx;
        _conf = (JDBCConfiguration) ctx.getConfiguration();
        _dict = _conf.getDBDictionaryInstance();
        _sql = _conf.getSQLFactoryInstance();

        LockManager lm = ctx.getLockManager();
        if (lm instanceof JDBCLockManager)
            _lm = (JDBCLockManager) lm;

        if (!ctx.isManaged() && _conf.isConnectionFactoryModeManaged())
            _ds = _conf.getDataSource2(ctx);
View Full Code Here

Examples of org.apache.openjpa.kernel.LockManager

        _conf = conf;
        _dict = _conf.getDBDictionaryInstance();
        _sql = _conf.getSQLFactoryInstance();
        _log = _conf.getLog(JDBCConfiguration.LOG_DIAG);

        LockManager lm = ctx.getLockManager();
        if (lm instanceof JDBCLockManager)
            _lm = (JDBCLockManager) lm;

        _ds = getDataSource(ctx);
View Full Code Here

Examples of org.apache.openjpa.kernel.LockManager

        _ctx = ctx;
        _conf = conf;
        _dict = _conf.getDBDictionaryInstance();
        _sql = _conf.getSQLFactoryInstance();

        LockManager lm = ctx.getLockManager();
        if (lm instanceof JDBCLockManager)
            _lm = (JDBCLockManager) lm;

        if (!ctx.isManaged() && _conf.isConnectionFactoryModeManaged())
            _ds = _conf.getDataSource2(ctx);
View Full Code Here

Examples of org.apache.ws.util.lock.LockManager

           {
              m_resourceIsPersistent = true;
           }*/
        Context initialContext = new InitialContext();
        initResourceMap( initialContext );
        m_lockManager = new LockManager();
        if ( ScheduledResourceTerminationResource.class.isAssignableFrom( getResourceClass() ) )
        {
            initSweeper( initialContext );
        }

View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.