ICE 3.4.2
[php5-ice-freebsdport.git] / cs / test / Ice / ami / TestI.cs
blob79ca87758e9a107a53b0733e58f2617acabbdb9e
1 // **********************************************************************
2 //
3 // Copyright (c) 2003-2011 ZeroC, Inc. All rights reserved.
4 //
5 // This copy of Ice is licensed to you under the terms described in the
6 // ICE_LICENSE file included in this distribution.
7 //
8 // **********************************************************************
10 using Test;
11 using System.Threading;
13 public class TestI : TestIntfDisp_
15 public TestI()
19 override public void
20 op(Ice.Current current)
24 override public int
25 opWithResult(Ice.Current current)
27 return 15;
30 override public void
31 opWithUE(Ice.Current current)
33 throw new TestIntfException();
36 override public void
37 opWithPayload(byte[] seq, Ice.Current current)
41 override public void
42 opBatch(Ice.Current current)
44 _m.Lock();
45 try
47 ++_batchCount;
48 _m.Notify();
50 finally
52 _m.Unlock();
56 override public int
57 opBatchCount(Ice.Current current)
59 _m.Lock();
60 try
62 return _batchCount;
64 finally
66 _m.Unlock();
70 override public bool
71 waitForBatch(int count, Ice.Current current)
73 _m.Lock();
74 try
76 while(_batchCount < count)
78 _m.TimedWait(5000);
80 bool result = count == _batchCount;
81 _batchCount = 0;
82 return result;
84 finally
86 _m.Unlock();
90 override public void
91 shutdown(Ice.Current current)
93 current.adapter.getCommunicator().shutdown();
96 private int _batchCount;
97 private readonly IceUtilInternal.Monitor _m = new IceUtilInternal.Monitor();
100 public class TestControllerI : TestIntfControllerDisp_
102 override public void
103 holdAdapter(Ice.Current current)
105 _adapter.hold();
108 override public void
109 resumeAdapter(Ice.Current current)
111 _adapter.activate();
114 public
115 TestControllerI(Ice.ObjectAdapter adapter)
117 _adapter = adapter;
120 private Ice.ObjectAdapter _adapter;