summaryrefslogtreecommitdiff
path: root/cpp/test/Ice/faultTolerance/TestI.cpp
blob: 60c6e2dc250761ecfc121ea0d038680bcd77775d (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
// **********************************************************************
//
// Copyright (c) 2003-2004 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.
//
// **********************************************************************

#include <Ice/Ice.h>
#include <TestI.h>

TestI::TestI(const Ice::ObjectAdapterPtr& adapter, const CleanerPtr& cleaner) :
    _adapter(adapter),
    _cleaner(cleaner)
{
}

void
TestI::shutdown(const Ice::Current&)
{
    _adapter->getCommunicator()->shutdown();
}

void
TestI::abort(const Ice::Current&)
{
    ::_exit(0);
}

void
TestI::idempotentAbort(const Ice::Current&)
{
    ::_exit(0);
}

void
TestI::nonmutatingAbort(const Ice::Current&) const
{
    ::_exit(0);
}

Ice::Int
TestI::pid(const Ice::Current&)
{
#ifdef _WIN32
    return _getpid();
#else
    return getpid();
#endif
}

CleanerI::CleanerI(const Ice::CommunicatorPtr& communicator)
{
    _communicator = communicator;
}

void
CleanerI::cleanup(const Ice::Current&)
{
    if(_communicator)
    {
        _communicator->destroy();
	_communicator = 0;
    }
}