Package com.sun.ejb.containers

Examples of com.sun.ejb.containers.EJBObjectImpl


            throw new EJBException(
                "Null primary key returned by ejbCreate method");
       
        if ( (isRemote) && (!inv.isLocal) ) {
            // remote EjbInvocation: create EJBObject
            EJBObjectImpl ejbObjImpl = internalGetEJBObjectImpl(primaryKey, null, true);
           
            // associate the context with the ejbObject
            containerStateManager.attachObject(inv, (EJBContextImpl)inv.context, ejbObjImpl, null);
        }
       
View Full Code Here


    }
   
    private void removeEJBObjectFromStore(Object primaryKey, boolean decrementRefCount) {
        // Remove the EJBObject from ejbObjectStore so future lookups
        // in internalGetEJBObject will not get it.
        EJBObjectImpl ejbObjImpl =
            (EJBObjectImpl)ejbObjectStore.remove(primaryKey, decrementRefCount);
                                                
        if ( ejbObjImpl != null ) {
            synchronized ( ejbObjImpl ) {
                // disconnect the EJBObject from the ProtocolManager
                // so that no remote invocations can reach the EJBObject
                remoteHomeRefFactory.destroyReference(ejbObjImpl.getStub(),
                                                  ejbObjImpl.getEJBObject());
            }
        }
    }
View Full Code Here

    EJBObject getEJBObjectStub(Object primaryKey, byte[] streamKey) { 
        // primary key cant be null, streamkey may be null

        // check if the EJBObject exists in the store.
        try {
            EJBObjectImpl ejbObjImpl =
                (EJBObjectImpl) ejbObjectStore.get(primaryKey);
            if ( (ejbObjImpl != null) && (ejbObjImpl.getStub() != null) ) {
                return (EJBObject) ejbObjImpl.getStub();
            }

            // create a new stub without creating the EJBObject itself
            if ( streamKey == null ) {
                streamKey = EJBUtils.serializeObject(primaryKey, false);
View Full Code Here

        // primary key cant be null, streamkey may be null
       
        // check if the EJBContext/EJBObject exists in the store.
        try {
           
            EJBObjectImpl ejbObjImpl = (EJBObjectImpl)
                ejbObjectStore.get(primaryKey, incrementRefCount);

            if ( (ejbObjImpl != null) && (ejbObjImpl.getStub() != null) ) {
                return ejbObjImpl;
            }
           
            // check if the EJBContext/EJBObject exists in threadlocal
            // This happens if ejbo is in the process of being created.
            // This is necessary to prevent infinite recursion
            // because PRO.narrow calls is_a which calls the
            // ProtocolMgr which calls getEJBObject.
            ejbObjImpl = (EJBObjectImpl) ejbServant.get();
            if ( ejbObjImpl != null ) {
                return ejbObjImpl;
            }
           
            // set ejbo in thread local to help recursive calls find the ejbo
            ejbServant.set(ejbObjImpl);
           
            // "Connect" the EJBObject to the Protocol Manager
           
            if ( streamKey == null ) {
                streamKey = EJBUtils.serializeObject(primaryKey, false);
            }
            EJBObject ejbStub = (EJBObject)
                remoteHomeRefFactory.createRemoteReference(streamKey);
                                                          
            // create the EJBObject and associate it with the stub
            // and the primary key
            ejbObjImpl = instantiateEJBObjectImpl(ejbStub, primaryKey);
           
            ejbServant.set(null);
           
            if ((incrementRefCount || cacheEJBO)) {
                EJBObjectImpl ejbo1 =
                    (EJBObjectImpl) ejbObjectStore.put(primaryKey, ejbObjImpl,
                        incrementRefCount);
                if ((ejbo1 != null) && (ejbo1 != ejbObjImpl)) {
                    remoteHomeRefFactory.destroyReference(ejbObjImpl.getStub(),
                                                      ejbObjImpl);
View Full Code Here

            // No need to create/set EJBObject if this EJB isRemote too.
        // This saves remote object creation overhead.
        // The EJBObject and stub will get created lazily if needed
        // when EntityContext.getEJBObjectImpl is called.
        } else { // remote EjbInvocation
            EJBObjectImpl ejbObjImpl =
                internalGetEJBObjectImpl(primaryKey, null, true);
            containerStateManager.attachObject(inv, context, ejbObjImpl, null);
           
            if ( isLocal ) {
                // Create EJBLocalObject so EntityContext methods work
View Full Code Here

        // destroy all EJBObject refs
       
        try {
            Iterator elements = ejbObjectStore.values();
            while ( elements.hasNext() ) {
                EJBObjectImpl ejbObjImpl = (EJBObjectImpl) elements.next();
                try {
                    if ( isRemote ) {
                        remoteHomeRefFactory.destroyReference
                            (ejbObjImpl.getStub(), ejbObjImpl.getEJBObject());
                                                   
                    }
                } catch ( Exception ex ) {
                    _logger.log(Level.FINE, "Exception in undeploy()", ex);
                }
View Full Code Here

            throw new EJBException(
                "Null primary key returned by ejbCreate method");
       
        if ( (isRemote) && (!inv.isLocal) ) {
            // remote EjbInvocation: create EJBObject
            EJBObjectImpl ejbObjImpl = internalGetEJBObjectImpl(primaryKey, null, true);
           
            // associate the context with the ejbObject
            containerStateManager.attachObject(inv, (EJBContextImpl)inv.context, ejbObjImpl, null);
        }
       
View Full Code Here

    }
   
    private void removeEJBObjectFromStore(Object primaryKey, boolean decrementRefCount) {
        // Remove the EJBObject from ejbObjectStore so future lookups
        // in internalGetEJBObject will not get it.
        EJBObjectImpl ejbObjImpl =
            (EJBObjectImpl)ejbObjectStore.remove(primaryKey, decrementRefCount);
                                                
        if ( ejbObjImpl != null ) {
            synchronized ( ejbObjImpl ) {
                // disconnect the EJBObject from the ProtocolManager
                // so that no remote invocations can reach the EJBObject
                remoteHomeRefFactory.destroyReference(ejbObjImpl.getStub(),
                                                  ejbObjImpl.getEJBObject());
            }
        }
    }
View Full Code Here

    EJBObject getEJBObjectStub(Object primaryKey, byte[] streamKey) { 
        // primary key cant be null, streamkey may be null

        // check if the EJBObject exists in the store.
        try {
            EJBObjectImpl ejbObjImpl =
                (EJBObjectImpl) ejbObjectStore.get(primaryKey);
            if ( (ejbObjImpl != null) && (ejbObjImpl.getStub() != null) ) {
                return (EJBObject) ejbObjImpl.getStub();
            }

            // create a new stub without creating the EJBObject itself
            if ( streamKey == null ) {
                streamKey = EJBUtils.serializeObject(primaryKey, false);
View Full Code Here

        // primary key cant be null, streamkey may be null
       
        // check if the EJBContext/EJBObject exists in the store.
        try {
           
            EJBObjectImpl ejbObjImpl = (EJBObjectImpl)
                ejbObjectStore.get(primaryKey, incrementRefCount);

            if ( (ejbObjImpl != null) && (ejbObjImpl.getStub() != null) ) {
                return ejbObjImpl;
            }
           
            // check if the EJBContext/EJBObject exists in threadlocal
            // This happens if ejbo is in the process of being created.
            // This is necessary to prevent infinite recursion
            // because PRO.narrow calls is_a which calls the
            // ProtocolMgr which calls getEJBObject.
            ejbObjImpl = (EJBObjectImpl) ejbServant.get();
            if ( ejbObjImpl != null ) {
                return ejbObjImpl;
            }
           
            // set ejbo in thread local to help recursive calls find the ejbo
            ejbServant.set(ejbObjImpl);
           
            // "Connect" the EJBObject to the Protocol Manager
           
            if ( streamKey == null ) {
                streamKey = EJBUtils.serializeObject(primaryKey, false);
            }
            EJBObject ejbStub = (EJBObject)
                remoteHomeRefFactory.createRemoteReference(streamKey);
                                                          
            // create the EJBObject and associate it with the stub
            // and the primary key
            ejbObjImpl = instantiateEJBObjectImpl(ejbStub, primaryKey);
           
            ejbServant.set(null);
           
            if ((incrementRefCount || cacheEJBO)) {
                EJBObjectImpl ejbo1 =
                    (EJBObjectImpl) ejbObjectStore.put(primaryKey, ejbObjImpl,
                        incrementRefCount);
                if ((ejbo1 != null) && (ejbo1 != ejbObjImpl)) {
                    remoteHomeRefFactory.destroyReference(ejbObjImpl.getStub(),
                                                      ejbObjImpl);
View Full Code Here

TOP

Related Classes of com.sun.ejb.containers.EJBObjectImpl

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.