Go Back   ZeroC Forums > Help Center

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
  #1 (permalink)  
Old 02-25-2005
stephan stephan is offline
Registered User
 
Name: Stephan Stapel
Organization: Stephan Stapel
Project: BristolNG
 
Join Date: Oct 2003
Location: Essen, Germany
Posts: 169
AMI question

Just a quick question on AMI.

When I have subsequent proxy calls, i.e. if I call a proxy (synchronously) with the respective servant then doing an AMI call to another proxy, is there anything to be taken into account? Unfortunately I did not have luck to implement this yet so I wanted to ask if there are pitfalls to find, the code of the first servant looks like this:

The definition:

interface Action
{
["ami"] void perform();
}

interface ActionProcessor
{
void process();
}


The implementation:

public class AMI_I_MyCall : AMI_MyCall
{
void ice_response()
{
pParent->m_bDone = true;
}
}

public override void process(Ice.Current current)
{
bDone = false;

AMI_I_MyCall cb = new AMI_I_MyCall();

action.perform(cb);

while (!bDone)
{
// do something else
}
}


I hope that this example shows what I mean. Is using AMI in this case the optimal solution or are there better ones?

Kind regards,

Stephan
Reply With Quote
  #2 (permalink)  
Old 02-25-2005
benoit's Avatar
benoit benoit is online now
ZeroC Staff
 
Name: Benoit Foucher
Organization: ZeroC, Inc.
Project: Ice
 
Join Date: Feb 2003
Location: Rennes, France
Posts: 1,534
Assuming that bDone and m_bDone are the same attributes and that you will add proper synchronization, I can't see anything wrong with your example (the call to action perform would be action.perform_async(cb); though).

Benoit.
Reply With Quote
  #3 (permalink)  
Old 02-25-2005
stephan stephan is offline
Registered User
 
Name: Stephan Stapel
Organization: Stephan Stapel
Project: BristolNG
 
Join Date: Oct 2003
Location: Essen, Germany
Posts: 169
Quote:
Originally Posted by benoit
Assuming that bDone and m_bDone are the same attributes and that you will add proper synchronization, I can't see anything wrong with your example (the call to action perform would be action.perform_async(cb); though).
Yes, you are right. These were typos. I'll check out if I can gather further information and post that later.

What I'm aiming at is to create a little workflow engine and the loop I wrote down basically is the state machine processor. The action class are derived into more special actions (start, end, decision, wait for file, send message and wait for user reply, copy file, convert data etc.).

Is AMI a viable technique for this purpose? Or would oneway invocations be better? AMI somehow limits scalability (due to thread assignment) but oneway is not as safe...

Stephan
Reply With Quote
  #4 (permalink)  
Old 02-25-2005
benoit's Avatar
benoit benoit is online now
ZeroC Staff
 
Name: Benoit Foucher
Organization: ZeroC, Inc.
Project: Ice
 
Join Date: Feb 2003
Location: Rennes, France
Posts: 1,534
I wouldn't use oneway since it's not as reliable as twoway calls. It's difficult to say if using AMI is the right choice here without knowing a bit more about your application. But it's not clear to me what your concerns are with respect to scalability, what do you mean by the "thread assignment"? Can you clarify this?

Benoit.
Reply With Quote
  #5 (permalink)  
Old 03-01-2005
stephan stephan is offline
Registered User
 
Name: Stephan Stapel
Organization: Stephan Stapel
Project: BristolNG
 
Join Date: Oct 2003
Location: Essen, Germany
Posts: 169
Hi again,

sorry, I still do not manage to get the program working. I attached my entire workspace to this posting and hope that you can try it out (please modify the config.txt files in the debug directories with your host info). Then start server, then the client (as usual).

A process will be created on the client side and then be invoked using tempIterate(). In the tempIterate() implementation, perform() should be called using AMI but apparently, it is never called for some reason.

Please let me know if I can help with some additional comments.

regs,

Stephan

P.S.: Please notice that I didn't install the slice2cs patch yet, so I'm using some workarounds around the collection bug.
P.P.S.: Will the AMI section for C# be improved for Ice 2.1? It's a bit awkward to read, the example doesn't help too much
Attached Files
File Type: zip flow.zip (87.5 KB, 28 views)
Reply With Quote
  #6 (permalink)  
Old 03-01-2005
benoit's Avatar
benoit benoit is online now
ZeroC Staff
 
Name: Benoit Foucher
Organization: ZeroC, Inc.
Project: Ice
 
Join Date: Feb 2003
Location: Rennes, France
Posts: 1,534
By default the Ice server thread pool has only one thread. Can you try to increase the server thread pool? I suspect this is the problem. The AMI call perform() can't be dispatched because there's no more threads available in the thread pool. To increase the server thread pool, you can use the Ice.ThreadPool.Server.Size property or the Ice.ThreadPool.Server.SizeMax property (see the Ice manual for details on these properties).

Let us know if this doesn't help!

Benoit.
Reply With Quote
  #7 (permalink)  
Old 03-01-2005
stephan stephan is offline
Registered User
 
Name: Stephan Stapel
Organization: Stephan Stapel
Project: BristolNG
 
Join Date: Oct 2003
Location: Essen, Germany
Posts: 169
bingo. That was it. So easy... is that different to C++? IIRC, I never had this problem there.

Anyway, thanks for helping so quickly!
Reply With Quote
  #8 (permalink)  
Old 03-02-2005
benoit's Avatar
benoit benoit is online now
ZeroC Staff
 
Name: Benoit Foucher
Organization: ZeroC, Inc.
Project: Ice
 
Join Date: Feb 2003
Location: Rennes, France
Posts: 1,534
I'm glad it works now! It's the same for C++ and Java since Ice 1.3.0 (previous versions had different defaults settings for the thread pool sizes).

Benoit.
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT -4. The time now is 05:55 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0
(c) 2008 ZeroC, Inc.