Handling of Multiple Clients

Overview

The Contacts Model uses a Client Server architecture. Many clients can send requests to the server for operations on one or more contacts databases.

In the case where multiple clients are accessing the same database the server will attempt to process the requests sequentially.

Requests are usually carried out immediately:

  • The request is valid for the current state and is processed

  • The request is not valid for the current state and is completed by leaving with an appropriate error code

There are however two scenarios where a request cannot be processed immediately:

  • The request needs to open or modify a contact item currently locked by any session

  • The current state of the server prevents the request from being carried out

In both of these cases the request is queued with the expectation that the condition preventing its completion will soon cease.

When a contact item is unlocked, or the state of the server changes, an attempt is made to execute the first request in the queue. If the request still cannot be processed it is once again added to the queue. This activity is repeated for all queued requests.

A request will only remain in the queue for a defined period known as the operation timeout. At the end of this period the client’s request will be completed by leaving with an error code appropriate for the request. These error codes conform to the values used in the previous version of the Contacts Model.

Setting the Operation Timeout Value

The following API is used to set the operation timeout value:

void CContactDatabase::SetOperationTimeOutL(const TInt aMilSeconds) const

Parameter

aMilSeconds

The operation timeout in milliseconds. This timeout is only applied to requests sent by clients of this database after this time.

Implementation Considerations

By default the operation timeout is 1 second. You may wish to change this value based on the way in which the application layer uses the Contacts Model.

The timeout is set per session – multiple clients using the same database can specify independent values for the operation timeout.