2 #include "ace/OS_NS_unistd.h"
4 Peer_Handler_i::Peer_Handler_i (Peer_i
*peer
)
10 Peer_Handler_i::request (CORBA::Long retval
)
15 ACE_DEBUG ((LM_DEBUG
, "(%P|%t) %d replies received\n", i
));
16 this->peer_
->reply (retval
);
21 Peer_Handler_i::request_excep (
22 ::Messaging::ExceptionHolder
*)
27 Peer_Handler_i::start ()
32 Peer_Handler_i::shutdown ()
38 : reply_handler_ (this)
47 Peer_i::init (CORBA::ORB_ptr orb
,
48 Progress_ptr progress
,
49 const ACE_Time_Value
&delay
)
51 this->orb_
= CORBA::ORB::_duplicate (orb
);
52 this->progress_
= Progress::_duplicate (progress
);
55 Peer_var peer
= this->_this ();
57 ACE_DEBUG ((LM_DEBUG
, "Peer (%P|%t) - binding\n"));
58 this->id_
= this->progress_
->bind (peer
.in ());
62 Peer_i::reply (CORBA::Long result
)
64 this->progress_
->recv_reply (result
);
68 Peer_i::request (CORBA::Long id
)
70 ACE_Time_Value tv
= this->delay_
;
77 Peer_i::start (const PeerSet
&the_peers
,
78 CORBA::Long iterations
)
80 AMI_PeerHandler_var handler
=
81 this->reply_handler_
._this ();
83 // @@ Report errors as exceptions...
85 ACE_NEW (task
, Peer_Task (the_peers
,
87 this->progress_
.in (),
96 this->orb_
->shutdown (false);
99 // ****************************************************************
101 Peer_Task::Peer_Task (const PeerSet
& the_peers
,
102 CORBA::Long iterations
,
103 Progress_ptr progress
,
104 AMI_PeerHandler_ptr handler
,
106 : the_peers_ (the_peers
),
107 iterations_ (iterations
),
108 progress_ (Progress::_duplicate (progress
)),
109 handler_ (AMI_PeerHandler::_duplicate (handler
)),
117 for (int i
= 0; i
!= this->iterations_
; ++i
)
119 CORBA::ULong l
= this->the_peers_
.length ();
120 for (CORBA::ULong j
= 0; j
!= l
; ++j
)
124 this->the_peers_
[j
]->sendc_request (this->handler_
.in (),
127 this->progress_
->sent_request (this->id_
);
129 catch (const CORBA::Exception
&)
131 // Ignore exceptions;
135 ACE_DEBUG ((LM_DEBUG
, "(%P|%t) %d requests sent\n", i
));