blob: 7a38b63febb27c673ed29b88e39bc97aecb28766 (
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
|
// **********************************************************************
//
// Copyright (c) 2001
// Mutable Realms, Inc.
// Huntsville, AL, USA
//
// All Rights Reserved
//
// **********************************************************************
#include <Ice/Ice.h>
#include <IcePack/AdapterManager.h>
#include <IcePack/LocatorRegistryI.h>
using namespace std;
using namespace Ice;
using namespace IcePack;
IcePack::LocatorRegistryI::LocatorRegistryI(const AdapterManagerPrx& adapters) :
_adapters(adapters)
{
}
void
IcePack::LocatorRegistryI::addAdapter(const string& name, const ObjectPrx& proxy, const Current&)
{
while(true)
{
//
// Get the adapter from the manager.
//
AdapterPrx adapter = _adapters->findByName(name);
if(adapter)
{
//
// Set the adapter direct proxy and return.
//
try
{
adapter->setDirectProxy(proxy);
//
// The adapter is ready to receive requests even if
// it's not active.
//
adapter->markAsActive();
return;
}
catch (const ObjectNotExistException&)
{
}
}
//
// Adapter doesn't exist yet, create the adapter.
//
AdapterDescription desc;
desc.name = name;
desc.server = 0;
try
{
adapter = _adapters->create(desc);
}
catch (const AdapterExistsException&)
{
//
// Ignore, another thread probably created at the same
// time this adapter.
//
}
}
}
|