On Mon, Jan 26, 2009 at 12:07 AM, Douglas Leite <[email protected]>wrote:
> Supposing I have the following scenario:
>
> #A client:
>
> *public ClientImpl implements Client {
>
> public void someClientMethod() {
> service.someServiceMethod();
> Thread.sleep(1000);
> }
> }*
>
> #A server:
>
> *...@conversational
> public interface ServiceProvider {
>
> @OneWay
> public void someServiceMethod();
>
> @EndsConversation
> public void close();
> }*
>
> #The main program:
>
> * public static void main(String... args) {
> SCADomain scaDomain =
> SCADomain.newInstance("conversational.composite");
>
> Client client = scaDomain.getService(Client.class, "Consumer");
> client.someClientMethod(); *
> *}*
>
> The main program just call the *someClientMethod* method. Suppose that the
> *someServiceMethod* has an execution time greater than 1000 milliseconds
> (time taken by the *someClientMethod* execution). Due to the
> @Conversational annotation, the program will not finish even though the
> client method finishes firstly. However, should the program finish when the
> *close* method is invoked? I have tried this in some tests, but even when
> the *close* is invoked, and no more computation are done, the program
> still running.
>
>
> --
> Douglas Siqueira Leite
> Computer Science Master's degree student of University of Campinas
> (Unicamp), Brazil
>
>
Hi Douglas
I'm surprised that the program continues to run. @Conversation ensures that
an service instance is available across a sequence of calls. I wouldn't
expect the presence of @Conversation to keep the program running.
I don't see that you call "close()" anywhere in this example but you say you
have tried it. I wouldn't expect this to make a difference to whether the
program stops or not but it would tidy away the conversational instance when
you are done with it.
Simon