Package org.eclipse.persistence.sessions.server

Examples of org.eclipse.persistence.sessions.server.ClientSession


     * For a client session the accessor is stored for the duration of the transaction.
     */
    public Accessor getAccessor(String poolName, AbstractSession session, DatabaseQuery query, boolean returnNullIfDead) {
        Accessor accessor = null;
        if (session.isClientSession()) {
            ClientSession client = (ClientSession)session;
            // If the client session is exclusive and has a connection then just use the existing connection.
            if (client.isExclusiveIsolatedClientSession() && client.hasWriteConnection()) {
                accessor = client.getWriteConnection();
            } else {
                accessor = client.getWriteConnections().get(poolName);
                if (accessor == null) {
                    accessor = acquireAccessor(poolName, client.getParent(), query, returnNullIfDead);
                    // Assign a write connection for the duration of the transaction.
                    if (client.isExclusiveIsolatedClientSession() || session.isInTransaction()) {
                        accessor = client.addWriteConnection(poolName, accessor);
                    }
                }
            }
        } else if (session.isServerSession()) {
            accessor = acquireAccessor(poolName, (ServerSession)session, query, returnNullIfDead);
View Full Code Here


     */
    protected Object extractPartitionValueForPersist(AbstractSession session, Object object, ClassDescriptor descriptor) {
        if (!session.isClientSession()) {
            return null;
        }
        ClientSession client = (ClientSession)session;
        // Only assign the connection if exclusive.
        if (!client.isExclusiveIsolatedClientSession() || client.hasWriteConnection()) {
            return null;
        }
        return descriptor.getObjectBuilder().extractValueFromObjectForField(object, this.partitionField, session);
    }
View Full Code Here

    * to determine whether the object could be created.
    */
    public static Sequencing createSequencing(AbstractSession session) {
        Sequencing sequencing = null;
        if (session.isClientSession()) {
            ClientSession cs = (ClientSession)session;
            if (ClientSessionSequencing.sequencingServerExists(cs)) {
                sequencing = new ClientSessionSequencing(cs);
            }
        } else if (session.isRemoteSession()) {
            RemoteConnection con = ((DistributedSession)session).getRemoteConnection();
View Full Code Here

    * to determine whether the object could be created.
    */
    public static Sequencing createSequencing(AbstractSession session) {
        Sequencing sequencing = null;
        if (session.isClientSession()) {
            ClientSession cs = (ClientSession)session;
            if (ClientSessionSequencing.sequencingServerExists(cs)) {
                sequencing = new ClientSessionSequencing(cs);
            }
        } else if (session.isRemoteSession()) {
            RemoteConnection con = ((RemoteSession)session).getRemoteConnection();
View Full Code Here

            session.getPlatform().getPartitioningCallback().setPartitionId(nextIndex());
            return null;
        }
        List<Accessor> accessors = new ArrayList<Accessor>(1);
        if (session.isClientSession()) {
            ClientSession client = (ClientSession)session;
            // If the client session already has a connection for the transaction, then just use it.
            if (client.hasWriteConnection() && (session.isExclusiveIsolatedClientSession() || session.isInTransaction())) {
                accessors.add(client.getWriteConnection());
                return accessors;
            }
            Accessor accessor = nextAccessor((ServerSession)session.getParent(), query);
            accessors.add(accessor);
            // Assign a write connection for the duration of the transaction.
View Full Code Here

     * For a client session the accessor is stored for the duration of the transaction.
     */
    public Accessor getAccessor(String poolName, AbstractSession session, DatabaseQuery query, boolean returnNullIfDead) {
        Accessor accessor = null;
        if (session.isClientSession()) {
            ClientSession client = (ClientSession)session;
            // If the client session is exclusive and has a connection then just use the existing connection.
            if (client.isExclusiveIsolatedClientSession() && client.hasWriteConnection()) {
                accessor = client.getWriteConnection();
            } else {
                accessor = client.getWriteConnections().get(poolName);
                if (accessor == null) {
                    accessor = acquireAccessor(poolName, client.getParent(), query, returnNullIfDead);
                    // Assign a write connection for the duration of the transaction.
                    if (client.isExclusiveIsolatedClientSession() || session.isInTransaction()) {
                        accessor = client.addWriteConnection(poolName, accessor);
                    }
                }
            }
        } else if (session.isServerSession()) {
            accessor = acquireAccessor(poolName, (ServerSession)session, query, returnNullIfDead);
View Full Code Here

     */
    protected Object extractPartitionValueForPersist(AbstractSession session, Object object, ClassDescriptor descriptor) {
        if (!session.isClientSession()) {
            return null;
        }
        ClientSession client = (ClientSession)session;
        // Only assign the connection if exclusive.
        if (!client.isExclusiveIsolatedClientSession() || client.hasWriteConnection()) {
            return null;
        }
        return descriptor.getObjectBuilder().extractValueFromObjectForField(object, this.partitionField, session);
    }
View Full Code Here

    * to determine whether the object could be created.
    */
    public static Sequencing createSequencing(AbstractSession session) {
        Sequencing sequencing = null;
        if (session.isClientSession()) {
            ClientSession cs = (ClientSession)session;
            if (ClientSessionSequencing.sequencingServerExists(cs)) {
                sequencing = new ClientSessionSequencing(cs);
            }
        } else if (session.isRemoteSession()) {
            RemoteConnection con = ((RemoteSession)session).getRemoteConnection();
View Full Code Here

    * to determine whether the object could be created.
    */
    public static Sequencing createSequencing(AbstractSession session) {
        Sequencing sequencing = null;
        if (session.isClientSession()) {
            ClientSession cs = (ClientSession)session;
            if (ClientSessionSequencing.sequencingServerExists(cs)) {
                sequencing = new ClientSessionSequencing(cs);
            }
        } else if (session.isRemoteSession()) {
            RemoteConnection con = ((RemoteSession)session).getRemoteConnection();
View Full Code Here

        // use local uow as it will be local to this EM and not on the txn
        if (this.extendedPersistenceContext == null || !this.extendedPersistenceContext.isActive()) {
            if(this.connectionPolicy == null) {
                createConnectionPolicy();
            }
            ClientSession client = this.serverSession.acquireClientSession(connectionPolicy, properties);
            this.extendedPersistenceContext = new RepeatableWriteUnitOfWork(client, this.referenceMode);
            this.extendedPersistenceContext.setResumeUnitOfWorkOnTransactionCompletion(!this.closeOnCommit);
            this.extendedPersistenceContext.setShouldDiscoverNewObjects(this.persistOnCommit);
            this.extendedPersistenceContext.setDiscoverUnregisteredNewObjectsWithoutPersist(this.commitWithoutPersistRules);
            this.extendedPersistenceContext.setFlushClearCache(this.flushClearCache);
            this.extendedPersistenceContext.setShouldValidateExistence(this.shouldValidateExistence);
            this.extendedPersistenceContext.setShouldOrderUpdates(this.shouldOrderUpdates);
            this.extendedPersistenceContext.setShouldCascadeCloneToJoinedRelationship(true);
            this.extendedPersistenceContext.setShouldStoreByPassCache(this.cacheStoreBypass);
            if (txn != null) {
                // if there is an active txn we must register with it on
                // creation of PC
                transaction.registerUnitOfWorkWithTxn(this.extendedPersistenceContext);
            }
            if (client.shouldLog(SessionLog.FINER, SessionLog.TRANSACTION)) {
                client.log(SessionLog.FINER, SessionLog.TRANSACTION, "acquire_unit_of_work_with_argument", String.valueOf(System.identityHashCode(this.extendedPersistenceContext)));
            }
        }
        if (this.beginEarlyTransaction && txn != null && !this.extendedPersistenceContext.isInTransaction()) {
            // gf3334, force persistence context early transaction
            this.extendedPersistenceContext.beginEarlyTransaction();
View Full Code Here

TOP

Related Classes of org.eclipse.persistence.sessions.server.ClientSession

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.