summaryrefslogtreecommitdiff
path: root/cpp/src/IceGrid/SessionServantLocatorI.h
blob: 3385a1233db01f1f01cc90400322215177f158ee (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
// **********************************************************************
//
// Copyright (c) 2003-2007 ZeroC, Inc. All rights reserved.
//
// This copy of Ice is licensed to you under the terms described in the
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************

#ifndef ICE_GRID_SESSIONSERVANTLOCATOR_H
#define ICE_GRID_SESSIONSERVANTLOCATOR_H

#include <IceUtil/Mutex.h>
#include <Ice/ServantLocator.h>

namespace IceGrid
{

class SessionServantLocatorI : public Ice::ServantLocator, public IceUtil::Mutex
{
public:

    SessionServantLocatorI(const Ice::ObjectAdapterPtr&, const std::string&);

    Ice::ObjectPtr locate(const Ice::Current&, Ice::LocalObjectPtr&);
    void finished(const Ice::Current&, const Ice::ObjectPtr&, const Ice::LocalObjectPtr&);
    void deactivate(const std::string&);

    Ice::ObjectPrx add(const Ice::ObjectPtr&, const Ice::ConnectionPtr&);
    void remove(const Ice::Identity&);

private:

    struct SessionServant
    {
        SessionServant(const Ice::ObjectPtr& s, const Ice::ConnectionPtr& con) : servant(s), connection(con) { }

        const Ice::ObjectPtr servant;
        const Ice::ConnectionPtr connection;
    };

    const Ice::ObjectAdapterPtr _adapter;
    const std::string _instanceName;
    std::map<Ice::Identity, SessionServant> _servants;
};
typedef IceUtil::Handle<SessionServantLocatorI> SessionServantLocatorIPtr;

};

#endif