summaryrefslogtreecommitdiff
path: root/java/test/Ice/plugin/plugins/PluginThreeFailFactory.java
blob: bc5e4cc0be122dd2ba53a4f5aa2c7bf8c495632a (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
// **********************************************************************
//
// Copyright (c) 2003-2014 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.
//
// **********************************************************************

package test.Ice.plugin.plugins;

public class PluginThreeFailFactory implements Ice.PluginFactory
{
    @Override
    public Ice.Plugin create(Ice.Communicator communicator, String name, String[] args)
    {
        return new PluginThreeFail(communicator);
    }

    public class PluginThreeFail extends BasePluginFail
    {
        public PluginThreeFail(Ice.Communicator communicator)
        {
            super(communicator);
        }

        @Override
        public void initialize()
        {
            throw new PluginInitializeFailException();
        }

        @Override
        public void destroy()
        {
            test(false);
        }

        @Override
        protected void finalize() throws Throwable
        {
            try
            {
                if(_initialized)
                {
                    System.out.println(getClass().getName() + " was initialized");
                }
                if(_destroyed)
                {
                    System.out.println(getClass().getName() + " was destroyed");
                }
            }
            finally
            {
                super.finalize();
            }
        }
    }
}