View | Details | Raw Unified | Return to bug 326334
Collapse All | Expand All

(-)a/foundation/eclipselink.core.test/src/org/eclipse/persistence/testing/tests/distributedservers/rcm/broadcast/BroadcastDistributedServersModel.java (+4 lines)
Lines 22-27 public abstract class BroadcastDistributedServersModel extends RCMDistributedSer Link Here
22
    // maximum wait time to give a chance to remote command recipient to process it before verification.
22
    // maximum wait time to give a chance to remote command recipient to process it before verification.
23
    public long timeToWaitBeforeVerify;
23
    public long timeToWaitBeforeVerify;
24
24
25
    public void addSuperTests() {
26
        super.addTests();
27
    }
28
    
25
    public void addTests() {
29
    public void addTests() {
26
        super.addTests();
30
        super.addTests();
27
31
(-)a/foundation/eclipselink.core.test/src/org/eclipse/persistence/testing/tests/simultaneous/AddDescriptorsMultithreadedTest.java (-1 / +1 lines)
Lines 157-163 public class AddDescriptorsMultithreadedTest extends MultithreadTestCase { Link Here
157
            // if numberOfTests = 10 then the first test uses k = 0, 10, 20 etc; the second k = 1, 11, 21 etc. 
157
            // if numberOfTests = 10 then the first test uses k = 0, 10, 20 etc; the second k = 1, 11, 21 etc. 
158
            for (int k = testNumber; k < nSize; k = k + numberOfTests) {
158
            for (int k = testNumber; k < nSize; k = k + numberOfTests) {
159
                ClassDescriptor descriptor = project.getOrderedDescriptors().get(k);
159
                ClassDescriptor descriptor = project.getOrderedDescriptors().get(k);
160
                getAbstractSession().log(SessionLog.FINEST, "AddDescriptorsTest adding descriptor for class = " + Helper.getShortClassName(descriptor.getJavaClass()), new Object[]{}, null, false);
160
                getAbstractSession().log(SessionLog.FINEST, SessionLog.MISC, "AddDescriptorsTest adding descriptor for class = " + Helper.getShortClassName(descriptor.getJavaClass()), new Object[]{}, null, false);
161
                DatabaseField sequenceNumberField = descriptor.getMappingForAttributeName("id").getField();
161
                DatabaseField sequenceNumberField = descriptor.getMappingForAttributeName("id").getField();
162
                descriptor.setSequenceNumberField(sequenceNumberField);
162
                descriptor.setSequenceNumberField(sequenceNumberField);
163
                String seqName = "SEQ_" + sequenceNumberField.getTableName();
163
                String seqName = "SEQ_" + sequenceNumberField.getTableName();
(-)a/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/config/PersistenceUnitProperties.java (+14 lines)
Lines 2385-2390 public class PersistenceUnitProperties { Link Here
2385
    public static final String TUNING = "eclipselink.tuning";
2385
    public static final String TUNING = "eclipselink.tuning";
2386
2386
2387
    /**
2387
    /**
2388
     * The <code>"eclipselink.memory.free-metadata"</code>property configures the JPA
2389
     * internal deployment metadata to be released after deployment.
2390
     * This conserves memory, as the metadata is no longer required, but make
2391
     * future deployments of any other application take longer, as the metadata must be re-allocated.
2392
     * <p>
2393
     * Values (case insensitive):
2394
     * <ul>
2395
     * <li>"true"
2396
     * <li>"false" (DEFAULT)
2397
     * </ul>
2398
     */
2399
    public static final String FREE_METADATA = "eclipselink.memory.free-metadata";
2400
    
2401
    /**
2388
     * The <code>"eclipselink.transaction.join-existing"</code> property Set to
2402
     * The <code>"eclipselink.transaction.join-existing"</code> property Set to
2389
     * "true" this property forces persistence context to read through
2403
     * "true" this property forces persistence context to read through
2390
     * JTA-managed ("write") connection in case there is an active
2404
     * JTA-managed ("write") connection in case there is an active
(-)a/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/internal/sessions/AbstractSession.java (-5 / +9 lines)
Lines 684-690 public abstract class AbstractSession extends CoreAbstractSession<ClassDescripto Link Here
684
                DatabaseException exceptionToThrow = databaseException;
684
                DatabaseException exceptionToThrow = databaseException;
685
                Object[] args = new Object[1];
685
                Object[] args = new Object[1];
686
                args[0] = databaseException;
686
                args[0] = databaseException;
687
                log(SessionLog.INFO, "communication_failure_attempting_begintransaction_retry", args, null);
687
                log(SessionLog.INFO, SessionLog.TRANSACTION, "communication_failure_attempting_begintransaction_retry", args, null);
688
                // Attempt to reconnect connection.
688
                // Attempt to reconnect connection.
689
                exceptionToThrow = retryTransaction(accessor, databaseException, 0, this);
689
                exceptionToThrow = retryTransaction(accessor, databaseException, 0, this);
690
                if (exceptionToThrow == null) {
690
                if (exceptionToThrow == null) {
Lines 729-735 public abstract class AbstractSession extends CoreAbstractSession<ClassDescripto Link Here
729
                    Thread.currentThread().sleep(getLogin().getDelayBetweenConnectionAttempts());
729
                    Thread.currentThread().sleep(getLogin().getDelayBetweenConnectionAttempts());
730
                    Object[] args = new Object[1];
730
                    Object[] args = new Object[1];
731
                    args[0] = databaseException;
731
                    args[0] = databaseException;
732
                    log(SessionLog.INFO, "communication_failure_attempting_begintransaction_retry", args, null);
732
                    log(SessionLog.INFO, SessionLog.TRANSACTION, "communication_failure_attempting_begintransaction_retry", args, null);
733
                } catch (InterruptedException intEx) {
733
                } catch (InterruptedException intEx) {
734
                    break;
734
                    break;
735
                }
735
                }
Lines 1829-1835 public abstract class AbstractSession extends CoreAbstractSession<ClassDescripto Link Here
1829
                    if (databaseException.isCommunicationFailure()) {
1829
                    if (databaseException.isCommunicationFailure()) {
1830
                        Object[] args = new Object[1];
1830
                        Object[] args = new Object[1];
1831
                        args[0] = databaseException;
1831
                        args[0] = databaseException;
1832
                        log(SessionLog.INFO, "communication_failure_attempting_query_retry", args, null);
1832
                        log(SessionLog.INFO, SessionLog.QUERY, "communication_failure_attempting_query_retry", args, null);
1833
                        Object result = retryQuery(query, row, databaseException, retryCount, this);
1833
                        Object result = retryQuery(query, row, databaseException, retryCount, this);
1834
                        if (result instanceof DatabaseException) {
1834
                        if (result instanceof DatabaseException) {
1835
                            exception = (DatabaseException)result;
1835
                            exception = (DatabaseException)result;
Lines 3492-3498 public abstract class AbstractSession extends CoreAbstractSession<ClassDescripto Link Here
3492
        if (this.isLoggingOff) {
3492
        if (this.isLoggingOff) {
3493
            return;
3493
            return;
3494
        }
3494
        }
3495
        log(SessionLog.FINER, message, (Object[])null, null, false);
3495
        log(SessionLog.FINER, SessionLog.MISC, message, (Object[])null, null, false);
3496
    }
3496
    }
3497
3497
3498
    /**
3498
    /**
Lines 4421-4427 public abstract class AbstractSession extends CoreAbstractSession<ClassDescripto Link Here
4421
                level = SessionLog.ALL;
4421
                level = SessionLog.ALL;
4422
                ;
4422
                ;
4423
            }
4423
            }
4424
            log(level, message, null, null, false);
4424
            log(level, SessionLog.PROPAGATION, message, null, null, false);
4425
        }
4425
        }
4426
    }
4426
    }
4427
4427
Lines 4689-4695 public abstract class AbstractSession extends CoreAbstractSession<ClassDescripto Link Here
4689
     * </p><p>
4689
     * </p><p>
4690
     * @param accessor  the connection that generated the log entry
4690
     * @param accessor  the connection that generated the log entry
4691
     * </p>
4691
     * </p>
4692
     * @deprecated since 2.6 replaced by log with category, log(int, String, String, Object[], Accessor)
4692
     */
4693
     */
4694
    @Deprecated
4693
    public void log(int level, String message, Object[] params, Accessor accessor) {
4695
    public void log(int level, String message, Object[] params, Accessor accessor) {
4694
        if (this.isLoggingOff) {
4696
        if (this.isLoggingOff) {
4695
            return;
4697
            return;
Lines 4713-4719 public abstract class AbstractSession extends CoreAbstractSession<ClassDescripto Link Here
4713
     * </p><p>
4715
     * </p><p>
4714
     * @param shouldTranslate  true if the message needs to be translated.
4716
     * @param shouldTranslate  true if the message needs to be translated.
4715
     * </p>
4717
     * </p>
4718
     * @deprecated since 2.6 replaced by log with category, log(int, String, String, Object[], Accessor, boolean)
4716
     */
4719
     */
4720
    @Deprecated
4717
    public void log(int level, String message, Object[] params, Accessor accessor, boolean shouldTranslate) {
4721
    public void log(int level, String message, Object[] params, Accessor accessor, boolean shouldTranslate) {
4718
        if (this.isLoggingOff) {
4722
        if (this.isLoggingOff) {
4719
            return;
4723
            return;
(-)a/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/internal/sessions/DatabaseSessionImpl.java (-1 / +1 lines)
Lines 1007-1013 public class DatabaseSessionImpl extends AbstractSession implements org.eclipse. Link Here
1007
                try {
1007
                try {
1008
                    // Give the failover time to recover.
1008
                    // Give the failover time to recover.
1009
                    Thread.currentThread().sleep(getLogin().getDelayBetweenConnectionAttempts());
1009
                    Thread.currentThread().sleep(getLogin().getDelayBetweenConnectionAttempts());
1010
                    log(SessionLog.INFO, "communication_failure_attempting_query_retry", (Object[])null, null);
1010
                    log(SessionLog.INFO, SessionLog.QUERY, "communication_failure_attempting_query_retry", (Object[])null, null);
1011
                } catch (InterruptedException intEx) {
1011
                } catch (InterruptedException intEx) {
1012
                    break;
1012
                    break;
1013
                }
1013
                }
(-)a/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/internal/sessions/coordination/ProfileDiscoveryStartedCommand.java (-40 lines)
Lines 1-40 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 1998, 2013 Oracle and/or its affiliates. All rights reserved.
3
 * This program and the accompanying materials are made available under the 
4
 * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
5
 * which accompanies this distribution. 
6
 * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
7
 * and the Eclipse Distribution License is available at 
8
 * http://www.eclipse.org/org/documents/edl-v10.php.
9
 *
10
 * Contributors:
11
 *     Oracle - initial API and implementation from Oracle TopLink
12
 ******************************************************************************/  
13
package org.eclipse.persistence.internal.sessions.coordination;
14
15
import org.eclipse.persistence.internal.sessions.AbstractSession;
16
import org.eclipse.persistence.sessions.coordination.RemoteCommandManager;
17
import org.eclipse.persistence.sessions.SessionProfiler;
18
19
/**
20
 * <p>
21
 * <b>Purpose</b>: This class provides an implementation of an internal RCM Command.
22
 * <p>
23
 * <b>Description</b>: This command is used for DMS profiling.
24
 * <p>
25
 *  @since TopLink 10.1.3
26
 */
27
public class ProfileDiscoveryStartedCommand extends RCMCommand {
28
29
    /**
30
     * INTERNAL:
31
     * Executed the internal RCM command
32
     */
33
    public void executeWithSession(AbstractSession session) {
34
        session.updateProfile(SessionProfiler.RcmStatus, "Started");
35
    }
36
37
    public void executeWithRCM(RemoteCommandManager rcm) {
38
        // not used for this internal command
39
    }
40
}
(-)a/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/internal/sessions/coordination/ProfileDiscoveryStoppedCommand.java (-40 lines)
Lines 1-40 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 1998, 2013 Oracle and/or its affiliates. All rights reserved.
3
 * This program and the accompanying materials are made available under the 
4
 * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
5
 * which accompanies this distribution. 
6
 * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
7
 * and the Eclipse Distribution License is available at 
8
 * http://www.eclipse.org/org/documents/edl-v10.php.
9
 *
10
 * Contributors:
11
 *     Oracle - initial API and implementation from Oracle TopLink
12
 ******************************************************************************/  
13
package org.eclipse.persistence.internal.sessions.coordination;
14
15
import org.eclipse.persistence.internal.sessions.AbstractSession;
16
import org.eclipse.persistence.sessions.coordination.RemoteCommandManager;
17
import org.eclipse.persistence.sessions.SessionProfiler;
18
19
/**
20
 * <p>
21
 * <b>Purpose</b>: This class provides an implementation of an internal RCM Command.
22
 * <p>
23
 * <b>Description</b>: This command is used for DMS profiling.
24
 * <p>
25
 *  @since TopLink 10.1.3
26
 */
27
public class ProfileDiscoveryStoppedCommand extends RCMCommand {
28
29
    /**
30
     * INTERNAL:
31
     * Executed the internal RCM command
32
     */
33
    public void executeWithSession(AbstractSession session) {
34
        session.updateProfile(SessionProfiler.RcmStatus, "Stopped");
35
    }
36
37
    public void executeWithRCM(RemoteCommandManager rcm) {
38
        // not used for this internal command
39
    }
40
}
(-)a/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/internal/sessions/coordination/ProfileMessageReceiveCommand.java (-40 lines)
Lines 1-40 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 1998, 2013 Oracle and/or its affiliates. All rights reserved.
3
 * This program and the accompanying materials are made available under the 
4
 * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
5
 * which accompanies this distribution. 
6
 * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
7
 * and the Eclipse Distribution License is available at 
8
 * http://www.eclipse.org/org/documents/edl-v10.php.
9
 *
10
 * Contributors:
11
 *     Oracle - initial API and implementation from Oracle TopLink
12
 ******************************************************************************/  
13
package org.eclipse.persistence.internal.sessions.coordination;
14
15
import org.eclipse.persistence.internal.sessions.AbstractSession;
16
import org.eclipse.persistence.sessions.coordination.RemoteCommandManager;
17
import org.eclipse.persistence.sessions.SessionProfiler;
18
19
/**
20
 * <p>
21
 * <b>Purpose</b>: This class provides an implementation of an internal RCM Command.
22
 * <p>
23
 * <b>Description</b>: This command is used for DMS profiling.
24
 * <p>
25
 *  @since TopLink 10.1.3
26
 */
27
public class ProfileMessageReceiveCommand extends RCMCommand {
28
29
    /**
30
     * INTERNAL:
31
     * Executed the internal RCM command
32
     */
33
    public void executeWithSession(AbstractSession session) {
34
        session.incrementProfile(SessionProfiler.RcmReceived);
35
    }
36
37
    public void executeWithRCM(RemoteCommandManager rcm) {
38
        // not used for this internal command
39
    }
40
}
(-)a/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/internal/sessions/coordination/ProfileMessageSentCommand.java (-40 lines)
Lines 1-40 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 1998, 2013 Oracle and/or its affiliates. All rights reserved.
3
 * This program and the accompanying materials are made available under the 
4
 * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
5
 * which accompanies this distribution. 
6
 * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
7
 * and the Eclipse Distribution License is available at 
8
 * http://www.eclipse.org/org/documents/edl-v10.php.
9
 *
10
 * Contributors:
11
 *     Oracle - initial API and implementation from Oracle TopLink
12
 ******************************************************************************/  
13
package org.eclipse.persistence.internal.sessions.coordination;
14
15
import org.eclipse.persistence.internal.sessions.AbstractSession;
16
import org.eclipse.persistence.sessions.coordination.RemoteCommandManager;
17
import org.eclipse.persistence.sessions.SessionProfiler;
18
19
/**
20
 * <p>
21
 * <b>Purpose</b>: This class provides an implementation of an internal RCM Command.
22
 * <p>
23
 * <b>Description</b>: This command is used for DMS profiling.
24
 * <p>
25
 *  @since TopLink 10.1.3
26
 */
27
public class ProfileMessageSentCommand extends RCMCommand {
28
29
    /**
30
     * INTERNAL:
31
     * Executed the internal RCM command
32
     */
33
    public void executeWithSession(AbstractSession session) {
34
        session.incrementProfile(SessionProfiler.RcmSent);
35
    }
36
37
    public void executeWithRCM(RemoteCommandManager rcm) {
38
        // not used for this internal command
39
    }
40
}
(-)a/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/internal/sessions/coordination/ProfileRemoteChangeSetCommand.java (-40 lines)
Lines 1-40 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 1998, 2013 Oracle and/or its affiliates. All rights reserved.
3
 * This program and the accompanying materials are made available under the 
4
 * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
5
 * which accompanies this distribution. 
6
 * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
7
 * and the Eclipse Distribution License is available at 
8
 * http://www.eclipse.org/org/documents/edl-v10.php.
9
 *
10
 * Contributors:
11
 *     Oracle - initial API and implementation from Oracle TopLink
12
 ******************************************************************************/  
13
package org.eclipse.persistence.internal.sessions.coordination;
14
15
import org.eclipse.persistence.internal.sessions.AbstractSession;
16
import org.eclipse.persistence.sessions.coordination.RemoteCommandManager;
17
import org.eclipse.persistence.sessions.SessionProfiler;
18
19
/**
20
 * <p>
21
 * <b>Purpose</b>: This class provides an implementation of an internal RCM Command.
22
 * <p>
23
 * <b>Description</b>: This command is used for DMS profiling.
24
 * <p>
25
 *  @since TopLink 10.1.3
26
 */
27
public class ProfileRemoteChangeSetCommand extends RCMCommand {
28
29
    /**
30
     * INTERNAL:
31
     * Executed the internal RCM command
32
     */
33
    public void executeWithSession(AbstractSession session) {
34
        session.incrementProfile(SessionProfiler.RemoteChangeSet);
35
    }
36
37
    public void executeWithRCM(RemoteCommandManager rcm) {
38
        // not used for this internal command
39
    }
40
}
(-)a/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/logging/SessionLog.java (+2 lines)
Lines 112-117 public interface SessionLog extends Cloneable { Link Here
112
    public static final String DMS = "dms";
112
    public static final String DMS = "dms";
113
    public static final String METADATA = "metadata";
113
    public static final String METADATA = "metadata";
114
    public static final String MONITORING = "monitoring";
114
    public static final String MONITORING = "monitoring";
115
    public static final String MISC = "misc";
116
    
115
    /**
117
    /**
116
     * @deprecated use {@link #METADATA}
118
     * @deprecated use {@link #METADATA}
117
     */
119
     */
(-)a/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/platform/database/HANAPlatform.java (-6 / +6 lines)
Lines 210-219 public final class HANAPlatform extends DatabasePlatform { Link Here
210
210
211
    /**
211
    /**
212
     * Creates the expression operator representing the JPQL function current_timestamp as defined
212
     * Creates the expression operator representing the JPQL function current_timestamp as defined
213
     * by § 4.6.17.2.3 of the JPA 2.0 specification
213
     * by 4.6.17.2.3 of the JPA 2.0 specification
214
     * 
214
     * 
215
     * @return the expression operator representing the JPQL function current_timestamp as defined
215
     * @return the expression operator representing the JPQL function current_timestamp as defined
216
     *         by § 4.6.17.2.3 of the JPA 2.0 specification
216
     *         by 4.6.17.2.3 of the JPA 2.0 specification
217
     */
217
     */
218
    private static final ExpressionOperator createTodayExpressionOperator() {
218
    private static final ExpressionOperator createTodayExpressionOperator() {
219
        return ExpressionOperator.simpleLogicalNoParens(ExpressionOperator.Today,
219
        return ExpressionOperator.simpleLogicalNoParens(ExpressionOperator.Today,
Lines 221-230 public final class HANAPlatform extends DatabasePlatform { Link Here
221
    }
221
    }
222
222
223
    /**
223
    /**
224
     * Creates the expression operator representing the JPQL function current_date as defined by §
224
     * Creates the expression operator representing the JPQL function current_date as defined by 
225
     * 4.6.17.2.3 of the JPA 2.0 specification
225
     * 4.6.17.2.3 of the JPA 2.0 specification
226
     * 
226
     * 
227
     * @return the expression operator representing the JPQL function current_date as defined by §
227
     * @return the expression operator representing the JPQL function current_date as defined by 
228
     *         4.6.17.2.3 of the JPA 2.0 specification
228
     *         4.6.17.2.3 of the JPA 2.0 specification
229
     */
229
     */
230
    private static final ExpressionOperator createCurrentDateExpressionOperator() {
230
    private static final ExpressionOperator createCurrentDateExpressionOperator() {
Lines 234-243 public final class HANAPlatform extends DatabasePlatform { Link Here
234
234
235
    /**
235
    /**
236
     * Creates the expression operator representing the JPQL function current_timestamp as defined
236
     * Creates the expression operator representing the JPQL function current_timestamp as defined
237
     * by § 4.6.17.2.3 of the JPA 2.0 specification
237
     * by 4.6.17.2.3 of the JPA 2.0 specification
238
     * 
238
     * 
239
     * @return the expression operator representing the JPQL function current_timestamp as defined
239
     * @return the expression operator representing the JPQL function current_timestamp as defined
240
     *         by § 4.6.17.2.3 of the JPA 2.0 specification
240
     *         by 4.6.17.2.3 of the JPA 2.0 specification
241
     */
241
     */
242
    private static final ExpressionOperator createCurrentTimeExpressionOperator() {
242
    private static final ExpressionOperator createCurrentTimeExpressionOperator() {
243
        return ExpressionOperator.simpleLogicalNoParens(ExpressionOperator.CurrentTime,
243
        return ExpressionOperator.simpleLogicalNoParens(ExpressionOperator.CurrentTime,
(-)a/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/sessions/coordination/CommandProcessor.java (+12 lines)
Lines 96-101 public interface CommandProcessor { Link Here
96
96
97
    /**
97
    /**
98
     * PUBLIC:
98
     * PUBLIC:
99
     * Log the profile event.
100
     */
101
    public void incrementProfile(String counter);
102
    
103
    /**
104
     * PUBLIC:
105
     * Log the profile event.
106
     */
107
    public void updateProfile(String info, Object value);    
108
    
109
    /**
110
     * PUBLIC:
99
     * Allow the implementation class to handle an exception thrown in in the remote
111
     * Allow the implementation class to handle an exception thrown in in the remote
100
     * command service. The implementation may choose to simply rethrow the
112
     * command service. The implementation may choose to simply rethrow the
101
     * exception if it does not want to handle it.
113
     * exception if it does not want to handle it.
(-)a/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/sessions/coordination/DiscoveryManager.java (-7 / +5 lines)
Lines 16-21 import java.net.*; Link Here
16
import java.io.IOException;
16
import java.io.IOException;
17
import org.eclipse.persistence.exceptions.DiscoveryException;
17
import org.eclipse.persistence.exceptions.DiscoveryException;
18
import org.eclipse.persistence.internal.sessions.coordination.*;
18
import org.eclipse.persistence.internal.sessions.coordination.*;
19
import org.eclipse.persistence.sessions.SessionProfiler;
19
20
20
/**
21
/**
21
 * <p>
22
 * <p>
Lines 116-124 public class DiscoveryManager implements Runnable { Link Here
116
     * Announce the local service and join the cluster
117
     * Announce the local service and join the cluster
117
     */
118
     */
118
    public void startDiscovery() {
119
    public void startDiscovery() {
119
        if (rcm.isCommandProcessorASession()) {
120
        this.rcm.getCommandProcessor().updateProfile(SessionProfiler.RcmStatus, "Started");
120
            rcm.getCommandProcessor().processCommand(new ProfileDiscoveryStartedCommand());
121
        }
122
121
123
        // Only start if we are currently stopped
122
        // Only start if we are currently stopped
124
        if (this.isDiscoveryStopped()) {
123
        if (this.isDiscoveryStopped()) {
Lines 132-147 public class DiscoveryManager implements Runnable { Link Here
132
     * Note that this does not remove the local service from the cluster.
131
     * Note that this does not remove the local service from the cluster.
133
     */
132
     */
134
    public void stopDiscovery() {
133
    public void stopDiscovery() {
135
        if (rcm.isCommandProcessorASession()) {
134
        this.rcm.getCommandProcessor().updateProfile(SessionProfiler.RcmStatus, "Stopped");
136
            this.rcm.getCommandProcessor().processCommand(new ProfileDiscoveryStoppedCommand());
135
137
        }
138
        stopListening();
136
        stopListening();
139
        try {
137
        try {
140
            // Put in a sleep to give the listener thread a chance to stop
138
            // Put in a sleep to give the listener thread a chance to stop
141
            Thread.sleep(500);
139
            Thread.sleep(500);
142
        } catch (InterruptedException exception) {
140
        } catch (InterruptedException exception) {
143
        }
141
        }
144
        communicationSocket = null;
142
        this.communicationSocket = null;
145
    }
143
    }
146
144
147
    /**
145
    /**
(-)a/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/sessions/coordination/RemoteCommandManager.java (-14 / +8 lines)
Lines 192-206 public class RemoteCommandManager implements org.eclipse.persistence.sessions.co Link Here
192
        Command newCommand;
192
        Command newCommand;
193
        CommandPropagator propagator;
193
        CommandPropagator propagator;
194
194
195
        if (commandConverter != null) {
195
        if (this.commandConverter != null) {
196
            // Use the converter if we have one
196
            // Use the converter if we have one
197
            Object[] args = { command };
197
            Object[] args = { command };
198
            logDebug("converting_to_toplink_command", args);
198
            logDebug("converting_to_toplink_command", args);
199
            //for dms profiling
199
            this.commandProcessor.incrementProfile(SessionProfiler.RcmSent);
200
            if (isCommandProcessorASession()) {
200
            newCommand = this.commandConverter.convertToEclipseLinkCommand(command);
201
                getCommandProcessor().processCommand(new ProfileMessageSentCommand());
202
            }
203
            newCommand = commandConverter.convertToEclipseLinkCommand(command);
204
        } else if (command instanceof Command) {
201
        } else if (command instanceof Command) {
205
            // If converter is not set then maybe it just doesn't need converting
202
            // If converter is not set then maybe it just doesn't need converting
206
            newCommand = (Command)command;
203
            newCommand = (Command)command;
Lines 231-240 public class RemoteCommandManager implements org.eclipse.persistence.sessions.co Link Here
231
    public void processCommandFromRemoteConnection(Command command) {
228
    public void processCommandFromRemoteConnection(Command command) {
232
        Object[] args = { command.getClass().getName(), command.getServiceId() };
229
        Object[] args = { command.getClass().getName(), command.getServiceId() };
233
        logDebug("received_remote_command", args);
230
        logDebug("received_remote_command", args);
234
        //for dms profiling
231
        
235
        if (isCommandProcessorASession()) {
232
        this.commandProcessor.incrementProfile(SessionProfiler.RcmReceived);
236
            getCommandProcessor().processCommand(new ProfileMessageReceiveCommand());
237
        }
238
233
239
        // If the command is internal then execute it on this RCM
234
        // If the command is internal then execute it on this RCM
240
        if (command.isInternalCommand() || command instanceof RCMCommand) {
235
        if (command.isInternalCommand() || command instanceof RCMCommand) {
Lines 252-261 public class RemoteCommandManager implements org.eclipse.persistence.sessions.co Link Here
252
247
253
        // process command with command processor
248
        // process command with command processor
254
        logDebug("processing_remote_command", args);
249
        logDebug("processing_remote_command", args);
255
        commandProcessor.processCommand(newCommand);
250
        this.commandProcessor.processCommand(newCommand);
256
        if (isCommandProcessorASession()) {
251
        
257
            getCommandProcessor().processCommand(new ProfileRemoteChangeSetCommand());
252
        this.commandProcessor.incrementProfile(SessionProfiler.RemoteChangeSet);
258
        }
259
    }
253
    }
260
254
261
    public CommandProcessor getCommandProcessor() {
255
    public CommandProcessor getCommandProcessor() {
(-)a/jpa/eclipselink.jpa.test/antbuild.xml (-1 / +1 lines)
Lines 4118-4123 CREATE OR REPLACE TYPE MY_GEOMETRY AS OBJECT (id NUMBER, geom MDSYS.SDO_GEOMETRY Link Here
4118
        <ant antfile="${jpatest.basedir}/cachecoordination_${server.name}.xml" target="${server.name}-stop-cachecoordination" inheritRefs="true"/>
4118
        <ant antfile="${jpatest.basedir}/cachecoordination_${server.name}.xml" target="${server.name}-stop-cachecoordination" inheritRefs="true"/>
4119
    </target>
4119
    </target>
4120
    <target name="server-run-test-cachecoordination" depends="detect-os,config-classpath">
4120
    <target name="server-run-test-cachecoordination" depends="detect-os,config-classpath">
4121
        <ant antfile="${jpatest.basedir}/cachecoordination.xml" target="${server.name}-run-test-cachecoordination" inheritRefs="true"/>
4121
        <ant antfile="${jpatest.basedir}/cachecoordination-cluster.xml" target="${server.name}-run-test-cachecoordination" inheritRefs="true"/>
4122
    </target>
4122
    </target>
4123
</project>
4123
</project>
(-)a/jpa/eclipselink.jpa.test/resource/server/persistence_cachecoordination.xml (-2 / +5 lines)
Lines 4-16 Link Here
4
             version="1.0" xmlns="http://java.sun.com/xml/ns/persistence">
4
             version="1.0" xmlns="http://java.sun.com/xml/ns/persistence">
5
    <persistence-unit name="%%default%%">
5
    <persistence-unit name="%%default%%">
6
        <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
6
        <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
7
        <jta-data-source>jdbc/EclipseLinkDS</jta-data-source>
7
        <%%datasource-type%%>%%data-source-name%%</%%datasource-type%%>
8
        <class>org.eclipse.persistence.testing.models.jpa.fieldaccess.advanced.Employee</class>
8
        <class>org.eclipse.persistence.testing.models.jpa.fieldaccess.advanced.Employee</class>
9
        <class>org.eclipse.persistence.testing.models.jpa.fieldaccess.advanced.Address</class>
9
        <class>org.eclipse.persistence.testing.models.jpa.fieldaccess.advanced.Address</class>
10
        <properties>
10
        <properties>
11
            <property name="eclipselink.target-server" value="WebLogic"/>
11
            <property name="eclipselink.target-server" value="%%server-platform%%"/>
12
            <property name="eclipselink.target-database" value="%%database-platform%%"/>
13
            <property name="eclipselink.logging.logger" value="DefaultLogger"/>
12
            <property name="eclipselink.logging.level" value="FINEST"/>
14
            <property name="eclipselink.logging.level" value="FINEST"/>
13
15
16
            <property name="eclipselink.cache.type.default" value="Full" />
14
            <property name="eclipselink.cache.coordination.protocol" value="%%cachecoordination-protocol%%" />
17
            <property name="eclipselink.cache.coordination.protocol" value="%%cachecoordination-protocol%%" />
15
            <property name="eclipselink.cache.coordination.jms.host" value="%%topic-host-url%%" />
18
            <property name="eclipselink.cache.coordination.jms.host" value="%%topic-host-url%%" />
16
            <property name="eclipselink.cache.coordination.jms.topic" value="%%topic-name%%" />
19
            <property name="eclipselink.cache.coordination.jms.topic" value="%%topic-name%%" />
(-)a/jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/models/jpa/sessionbean/EmployeeServiceBean.java (-1 / +3 lines)
Lines 39-45 public class EmployeeServiceBean implements EmployeeService { Link Here
39
    
39
    
40
    public Employee findById(int id) {
40
    public Employee findById(int id) {
41
        Employee employee = entityManager.find(Employee.class, new Integer(id));
41
        Employee employee = entityManager.find(Employee.class, new Integer(id));
42
        employee.getAddress();
42
        if (employee != null) {
43
            employee.getAddress();
44
        }
43
        return employee;
45
        return employee;
44
    }
46
    }
45
    
47
    
(-)a/jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/tests/jpa/sessionbean/SessionBeanTestsRCM.java (-147 / +146 lines)
Lines 13-49 Link Here
13
 package org.eclipse.persistence.testing.tests.jpa.sessionbean;
13
 package org.eclipse.persistence.testing.tests.jpa.sessionbean;
14
14
15
import java.net.URL;
15
import java.net.URL;
16
import java.util.Iterator;
16
import java.util.ArrayList;
17
import java.util.List;
17
import java.util.List;
18
import java.util.Properties;
18
import java.util.Properties;
19
import javax.naming.Context;
19
import javax.naming.Context;
20
import javax.naming.InitialContext;
20
import javax.naming.InitialContext;
21
import javax.naming.NameNotFoundException;
21
import javax.persistence.EntityManager;
22
import javax.rmi.PortableRemoteObject;
22
import javax.rmi.PortableRemoteObject;
23
23
24
import junit.framework.*;
24
import junit.framework.*;
25
25
26
import org.eclipse.persistence.testing.framework.junit.JUnitTestCase;
26
import org.eclipse.persistence.testing.framework.junit.JUnitTestCase;
27
import org.eclipse.persistence.testing.models.jpa.fieldaccess.advanced.Employee;
27
import org.eclipse.persistence.testing.models.jpa.fieldaccess.advanced.Employee;
28
import org.eclipse.persistence.testing.models.jpa.fieldaccess.advanced.Address;
29
import org.eclipse.persistence.testing.models.jpa.fieldaccess.advanced.AdvancedTableCreator;
28
import org.eclipse.persistence.testing.models.jpa.fieldaccess.advanced.AdvancedTableCreator;
30
import org.eclipse.persistence.testing.models.jpa.fieldaccess.advanced.Employee.EmployeeStatus;
31
import org.eclipse.persistence.testing.models.jpa.sessionbean.EmployeeService;
29
import org.eclipse.persistence.testing.models.jpa.sessionbean.EmployeeService;
32
30
33
/**
31
/**
34
 * EJB 3 SessionBean tests.
32
 * JPA Cache Coordination SessionBean tests.
35
 * Testing using EclipseLink JPA in a JEE EJB 3 SessionBean environment.
33
 * Testing using EclipseLink JPA in a JEE EJB 3 SessionBean environment.
36
 * These tests can only be run with a server.
34
 * These tests can only be run with a server.
37
 */
35
 */
38
public class SessionBeanTestsRCM extends JUnitTestCase {
36
public class SessionBeanTestsRCM extends JUnitTestCase {
37
    public final int SLEEP = 2000;
38
    protected List<String> serverURLs;
39
    protected int server;
39
    protected EmployeeService service;
40
    protected EmployeeService service;
40
    private String wlsUserName;
41
    private String wlsPassword;
42
    private String server1Url;
43
    private String server2Url;
44
    private String server3Url;
45
    int empId = 0;
46
    private Employee employeeCached = null;
47
41
48
    public SessionBeanTestsRCM() {
42
    public SessionBeanTestsRCM() {
49
        super();
43
        super();
Lines 56-237 public class SessionBeanTestsRCM extends JUnitTestCase { Link Here
56
    public SessionBeanTestsRCM(String name, boolean shouldRunTestOnServer) {
50
    public SessionBeanTestsRCM(String name, boolean shouldRunTestOnServer) {
57
        super(name);
51
        super(name);
58
        this.shouldRunTestOnServer = shouldRunTestOnServer;
52
        this.shouldRunTestOnServer = shouldRunTestOnServer;
59
53
        
60
        URL url = getClass().getResource("/weblogic.properties");
54
        URL url = getClass().getResource("/weblogic.properties");
61
        Properties properties = new Properties();
55
        Properties properties = new Properties(); 
62
        try {
56
        try {
63
            properties.load(url.openStream());
57
            properties.load(url.openStream());
64
        } catch (Exception error) {
58
        } catch (Exception error) {
65
            throw new RuntimeException(error);
59
            throw new RuntimeException(error);
66
        }
60
        }
67
        server1Url = properties.getProperty("rcm.wls.server1.url");
61
        this.serverURLs = new ArrayList<String>();
68
        server2Url = properties.getProperty("rcm.wls.server2.url");
62
        this.serverURLs.add(properties.getProperty("rcm.wls.server1.url"));
69
        server3Url = properties.getProperty("rcm.wls.server3.url");
63
        this.serverURLs.add(properties.getProperty("rcm.wls.server2.url"));
64
        this.serverURLs.add(properties.getProperty("rcm.wls.server3.url"));
70
    }
65
    }
71
66
72
    public static Test suite() {
67
    public static Test suite() {
73
        TestSuite suite = new TestSuite("SessionBeanTestsRCM");
68
        TestSuite suite = new TestSuite("SessionBeanTestsRCM");
74
69
75
        suite.addTest(new SessionBeanTestsRCM("testSetupRcmOnServer2", true));
70
        suite.addTest(new SessionBeanTestsRCM("testSetup", true));
76
        suite.addTest(new SessionBeanTestsRCM("testSetupForDeleteOnServer2", false));
71
        suite.addTest(new SessionBeanTestsRCM("testLag", false));
77
72
        
78
        suite.addTest(new SessionBeanTestsRCM("testSetupRcmOnServer1", false));
73
        suite.addTest(new SessionBeanTestsRCM("testUpdates", false));
79
        suite.addTest(new SessionBeanTestsRCM("testPerformDeleteOnServer1", false));
74
        suite.addTest(new SessionBeanTestsRCM("testDelete", false));
80
75
        
81
        suite.addTest(new SessionBeanTestsRCM("testConfirmUpdateOnServer2", false));
82
        suite.addTest(new SessionBeanTestsRCM("testConfirmDeleteOnServer2", false));
83
        return suite;
76
        return suite;
84
    }
77
    }
85
78
    
86
    /**
79
    /**
87
     * The setup is done as a test, both to record its failure, and to alow execution in the server2.
80
     * Return the next server index to use.
81
     * This cycles through the servers.
88
     */
82
     */
89
    public void testSetupRcmOnServer2() throws Exception {
83
    public synchronized int nextServer() {
90
        new AdvancedTableCreator().replaceTables(JUnitTestCase.getServerSession("sessionbean"));
84
        this.server++;
85
        if (this.server >= this.serverURLs.size()) {
86
            this.server = 0;
87
        }
88
        return this.server;
91
    }
89
    }
92
90
    
93
    public EmployeeService getEmployeeService(String url) throws Exception {
91
    public EmployeeService getEmployeeService() {
92
        if (this.service == null) {
93
            this.service = nextEmployeeService();
94
        }
95
        return service;
96
    }
97
    
98
    public EmployeeService nextEmployeeService() {
99
        EmployeeService service = null;
100
        int server = nextServer();
94
        Properties properties = new Properties();
101
        Properties properties = new Properties();
102
        String url = this.serverURLs.get(server);
95
        properties.put("java.naming.provider.url", url);
103
        properties.put("java.naming.provider.url", url);
96
        Context context = new InitialContext(properties);
104
        System.out.println(server + ":" + url);
97
98
        try {
105
        try {
99
            return (EmployeeService) PortableRemoteObject.narrow(context.lookup("java:comp/env/ejb/EmployeeService"), EmployeeService.class);
106
            Context context = new InitialContext(properties);
100
        } catch (NameNotFoundException notFoundException) {
107
            service = (EmployeeService)PortableRemoteObject.narrow(context.lookup("EmployeeService#org.eclipse.persistence.testing.models.jpa.sessionbean.EmployeeService"), EmployeeService.class);
101
            try {
108
        } catch (Exception notFoundException) {
102
                return (EmployeeService) PortableRemoteObject.narrow(context.lookup("ejb/EmployeeService"), EmployeeService.class);
109
            throw new Error("Lookup failed.", notFoundException);
103
            } catch (NameNotFoundException notFoundException2) {
104
                try {
105
                    // WLS likes this one.
106
                    return (EmployeeService) PortableRemoteObject.narrow(context.lookup("EmployeeService#org.eclipse.persistence.testing.models.jpa.sessionbean.EmployeeService"), EmployeeService.class);
107
                } catch (NameNotFoundException notFoundException3) {
108
                    try {
109
                         //jboss likes this one
110
                         return (EmployeeService) PortableRemoteObject.narrow(context.lookup("EmployeeService/remote"), EmployeeService.class);
111
                    } catch (NameNotFoundException notFoundException4) {
112
                         throw new Error("All lookups failed.", notFoundException);
113
                    }
114
                }
115
            }
116
        }
110
        }
111
        return service;
117
    }
112
    }
118
113
119
114
    /**
120
    /* CacheCoordination Delete Test Setup on Server2:
115
     * The setup is done as a test, both to record its failure, and to alow execution in the server2.
121
     *  This test insert an employee record, which will be deleted later using Server1
122
     */
116
     */
123
    public void testSetupForDeleteOnServer2() throws Exception {
117
    public void testSetup() throws Exception {
124
        // Ensure each session starts to enable cache synch.
118
        new AdvancedTableCreator().replaceTables(JUnitTestCase.getServerSession("sessionbean"));
125
        getEmployeeService(server1Url).findAll();
119
126
        getEmployeeService(server2Url).findAll();
120
        EntityManager em = createEntityManager("sessionbean");
127
        Thread.sleep(5000);
121
        beginTransaction(em);
128
        /* Create an Employee record using Server2 */
122
        try {
129
        Employee employee = new Employee();
123
            Employee employee = new Employee();
130
        employee.setFirstName("Jane2");
124
            em.persist(employee);
131
        employee.setLastName("Doe2");
125
            commitTransaction(em);
132
        employee.setAddress(new Address());
126
        } finally {
133
        employee.getAddress().setCity("Ottawa2");
127
            if (isTransactionActive(em)) {
134
        Employee manager = new Employee();
128
                closeEntityManagerAndTransaction(em);
135
        manager.setFirstName("John2");
129
            }
136
        manager.setLastName("Done2");
137
        employee.setManager(manager);
138
139
        int empID = getEmployeeService(server2Url).insert(employee);
140
141
        employee = getEmployeeService(server2Url).findById(empID);
142
        if (employee == null) {
143
          fail("Server2 CacheCoordination Setup Failure: New employee added from Server2 is not found in cache or DB.");
144
        }
130
        }
145
    }
131
    }
146
132
147
    /**
133
    /**
148
     * CacheCoordination Update Test setup on Server1:
134
     * Build a test that validates cache coordination updates are working in the cluster.
149
     * This test insert an employee record, which is then updated using Server1. Later on,  this update will be verified on Server2.
150
     * The setup is done as a test, both to record its failure, and to alow execution in the server1.
151
     */
135
     */
152
    public void testSetupRcmOnServer1() throws Exception {
136
    public void testUpdates() {
153
        Thread.sleep(1000);
137
        EmployeeService service = nextEmployeeService();
154
138
        Employee employee = (Employee)service.findAll().get(0);
155
        /* Create an Employee record in Server1 */
139
        
156
        Employee employee = new Employee();
140
        for (int index = 0; index < 5; index++) {
157
        employee.setFirstName("Jane1");
141
            service = nextEmployeeService();
158
        employee.setLastName("Doe1");
142
            employee = service.findById(employee.getId());
159
        employee.setAddress(new Address());
160
        employee.getAddress().setCity("Ottawa1");
161
        Employee manager = new Employee();
162
        manager.setFirstName("John1");
163
        manager.setLastName("Done1");
164
        employee.setManager(manager);
165
        employee.setStatus(EmployeeStatus.FULL_TIME);
166
167
        empId = getEmployeeService(server1Url).insert(employee);
168
169
        /* read Employee from cache and/or DB */
170
        Employee jane1 = getEmployeeService(server1Url).findById(empId);
171
        /* update employee on Server1 */
172
        jane1.setLastName("LastNameUpdatedOnServer1");
173
        jane1.getAddress().setCity("newCity");
174
        getEmployeeService(server1Url).update(jane1);
175
176
        if (!jane1.getLastName().equals("LastNameUpdatedOnServer1")) {
177
            fail("UpdateTest Setup on Server1 failed");
178
        }
143
        }
179
144
145
        for (int index = 0; index < 5; index++) {
146
            service = nextEmployeeService();
147
            int random = (int)(Math.random() * 1000000);
148
            employee = service.findById(employee.getId());
149
            employee.setLastName(String.valueOf(random));
150
            service.update(employee);
151
            try {
152
                Thread.sleep(SLEEP);
153
            } catch (Exception ignore) {}
154
        }
180
    }
155
    }
181
182
    /**
156
    /**
183
     * CacheCoordination Test setup for Delete on Server1:
157
     * Build a test that validates cache coordination deletes are working in the cluster.
184
     * Find employee created on Server2, then delete it using Server1.
185
     */
158
     */
186
    public void testPerformDeleteOnServer1() throws Exception {
159
    public void testDelete() {        
187
        Thread.sleep(1000);
160
        EmployeeService service = nextEmployeeService();
188
        List result = getEmployeeService(server1Url).findByFirstName("Jane2");
161
        Employee employee = new Employee();
189
        int count = 0;
162
        employee.setId(service.insert(employee));
190
        for (Iterator i = result.iterator(); i.hasNext();) {
163
        
191
             employeeCached = (Employee) i.next();
164
        for (int index = 0; index < 5; index++) {
165
            service = nextEmployeeService();
166
            employee = service.findById(employee.getId());
192
        }
167
        }
193
168
194
        if (employeeCached == null){
169
        service = nextEmployeeService();
195
          fail("Perform Delete Test failed: New employee was not found in distributed cache to delete");
170
        employee = service.findById(employee.getId());
171
        service.delete(employee);
172
        try {
173
            Thread.sleep(SLEEP);
174
        } catch (Exception ignore) {}
175
        
176
        for (int index = 0; index < 5; index++) {
177
            service = nextEmployeeService();
178
            Employee result = service.findById(employee.getId());
179
            if (result != null) {
180
                fail("Employee should be removed:" + result);
181
            }
196
        }
182
        }
197
        getEmployeeService(server1Url).delete(employeeCached);
198
    }
199
183
200
    /* CacheCoordination Test - Verify that Object Update done on Server1 is sync with Server2 thru cache:
184
    }
201
     *  This test uses JPQL to read object on Server2.
185
    
186
    /**
187
     * Build a test that attempt to determine the coordination lag in a cluster.
202
     */
188
     */
203
    public void testConfirmUpdateOnServer2() throws Exception {
189
    public void testLag() {
204
        Thread.sleep(1000);
190
        EmployeeService service = nextEmployeeService();
205
        /* verify updates are in sync: read Employee from using Server2 URL */
191
        Employee employee = (Employee)service.findAll().get(0);
206
        List result = getEmployeeService(server2Url).findByFirstName("Jane1");
192
        
207
        int count = 0;
193
        for (int index = 0; index < 5; index++) {
208
        for (Iterator i = result.iterator(); i.hasNext();){
194
            service = nextEmployeeService();
209
             employeeCached = (Employee) i.next();
195
            employee = service.findById(employee.getId());
210
        }
211
        if (employeeCached == null){
212
            fail("Object Update Test verification failed: New employee was not found in distributed cache");
213
        }
196
        }
214
        if (!employeeCached.getLastName().equals("LastNameUpdatedOnServer1")) {
215
            fail("Object Update Test verification failed: Changes from server1 is not seen by server2 from distributed cache");
216
        }
217
    }
218
219
   /* CacheCoordination Test - Verify that Object Delete done on Server1 is sync with Server2 thru cache:
220
    *    This test uses JPQL to read object on Server2.
221
    */
222
   public void testConfirmDeleteOnServer2() throws Exception {
223
        Thread.sleep(1000);
224
197
225
        /* verify deletes are in sync: read Employee from using Server2 URL */
198
        // Sleep to let RCM to connect.
226
        List result = getEmployeeService(server2Url).findByFirstName("Jane2");
199
        try {
227
        for (Iterator i = result.iterator(); i.hasNext();) {
200
            Thread.sleep(20000);
228
            employeeCached = (Employee) i.next();
201
        } catch (Exception ignore) {}
229
        }
202
230
        if (employeeCached != null) {
203
        int sleeps[] = new int[]{1, 50, 100, 500, 1000, 2000, 3000, 4000, 5000, 10000};
231
            fail("Object Delete Test verification failed: employee was not removed from cache as expected" );
204
        int sleep = 0;
205
        boolean success = false;
206
        boolean failed = false;
207
        while (!success && (sleep < sleeps.length)) {
208
            for (int index = 0; index < 10; index++) {
209
                service = nextEmployeeService();
210
                int random = (int)(Math.random() * 1000000);
211
                employee = service.findById(employee.getId());
212
                employee.setLastName(String.valueOf(random));
213
                try {
214
                    service.update(employee);
215
                } catch (Exception lockError) {
216
                    System.out.println("Failed at sleep of:" + sleeps[sleep] + " on attmept:" + index);
217
                    sleep = sleep + 1;
218
                    failed = true;
219
                    break;
220
                }
221
                try {
222
                    Thread.sleep(sleeps[sleep]);
223
                } catch (Exception ignore) { }
224
            }
225
            if (!failed) {
226
                success = true;
227
                System.out.println("Success at sleep of:" + sleeps[sleep]);
228
                break;
229
            } else {
230
                failed = false;
231
            }
232
        }
232
        }
233
233
    }
234
   }
235
234
236
}
235
}
237
236
(-)a/jpa/eclipselink.jpa.test/weblogic.properties (-2 / +8 lines)
Lines 83-92 rcm.wls.server3.httphost=${weblogic.host} Link Here
83
rcm.wls.server1.name=myserver
83
rcm.wls.server1.name=myserver
84
rcm.wls.server2.name=server2
84
rcm.wls.server2.name=server2
85
rcm.wls.server3.name=server3
85
rcm.wls.server3.name=server3
86
#rcm.wls.adminserver.port=${weblogic.port}
86
rcm.wls.admin.port=${weblogic.port}
87
rcm.wls.server1.port=7001
87
rcm.wls.server1.port=7007
88
rcm.wls.server2.port=7021
88
rcm.wls.server2.port=7021
89
rcm.wls.server3.port=7031
89
rcm.wls.server3.port=7031
90
rcm.wls.server4.host=ottvm071
91
rcm.wls.server5.host=ottvm071
92
rcm.wls.server6.host=ottvm071
93
rcm.wls.server4.port=7008
94
rcm.wls.server5.port=7022
95
rcm.wls.server6.port=7032
90
96
91
rcm.wls.server1.url=t3://${rcm.wls.server1.httphost}:${rcm.wls.server1.port}/
97
rcm.wls.server1.url=t3://${rcm.wls.server1.httphost}:${rcm.wls.server1.port}/
92
rcm.wls.server2.url=t3://${rcm.wls.server2.httphost}:${rcm.wls.server2.port}/
98
rcm.wls.server2.url=t3://${rcm.wls.server2.httphost}:${rcm.wls.server2.port}/
(-)a/jpa/org.eclipse.persistence.jpa/src/org/eclipse/persistence/internal/jpa/EntityManagerSetupImpl.java (+18 lines)
Lines 166-171 import org.eclipse.persistence.internal.jpa.metadata.MetadataLogger; Link Here
166
import org.eclipse.persistence.internal.jpa.metadata.MetadataProcessor;
166
import org.eclipse.persistence.internal.jpa.metadata.MetadataProcessor;
167
import org.eclipse.persistence.internal.jpa.metadata.MetadataProject;
167
import org.eclipse.persistence.internal.jpa.metadata.MetadataProject;
168
import org.eclipse.persistence.internal.jpa.metadata.accessors.objects.MetadataAsmFactory;
168
import org.eclipse.persistence.internal.jpa.metadata.accessors.objects.MetadataAsmFactory;
169
import org.eclipse.persistence.internal.jpa.metadata.xml.XMLEntityMappingsReader;
169
import org.eclipse.persistence.internal.jpa.metamodel.MetamodelImpl;
170
import org.eclipse.persistence.internal.jpa.metamodel.MetamodelImpl;
170
import org.eclipse.persistence.internal.jpa.weaving.PersistenceWeaver;
171
import org.eclipse.persistence.internal.jpa.weaving.PersistenceWeaver;
171
import org.eclipse.persistence.internal.jpa.weaving.TransformerFactory;
172
import org.eclipse.persistence.internal.jpa.weaving.TransformerFactory;
Lines 675-680 public class EntityManagerSetupImpl implements MetadataRefreshListener { Link Here
675
                        } else {
676
                        } else {
676
                            try {
677
                            try {
677
                                updateTunerDeploy(deployProperties, classLoaderToUse);
678
                                updateTunerDeploy(deployProperties, classLoaderToUse);
679
                                updateFreeMemory(deployProperties);
678
                                if (this.isSessionLoadedFromSessionsXML) {
680
                                if (this.isSessionLoadedFromSessionsXML) {
679
                                    getDatabaseSession().login();
681
                                    getDatabaseSession().login();
680
                                } else {
682
                                } else {
Lines 2996-3001 public class EntityManagerSetupImpl implements MetadataRefreshListener { Link Here
2996
    }
2998
    }
2997
2999
2998
    /**
3000
    /**
3001
     * Allow the deployment metadata to be freed post-deploy to conserve memory.
3002
     */
3003
    protected void updateFreeMemory(Map m) {
3004
        String freeMemory = EntityManagerFactoryProvider.getConfigPropertyAsStringLogDebug(PersistenceUnitProperties.FREE_METADATA, m, session);
3005
        if (freeMemory != null) {
3006
           if (freeMemory.equalsIgnoreCase("true")) {
3007
               XMLEntityMappingsReader.clear();
3008
           } else if (freeMemory.equalsIgnoreCase("false")) {
3009
               // default.
3010
           } else {
3011
               session.handleException(ValidationException.invalidBooleanValueForProperty(freeMemory, PersistenceUnitProperties.FREE_METADATA));
3012
           }
3013
        }
3014
    }
3015
3016
    /**
2999
     * Enable or disable the capability of Native SQL function.  
3017
     * Enable or disable the capability of Native SQL function.  
3000
     * The method needs to be called in deploy stage.
3018
     * The method needs to be called in deploy stage.
3001
     */
3019
     */
(-)a/jpa/org.eclipse.persistence.jpa/src/org/eclipse/persistence/internal/jpa/metadata/xml/XMLEntityMappingsReader.java (+16 lines)
Lines 228-233 public class XMLEntityMappingsReader { Link Here
228
    }
228
    }
229
    
229
    
230
    /**
230
    /**
231
     * Free the project and schema objects to avoid holding onto the memory.
232
     * This can be done post-deployment to conserve memory.
233
     */
234
    public static void clear() {
235
        m_orm1_0Project = null;
236
        m_orm2_0Project = null;
237
        m_orm2_1Project = null;
238
        m_eclipseLinkOrmProject = null;
239
        
240
        m_orm1_0Schema = null;
241
        m_orm2_0Schema = null;
242
        m_orm2_1Schema = null;
243
        m_eclipseLinkOrmSchema = null;
244
    }
245
    
246
    /**
231
     * INTERNAL:
247
     * INTERNAL:
232
     * Return whether the schema validation flag in the Persistence Unit 
248
     * Return whether the schema validation flag in the Persistence Unit 
233
     * eclipselink.orm.validate.schema is set to true or false.<br>
249
     * eclipselink.orm.validate.schema is set to true or false.<br>

Return to bug 326334