← Prev in month ← Prev in thread
Next in thread → Next in month →

NEW ISSUE: Concurrency model for Service Reference instances

From
Blohm, Henning <>
Date
2007-09-26T11:55:28+00:00
ID
Thread
NEW ISSUE: Concurrency model for Service Reference instances
Title: NEW ISSUE: Concurrency model for Service Reference instances

TARGET: 

Java Common Annotations and APIs specification, section "Java API" / {"ComponentContext", "ServiceReference"} and section "Asynchronous and Conversational Programming".

DESCRIPTION: 

While the current text says that a service reference represents a single conversation, it is not clear how a multi-threaded client should protect a non-conversational service reference's configuration (conversation id, callback, etc) so that it stays unmodified by other threads until an actual invocation is executed.

Consider the following code snippet for example:

class AComponent {

  @Reference ItemCheckerService srv;

  void goCheckItem(long ticket, String itemId) {

        ServiceReference sr = (ServiceReference) srv;

        sr.setConversationID(ticket);

        srv.check(itemId);

  }

}

A simple synchronization may lead to strict serialization of remote calls which is generally undesirable. 

PROPOSAL:

Several proposals have been discussed in the past:

a) A service reference instance is actually a thread local proxy to the reference target. 

b) A single service reference represents exactly one actual or potential conversation. Each call to ComponentContext.getService (and similar methods) returns a new instance of ServiceReference.
← Prev in month ← Prev in thread
Next in thread → Next in month →