summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/orbsvcs/Event/EC_SupplierAdmin.cpp
blob: 8deb691a277d1d1029beb1a0547a61d5f444d1cf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
// $Id$

#include "EC_SupplierAdmin.h"
#include "EC_ProxyConsumer.h"
#include "EC_ProxySupplier.h"
#include "EC_Event_Channel.h"

#if ! defined (__ACE_INLINE__)
#include "EC_SupplierAdmin.i"
#endif /* __ACE_INLINE__ */

ACE_RCSID(Event, EC_SupplierAdmin, "$Id$")

TAO_EC_SupplierAdmin::TAO_EC_SupplierAdmin (TAO_EC_Event_Channel *ec)
  :  event_channel_ (ec)
{
  this->collection_ =
    this->event_channel_->create_proxy_push_consumer_collection ();

  // @@
  // @@ this->collection_->busy_hwm (this->event_channel_->busy_hwm ());
  // @@ this->collection_->max_write_delay (
  // @@           this->event_channel_->max_write_delay ()
  // @@ );

  this->default_POA_ =
    this->event_channel_->supplier_poa ();
}

TAO_EC_SupplierAdmin::~TAO_EC_SupplierAdmin (void)
{
  this->event_channel_->destroy_proxy_push_consumer_collection (this->collection_);
  this->collection_ = 0;
}

PortableServer::POA_ptr
TAO_EC_SupplierAdmin::_default_POA (CORBA::Environment&)
{
  return PortableServer::POA::_duplicate (this->default_POA_.in ());
}

void
TAO_EC_SupplierAdmin::connected (TAO_EC_ProxyPushSupplier *supplier,
                                 CORBA::Environment &ACE_TRY_ENV)
{
  TAO_EC_Connect_Supplier worker (supplier);
  this->collection_->for_each (&worker, ACE_TRY_ENV);
}

void
TAO_EC_SupplierAdmin::reconnected (TAO_EC_ProxyPushSupplier *supplier,
                                   CORBA::Environment &ACE_TRY_ENV)
{
  TAO_EC_Reconnect_Supplier worker (supplier);
  this->collection_->for_each (&worker, ACE_TRY_ENV);
}

void
TAO_EC_SupplierAdmin::disconnected (TAO_EC_ProxyPushSupplier *supplier,
                                    CORBA::Environment &ACE_TRY_ENV)
{
  TAO_EC_Disconnect_Supplier worker (supplier);
  this->collection_->for_each (&worker, ACE_TRY_ENV);
}

void
TAO_EC_SupplierAdmin::connected (TAO_EC_ProxyPushConsumer *consumer,
                                 CORBA::Environment &ACE_TRY_ENV)
{
  this->collection_->connected (consumer, ACE_TRY_ENV);
}

void
TAO_EC_SupplierAdmin::reconnected (TAO_EC_ProxyPushConsumer *consumer,
                                   CORBA::Environment &ACE_TRY_ENV)
{
  this->collection_->reconnected (consumer, ACE_TRY_ENV);
}

void
TAO_EC_SupplierAdmin::disconnected (TAO_EC_ProxyPushConsumer *consumer,
                                    CORBA::Environment &ACE_TRY_ENV)
{
  this->collection_->disconnected (consumer, ACE_TRY_ENV);
}

void
TAO_EC_SupplierAdmin::shutdown (CORBA::Environment &ACE_TRY_ENV)
{
  TAO_EC_Shutdown_Consumer worker;

  this->collection_->for_each (&worker, ACE_TRY_ENV);
  this->collection_->shutdown (ACE_TRY_ENV);
}

RtecEventChannelAdmin::ProxyPushConsumer_ptr
TAO_EC_SupplierAdmin::obtain_push_consumer (CORBA::Environment &ACE_TRY_ENV)
    ACE_THROW_SPEC ((CORBA::SystemException))
{
  TAO_EC_ProxyPushConsumer* consumer =
    this->event_channel_->create_proxy_push_consumer ();

  return consumer->_this (ACE_TRY_ENV);
}

// ****************************************************************

void
TAO_EC_Connect_Supplier::work (TAO_EC_ProxyPushConsumer *consumer,
                               CORBA::Environment &ACE_TRY_ENV)
{
  consumer->connected (this->supplier_, ACE_TRY_ENV);
  ACE_CHECK;
  this->supplier_->connected (consumer, ACE_TRY_ENV);
  ACE_CHECK;
}

// ****************************************************************

void
TAO_EC_Reconnect_Supplier::work (TAO_EC_ProxyPushConsumer *consumer,
                                 CORBA::Environment &ACE_TRY_ENV)
{
  consumer->reconnected (this->supplier_, ACE_TRY_ENV);
  ACE_CHECK;
  this->supplier_->reconnected (consumer, ACE_TRY_ENV);
  ACE_CHECK;
}

// ****************************************************************

void
TAO_EC_Disconnect_Supplier::work (TAO_EC_ProxyPushConsumer *consumer,
                                  CORBA::Environment &ACE_TRY_ENV)
{
  consumer->disconnected (this->supplier_, ACE_TRY_ENV);
  ACE_CHECK;
  this->supplier_->disconnected (consumer, ACE_TRY_ENV);
  ACE_CHECK;
}

// ****************************************************************

void
TAO_EC_Shutdown_Consumer::work (TAO_EC_ProxyPushConsumer *consumer,
                                CORBA::Environment &ACE_TRY_ENV)
{
  ACE_TRY
    {
      consumer->shutdown (ACE_TRY_ENV);
      ACE_TRY_CHECK;
    }
  ACE_CATCHANY
    {
      // Ignore exceptions
    }
  ACE_ENDTRY;
}

#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)

template class TAO_EC_Worker<TAO_EC_ProxyPushConsumer>;

#elif defined(ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)

#pragma instantiate TAO_EC_Worker<TAO_EC_ProxyPushConsumer>

#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */