summaryrefslogtreecommitdiff
path: root/cpp/src/Glacier/Blobject.h
blob: e1628d1e439772688d63535ed3cdeca8ad590a86 (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
// **********************************************************************
//
// Copyright (c) 2003 - 2004
// ZeroC, Inc.
// North Palm Beach, FL, USA
//
// 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 BLOBJECT_H
#define BLOBJECT_H

#include <Ice/Ice.h>
#include <IceUtil/Monitor.h>
#include <Glacier/Request.h>

namespace Glacier
{

class TwowayThrottle : public IceUtil::Monitor<IceUtil::Mutex>
{
public:

    TwowayThrottle(const Ice::CommunicatorPtr&, bool);
    ~TwowayThrottle();

    void twowayStarted(const Ice::ObjectPrx&, const Ice::Current&);
    void twowayFinished();

private:

    const Ice::CommunicatorPtr _communicator;
    const bool _reverse;

    const Ice::PropertiesPtr _properties;
    const Ice::LoggerPtr _logger;
    const int _traceLevel;
    const int _max;

    int _count;
};

class Blobject : public Ice::BlobjectAsync
{
public:
    
    Blobject(const Ice::CommunicatorPtr&, bool);
    virtual ~Blobject();

    void destroy();
    void invoke(Ice::ObjectPrx&, const Ice::AMD_Object_ice_invokePtr&, const std::vector<Ice::Byte>&,
		const Ice::Current&);
    bool modifyProxy(Ice::ObjectPrx&, const Ice::Current&);

protected:

    Ice::CommunicatorPtr _communicator;
    const bool _reverse;

    const Ice::PropertiesPtr _properties;
    const Ice::LoggerPtr _logger;
    const int _traceLevel;

private:

    const bool _forwardContext;
    const IceUtil::Time _sleepTime;

    RequestQueuePtr _requestQueue;
    IceUtil::ThreadControl _requestQueueControl;

    TwowayThrottle _twowayThrottle;
};

}

#endif