WAS v8.5 > Develop applications > Develop EJB applications > Develop session beans > Develop singleton session beans

Change singleton session bean locking policy

Use this task to override the default non-fair locking policy for all singleton session bean write locks within the server. This task is for WebSphere Application Server users who do not want lock requests for their Singleton session bean method invocations to follow a non-fair policy.

Locks for singleton session bean methods are obtained using a non-fair locking policy by default. When locks are constructed as fair, threads contend for entry using an approximate arrival-order policy. When lock is released, the longest waiting lock is granted regardless if it is reader or writer.

When locks are constructed as non-fair, the order in which locks are obtained is not guaranteed. If readers are active and a writer enters the queue, subsequent readers might get granted the read lock before the writer is granted the lock.

  1. Optional: Open the dmgr console.

  2. Select Servers.

  3. Select Server Types.

  4. Select WebSphere application servers.

  5. Select the server to configure.

  6. From Server Infrastructure, select Java and Process Management Process definition.

  7. From Additional Properties, select Java Virtual Machine.
  8. In the Additional Properties area, select Custom Properties.

  9. On the Application servers page, click New to specify an arbitrary name and value pair for the server.
  10. In the Name entry field, type: com.ibm.websphere.ejbcontainer.useFairSingletonLockingPolicy
  11. In the Value entry field, type true.

    Entering true causes all locks obtained for singleton session bean methods to use a fair policy. Entering false causes all locks obtained for singleton session bean methods to use a non-fair policy. The default policy is non-fair.

  12. Click OK.

  13. Save the configuration.

  14. Restart the server.


Results

The locking policy has now been set for all locks obtained for singleton session beans within the server.


+

Search Tips   |   Advanced Search