diff options
author | Mark Spruiell <mes@zeroc.com> | 2017-01-30 13:45:21 -0800 |
---|---|---|
committer | Mark Spruiell <mes@zeroc.com> | 2017-01-30 13:45:21 -0800 |
commit | 61270a10f980933cf582edb766f10c8ac6d86e8a (patch) | |
tree | 45ab4a7c2986954054fce613bc3c8f7967e7951e /java | |
parent | Fix slice2cpp build failure (diff) | |
download | ice-61270a10f980933cf582edb766f10c8ac6d86e8a.tar.bz2 ice-61270a10f980933cf582edb766f10c8ac6d86e8a.tar.xz ice-61270a10f980933cf582edb766f10c8ac6d86e8a.zip |
merging IceBridge into master
Diffstat (limited to 'java')
25 files changed, 405 insertions, 129 deletions
diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/ConnectionI.java b/java/src/Ice/src/main/java/com/zeroc/Ice/ConnectionI.java index ef086dbf88a..13b2d7a1dcc 100644 --- a/java/src/Ice/src/main/java/com/zeroc/Ice/ConnectionI.java +++ b/java/src/Ice/src/main/java/com/zeroc/Ice/ConnectionI.java @@ -165,25 +165,27 @@ public final class ConnectionI extends com.zeroc.IceInternal.EventHandler } @Override - synchronized public void close(boolean force) + synchronized public void close(ConnectionClose mode) { if(Thread.interrupted()) { throw new OperationInterruptedException(); } - if(force) + if(mode == ConnectionClose.CloseForcefully) { - setState(StateClosed, new ForcedCloseConnectionException()); + setState(StateClosed, new ConnectionManuallyClosedException(false)); + } + else if(mode == ConnectionClose.CloseGracefully) + { + setState(StateClosing, new ConnectionManuallyClosedException(true)); } else { + assert(mode == ConnectionClose.CloseGracefullyAndWait); + // - // If we do a graceful shutdown, then we wait until all - // outstanding requests have been completed. Otherwise, - // the CloseConnectionException will cause all outstanding - // requests to be retried, regardless of whether the - // server has processed them or not. + // Wait until all outstanding requests have been completed. // while(!_asyncRequests.isEmpty()) { @@ -197,7 +199,7 @@ public final class ConnectionI extends com.zeroc.IceInternal.EventHandler } } - setState(StateClosing, new CloseConnectionException()); + setState(StateClosing, new ConnectionManuallyClosedException(true)); } } @@ -289,14 +291,14 @@ public final class ConnectionI extends com.zeroc.IceInternal.EventHandler // We send a heartbeat if there was no activity in the last // (timeout / 4) period. Sending a heartbeat sooner than // really needed is safer to ensure that the receiver will - // receive in time the heartbeat. Sending the heartbeat if + // receive the heartbeat in time. Sending the heartbeat if // there was no activity in the last (timeout / 2) period // isn't enough since monitor() is called only every (timeout // / 2) period. // // Note that this doesn't imply that we are sending 4 // heartbeats per timeout period because the monitor() method - // is sill only called every (timeout / 2) period. + // is still only called every (timeout / 2) period. // if(acm.heartbeat == ACMHeartbeat.HeartbeatAlways || (acm.heartbeat != ACMHeartbeat.HeartbeatOff && _writeStream.isEmpty() && @@ -304,7 +306,7 @@ public final class ConnectionI extends com.zeroc.IceInternal.EventHandler { if(acm.heartbeat != ACMHeartbeat.HeartbeatOnInvocation || _dispatchCount > 0) { - heartbeat(); + sendHeartbeatNow(); } } @@ -480,6 +482,107 @@ public final class ConnectionI extends com.zeroc.IceInternal.EventHandler } @Override + public void heartbeat() + { + ObjectPrx.waitForResponseForCompletion(heartbeatAsync()); + } + + private class HeartbeatAsync extends com.zeroc.IceInternal.OutgoingAsyncBaseI<Void> + { + public HeartbeatAsync(Communicator communicator, com.zeroc.IceInternal.Instance instance) + { + super(communicator, instance, "heartbeat"); + } + + @Override + public Connection getConnection() + { + return ConnectionI.this; + } + + @Override + protected void markSent() + { + super.markSent(); + + assert((_state & StateOK) != 0); + complete(null); + } + + @Override + protected void markCompleted() + { + if(_exception != null) + { + completeExceptionally(_exception); + } + super.markCompleted(); + } + + public void invoke() + { + try + { + _os.writeBlob(Protocol.magic); + ProtocolVersion.ice_write(_os, Protocol.currentProtocol); + EncodingVersion.ice_write(_os, Protocol.currentProtocolEncoding); + _os.writeByte(Protocol.validateConnectionMsg); + _os.writeByte((byte) 0); + _os.writeInt(Protocol.headerSize); // Message size. + + int status; + if(_instance.queueRequests()) + { + status = _instance.getQueueExecutor().execute(new Callable<Integer>() + { + @Override + public Integer call() + throws com.zeroc.IceInternal.RetryException + { + return ConnectionI.this.sendAsyncRequest(HeartbeatAsync.this, false, false, 0); + } + }); + } + else + { + status = ConnectionI.this.sendAsyncRequest(this, false, false, 0); + } + + if((status & AsyncStatus.Sent) > 0) + { + _sentSynchronously = true; + if((status & AsyncStatus.InvokeSentCallback) > 0) + { + invokeSent(); + } + } + } + catch(com.zeroc.IceInternal.RetryException ex) + { + if(completed(ex.get())) + { + invokeCompletedAsync(); + } + } + catch(com.zeroc.Ice.Exception ex) + { + if(completed(ex)) + { + invokeCompletedAsync(); + } + } + } + } + + @Override + public java.util.concurrent.CompletableFuture<Void> heartbeatAsync() + { + HeartbeatAsync __f = new HeartbeatAsync(_communicator, _instance); + __f.invoke(); + return __f; + } + + @Override synchronized public void setACM(java.util.OptionalInt timeout, java.util.Optional<ACMClose> close, java.util.Optional<ACMHeartbeat> heartbeat) { @@ -664,8 +767,7 @@ public final class ConnectionI extends com.zeroc.IceInternal.EventHandler public synchronized void invokeException(int requestId, LocalException ex, int invokeNum, boolean amd) { // - // Fatal exception while invoking a request. Since - // sendResponse/sendNoResponse isn't + // Fatal exception while invoking a request. Since sendResponse/sendNoResponse isn't // called in case of a fatal exception we decrement _dispatchCount here. // @@ -931,7 +1033,7 @@ public final class ConnectionI extends com.zeroc.IceInternal.EventHandler } else { - assert (_state <= StateClosingPending); + assert(_state <= StateClosingPending); // // We parse messages first, if we receive a close @@ -1107,7 +1209,8 @@ public final class ConnectionI extends com.zeroc.IceInternal.EventHandler // if(info.invokeNum > 0) { - invokeAll(info.stream, info.invokeNum, info.requestId, info.compress, info.servantManager, info.adapter); + invokeAll(info.stream, info.invokeNum, info.requestId, info.compress, info.servantManager, + info.adapter); // // Don't increase dispatchedCount, the dispatch count is @@ -1264,7 +1367,7 @@ public final class ConnectionI extends com.zeroc.IceInternal.EventHandler // Trace the cause of unexpected connection closures // if(!(_exception instanceof CloseConnectionException || - _exception instanceof ForcedCloseConnectionException || + _exception instanceof ConnectionManuallyClosedException || _exception instanceof ConnectionTimeoutException || _exception instanceof CommunicatorDestroyedException || _exception instanceof ObjectAdapterDeactivatedException)) @@ -1614,7 +1717,7 @@ public final class ConnectionI extends com.zeroc.IceInternal.EventHandler // Don't warn about certain expected exceptions. // if(!(_exception instanceof CloseConnectionException || - _exception instanceof ForcedCloseConnectionException || + _exception instanceof ConnectionManuallyClosedException || _exception instanceof ConnectionTimeoutException || _exception instanceof CommunicatorDestroyedException || _exception instanceof ObjectAdapterDeactivatedException || @@ -1804,7 +1907,7 @@ public final class ConnectionI extends com.zeroc.IceInternal.EventHandler if(_observer != null && state == StateClosed && _exception != null) { if(!(_exception instanceof CloseConnectionException || - _exception instanceof ForcedCloseConnectionException || + _exception instanceof ConnectionManuallyClosedException || _exception instanceof ConnectionTimeoutException || _exception instanceof CommunicatorDestroyedException || _exception instanceof ObjectAdapterDeactivatedException || @@ -1833,8 +1936,7 @@ public final class ConnectionI extends com.zeroc.IceInternal.EventHandler private void initiateShutdown() { - assert (_state == StateClosing); - assert (_dispatchCount == 0); + assert(_state == StateClosing && _dispatchCount == 0); if(_shutdownInitiated) { @@ -1861,8 +1963,7 @@ public final class ConnectionI extends com.zeroc.IceInternal.EventHandler setState(StateClosingPending); // - // Notify the the transceiver of the graceful connection - // closure. + // Notify the transceiver of the graceful connection closure. // int op = _transceiver.closing(true, _exception); if(op != 0) @@ -1874,7 +1975,7 @@ public final class ConnectionI extends com.zeroc.IceInternal.EventHandler } } - private void heartbeat() + private void sendHeartbeatNow() { assert (_state == StateActive); @@ -2071,8 +2172,7 @@ public final class ConnectionI extends com.zeroc.IceInternal.EventHandler } else if(_state == StateClosingPending && _writeStream.pos() == 0) { - // Message wasn't sent, empty the _writeStream, we're not going to - // send more data. + // Message wasn't sent, empty the _writeStream, we're not going to send more data. OutgoingMessage message = _sendStreams.getFirst(); _writeStream.swap(message.stream); return SocketOperation.None; @@ -2149,9 +2249,8 @@ public final class ConnectionI extends com.zeroc.IceInternal.EventHandler } // - // If all the messages were sent and we are in the closing state, we - // schedule the close timeout to wait for the peer to close the - // connection. + // If all the messages were sent and we are in the closing state, we schedule + // the close timeout to wait for the peer to close the connection. // if(_state == StateClosing && _shutdownInitiated) { @@ -2376,8 +2475,7 @@ public final class ConnectionI extends com.zeroc.IceInternal.EventHandler setState(StateClosingPending, new CloseConnectionException()); // - // Notify the the transceiver of the graceful connection - // closure. + // Notify the transceiver of the graceful connection closure. // int op = _transceiver.closing(false, _exception); if(op != 0) @@ -2393,9 +2491,8 @@ public final class ConnectionI extends com.zeroc.IceInternal.EventHandler { if(_state >= StateClosing) { - TraceUtil.trace("received request during closing\n" - + "(ignored by server, client will retry)", info.stream, _logger, - _traceLevels); + TraceUtil.trace("received request during closing\n(ignored by server, client will retry)", + info.stream, _logger, _traceLevels); } else { @@ -2413,9 +2510,8 @@ public final class ConnectionI extends com.zeroc.IceInternal.EventHandler { if(_state >= StateClosing) { - TraceUtil.trace("received batch request during closing\n" - + "(ignored by server, client will retry)", info.stream, _logger, - _traceLevels); + TraceUtil.trace("received batch request during closing\n(ignored by server, client will retry)", + info.stream, _logger, _traceLevels); } else { diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/IncomingConnectionFactory.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/IncomingConnectionFactory.java index 337e56f05f7..98dd813fb66 100644 --- a/java/src/Ice/src/main/java/com/zeroc/IceInternal/IncomingConnectionFactory.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/IncomingConnectionFactory.java @@ -137,7 +137,7 @@ public final class IncomingConnectionFactory extends EventHandler implements Con // for(ConnectionI c : connections) { - c.close(true); + c.close(com.zeroc.Ice.ConnectionClose.CloseForcefully); } throw e; } diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/OutgoingConnectionFactory.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/OutgoingConnectionFactory.java index 3e62623a17f..9bd778ecfb4 100644 --- a/java/src/Ice/src/main/java/com/zeroc/IceInternal/OutgoingConnectionFactory.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/OutgoingConnectionFactory.java @@ -138,7 +138,7 @@ public final class OutgoingConnectionFactory { for(ConnectionI c : l) { - c.close(true); + c.close(com.zeroc.Ice.ConnectionClose.CloseForcefully); } } throw new com.zeroc.Ice.OperationInterruptedException(); diff --git a/java/test/src/main/java/test/Ice/acm/AllTests.java b/java/test/src/main/java/test/Ice/acm/AllTests.java index 8208748c069..97820ba81e6 100644 --- a/java/test/src/main/java/test/Ice/acm/AllTests.java +++ b/java/test/src/main/java/test/Ice/acm/AllTests.java @@ -568,6 +568,31 @@ public class AllTests } } + static class HeartbeatManualTest extends TestCase + { + public HeartbeatManualTest(Application app, RemoteCommunicatorPrx com, java.io.PrintWriter out) + { + super(app, "manual heartbeats", com, out); + // + // Disable heartbeats. + // + setClientACM(10, -1, 0); + setServerACM(10, -1, 0); + } + + public void runTestCase(RemoteObjectAdapterPrx adapter, TestIntfPrx proxy) + { + proxy.startHeartbeatCount(); + com.zeroc.Ice.Connection con = proxy.ice_getConnection(); + con.heartbeat(); + con.heartbeat(); + con.heartbeat(); + con.heartbeat(); + con.heartbeat(); + proxy.waitForHeartbeatCount(5); + } + } + static class SetACMTest extends TestCase { public SetACMTest(Application app, RemoteCommunicatorPrx com, java.io.PrintWriter out) @@ -600,7 +625,8 @@ public class AllTests test(acm.heartbeat == ACMHeartbeat.HeartbeatAlways); // Make sure the client sends few heartbeats to the server - proxy.waitForHeartbeat(2); + proxy.startHeartbeatCount(); + proxy.waitForHeartbeatCount(2); } } @@ -627,6 +653,7 @@ public class AllTests tests.add(new HeartbeatOnIdleTest(app, com, out)); tests.add(new HeartbeatAlwaysTest(app, com, out)); + tests.add(new HeartbeatManualTest(app, com, out)); tests.add(new SetACMTest(app, com, out)); for(TestCase test : tests) diff --git a/java/test/src/main/java/test/Ice/acm/Test.ice b/java/test/src/main/java/test/Ice/acm/Test.ice index 117192a2df8..7f71427c741 100644 --- a/java/test/src/main/java/test/Ice/acm/Test.ice +++ b/java/test/src/main/java/test/Ice/acm/Test.ice @@ -18,7 +18,8 @@ interface TestIntf void sleep(int seconds); void sleepAndHold(int seconds); void interruptSleep(); - void waitForHeartbeat(int count); + void startHeartbeatCount(); + void waitForHeartbeatCount(int count); }; interface RemoteObjectAdapter diff --git a/java/test/src/main/java/test/Ice/acm/TestI.java b/java/test/src/main/java/test/Ice/acm/TestI.java index 7b9c369e4f3..43e6fb38d0d 100644 --- a/java/test/src/main/java/test/Ice/acm/TestI.java +++ b/java/test/src/main/java/test/Ice/acm/TestI.java @@ -50,35 +50,29 @@ public class TestI implements TestIntf } } - static class Counter - { - Counter(int v) - { - value = v; - } - - int value; - } - - public void waitForHeartbeat(int count, com.zeroc.Ice.Current current) + public void startHeartbeatCount(com.zeroc.Ice.Current current) { - final Counter c = new Counter(count); + _counter = new Counter(); current.con.setHeartbeatCallback(con -> { - synchronized(c) + synchronized(_counter) { - --c.value; - c.notifyAll(); + ++_counter.value; + _counter.notifyAll(); } }); + } - synchronized(c) + public void waitForHeartbeatCount(int count, com.zeroc.Ice.Current current) + { + assert(_counter != null); + synchronized(_counter) { - while(c.value > 0) + while(_counter.value < count) { try { - c.wait(); + _counter.wait(); } catch(InterruptedException ex) { @@ -86,4 +80,11 @@ public class TestI implements TestIntf } } } + + static class Counter + { + int value; + } + + private Counter _counter; } diff --git a/java/test/src/main/java/test/Ice/ami/AMI.java b/java/test/src/main/java/test/Ice/ami/AMI.java index 85a543317a4..0c6b125897a 100644 --- a/java/test/src/main/java/test/Ice/ami/AMI.java +++ b/java/test/src/main/java/test/Ice/ami/AMI.java @@ -17,6 +17,7 @@ import java.util.concurrent.CompletionException; import com.zeroc.Ice.InvocationFuture; import com.zeroc.Ice.Util; +import test.Ice.ami.Test.CloseMode; import test.Ice.ami.Test.TestIntfPrx; import test.Ice.ami.Test.TestIntfControllerPrx; import test.Ice.ami.Test.TestIntfException; @@ -347,7 +348,7 @@ public class AMI test(p.opBatchCount() == 0); TestIntfPrx b1 = p.ice_batchOneway(); b1.opBatch(); - b1.ice_getConnection().close(false); + b1.ice_getConnection().close(com.zeroc.Ice.ConnectionClose.CloseGracefullyAndWait); CompletableFuture<Void> r = b1.ice_flushBatchRequestsAsync(); Util.getInvocationFuture(r).whenSent((sentSynchronously, ex) -> { @@ -395,7 +396,7 @@ public class AMI TestIntfPrx b1 = TestIntfPrx.uncheckedCast(p.ice_getConnection().createProxy(p.ice_getIdentity())). ice_batchOneway(); b1.opBatch(); - b1.ice_getConnection().close(false); + b1.ice_getConnection().close(com.zeroc.Ice.ConnectionClose.CloseGracefullyAndWait); CompletableFuture<Void> r = b1.ice_getConnection().flushBatchRequestsAsync(); Util.getInvocationFuture(r).whenSent((sentSynchronously, ex) -> { @@ -444,7 +445,7 @@ public class AMI TestIntfPrx b1 = TestIntfPrx.uncheckedCast(p.ice_getConnection().createProxy(p.ice_getIdentity())). ice_batchOneway(); b1.opBatch(); - b1.ice_getConnection().close(false); + b1.ice_getConnection().close(com.zeroc.Ice.ConnectionClose.CloseGracefullyAndWait); CompletableFuture<Void> r = communicator.flushBatchRequestsAsync(); Util.getInvocationFuture(r).whenSent((sentSynchronously, ex) -> { @@ -500,7 +501,7 @@ public class AMI b2.ice_getConnection(); // Ensure connection is established. b1.opBatch(); b2.opBatch(); - b1.ice_getConnection().close(false); + b1.ice_getConnection().close(com.zeroc.Ice.ConnectionClose.CloseGracefullyAndWait); CompletableFuture<Void> r = communicator.flushBatchRequestsAsync(); Util.getInvocationFuture(r).whenSent((sentSynchronously, ex) -> { @@ -528,8 +529,8 @@ public class AMI b2.ice_getConnection(); // Ensure connection is established. b1.opBatch(); b2.opBatch(); - b1.ice_getConnection().close(false); - b2.ice_getConnection().close(false); + b1.ice_getConnection().close(com.zeroc.Ice.ConnectionClose.CloseGracefullyAndWait); + b2.ice_getConnection().close(com.zeroc.Ice.ConnectionClose.CloseGracefullyAndWait); CompletableFuture<Void> r = communicator.flushBatchRequestsAsync(); Util.getInvocationFuture(r).whenSent((sentSynchronously, ex) -> { @@ -756,9 +757,35 @@ public class AMI if(p.ice_getConnection() != null) { - out.print("testing close connection with sending queue... "); + out.print("testing graceful close connection with wait... "); out.flush(); { + // + // Local case: begin several requests, close the connection gracefully, and make sure it waits + // for the requests to complete. + // + java.util.List<CompletableFuture<Void>> results = new java.util.ArrayList<>(); + for(int i = 0; i < 3; ++i) + { + results.add(p.sleepAsync(50)); + } + p.ice_getConnection().close(com.zeroc.Ice.ConnectionClose.CloseGracefullyAndWait); + for(CompletableFuture<Void> f : results) + { + try + { + f.join(); + } + catch(Throwable ex) + { + test(false); + } + } + } + { + // + // Remote case. + // byte[] seq = new byte[1024 * 10]; // @@ -777,7 +804,7 @@ public class AMI { results.add(Util.getInvocationFuture(p.opWithPayloadAsync(seq))); } - if(!Util.getInvocationFuture(p.closeAsync(false)).isSent()) + if(!Util.getInvocationFuture(p.closeAsync(CloseMode.CloseGracefullyAndWait)).isSent()) { for(int i = 0; i < maxQueue; i++) { @@ -803,6 +830,98 @@ public class AMI } } out.println("ok"); + + out.print("testing graceful close connection without wait... "); + out.flush(); + { + // + // Local case: start a lengthy operation and then close the connection gracefully on the client side + // without waiting for the pending invocation to complete. There will be no retry and we expect the + // invocation to fail with ConnectionManuallyClosedException. + // + // This test requires two threads in the server's thread pool: one will block in sleep() and the other + // will process the CloseConnection message. + // + p.ice_ping(); + com.zeroc.Ice.Connection con = p.ice_getConnection(); + CompletableFuture<Void> f = p.sleepAsync(100); + con.close(com.zeroc.Ice.ConnectionClose.CloseGracefully); + try + { + f.join(); + test(false); + } + catch(CompletionException ex) + { + test(ex.getCause() instanceof com.zeroc.Ice.ConnectionManuallyClosedException); + test(((com.zeroc.Ice.ConnectionManuallyClosedException)ex.getCause()).graceful); + } + catch(Throwable ex) + { + test(false); + } + + // + // Remote case: the server closes the connection gracefully. Our call to TestIntf::close() + // completes successfully and then the connection should be closed immediately afterward, + // despite the fact that there's a pending call to sleep(). The call to sleep() should be + // automatically retried and complete successfully. + // + p.ice_ping(); + con = p.ice_getConnection(); + Callback cb = new Callback(); + con.setCloseCallback(c -> cb.called()); + f = p.sleepAsync(100); + p.close(CloseMode.CloseGracefully); + cb.check(); + f.join(); + p.ice_ping(); + test(p.ice_getConnection() != con); + } + out.println("ok"); + + out.print("testing forceful close connection... "); + out.flush(); + { + // + // Local case: start a lengthy operation and then close the connection forcefully on the client side. + // There will be no retry and we expect the invocation to fail with ConnectionManuallyClosedException. + // + p.ice_ping(); + com.zeroc.Ice.Connection con = p.ice_getConnection(); + CompletableFuture<Void> f = p.sleepAsync(100); + con.close(com.zeroc.Ice.ConnectionClose.CloseForcefully); + try + { + f.join(); + test(false); + } + catch(CompletionException ex) + { + test(ex.getCause() instanceof com.zeroc.Ice.ConnectionManuallyClosedException); + test(!((com.zeroc.Ice.ConnectionManuallyClosedException)ex.getCause()).graceful); + } + catch(Throwable ex) + { + test(false); + } + + // + // Remote case: the server closes the connection forcefully. This causes the request to fail + // with a ConnectionLostException. Since the close() operation is not idempotent, the client + // will not retry. + // + try + { + p.close(CloseMode.CloseForcefully); + test(false); + } + catch(com.zeroc.Ice.ConnectionLostException ex) + { + // Expected. + } + } + out.println("ok"); } } } diff --git a/java/test/src/main/java/test/Ice/ami/Client.java b/java/test/src/main/java/test/Ice/ami/Client.java index f0992f5bece..50fb9fdddee 100644 --- a/java/test/src/main/java/test/Ice/ami/Client.java +++ b/java/test/src/main/java/test/Ice/ami/Client.java @@ -24,6 +24,7 @@ public class Client extends test.Util.Application GetInitDataResult r = super.getInitData(args); r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.ami"); r.initData.properties.setProperty("Ice.Warn.AMICallback", "0"); + r.initData.properties.setProperty("Ice.Warn.Connections", "0"); // // Limit the send buffer size, this test relies on the socket diff --git a/java/test/src/main/java/test/Ice/ami/Server.java b/java/test/src/main/java/test/Ice/ami/Server.java index 90a41a5eaf5..c244441f2e5 100644 --- a/java/test/src/main/java/test/Ice/ami/Server.java +++ b/java/test/src/main/java/test/Ice/ami/Server.java @@ -33,6 +33,12 @@ public class Server extends test.Util.Application r.initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(r.initData.properties, 0)); r.initData.properties.setProperty("ControllerAdapter.Endpoints", getTestEndpoint(r.initData.properties, 1)); r.initData.properties.setProperty("ControllerAdapter.ThreadPool.Size", "1"); + + // + // This test kills connections, so we don't want warnings. + // + r.initData.properties.setProperty("Ice.Warn.Connections", "0"); + // // Limit the recv buffer size, this test relies on the socket // send() blocking after sending a given amount of data. diff --git a/java/test/src/main/java/test/Ice/ami/Test.ice b/java/test/src/main/java/test/Ice/ami/Test.ice index 82b3fe6d383..bbc4d908d65 100644 --- a/java/test/src/main/java/test/Ice/ami/Test.ice +++ b/java/test/src/main/java/test/Ice/ami/Test.ice @@ -20,6 +20,13 @@ exception TestIntfException { }; +enum CloseMode +{ + CloseForcefully, + CloseGracefully, + CloseGracefullyAndWait +}; + interface TestIntf { void op(); @@ -30,7 +37,8 @@ interface TestIntf void opBatch(); int opBatchCount(); bool waitForBatch(int count); - void close(bool force); + void close(CloseMode mode); + void sleep(int ms); void shutdown(); bool supportsFunctionalTests(); diff --git a/java/test/src/main/java/test/Ice/ami/TestI.java b/java/test/src/main/java/test/Ice/ami/TestI.java index 0153f138dd0..ee7f4eef6f9 100644 --- a/java/test/src/main/java/test/Ice/ami/TestI.java +++ b/java/test/src/main/java/test/Ice/ami/TestI.java @@ -9,6 +9,7 @@ package test.Ice.ami; +import test.Ice.ami.Test.CloseMode; import test.Ice.ami.Test.TestIntf; import test.Ice.ami.Test.TestIntfException; @@ -123,9 +124,22 @@ public class TestI implements TestIntf @Override public void - close(boolean force, com.zeroc.Ice.Current current) + close(CloseMode mode, com.zeroc.Ice.Current current) { - current.con.close(force); + current.con.close(com.zeroc.Ice.ConnectionClose.valueOf(mode.value())); + } + + @Override + public void + sleep(int ms, com.zeroc.Ice.Current current) + { + try + { + Thread.sleep(ms); + } + catch(InterruptedException ex) + { + } } @Override diff --git a/java/test/src/main/java/test/Ice/background/AllTests.java b/java/test/src/main/java/test/Ice/background/AllTests.java index ca465338b01..b174df088ed 100644 --- a/java/test/src/main/java/test/Ice/background/AllTests.java +++ b/java/test/src/main/java/test/Ice/background/AllTests.java @@ -295,7 +295,7 @@ public class AllTests configuration.buffered(true); backgroundController.buffered(true); background.opAsync(); - background.ice_getCachedConnection().close(true); + background.ice_getCachedConnection().close(com.zeroc.Ice.ConnectionClose.CloseForcefully); background.opAsync(); java.util.List<CompletableFuture<Void>> results = new java.util.ArrayList<>(); @@ -334,7 +334,7 @@ public class AllTests { test(false); } - background.ice_getConnection().close(false); + background.ice_getConnection().close(com.zeroc.Ice.ConnectionClose.CloseGracefullyAndWait); for(int i = 0; i < 4; ++i) { @@ -396,7 +396,7 @@ public class AllTests } configuration.connectException(new com.zeroc.Ice.SocketException()); - background.ice_getCachedConnection().close(true); + background.ice_getCachedConnection().close(com.zeroc.Ice.ConnectionClose.CloseForcefully); try { Thread.sleep(10); @@ -439,7 +439,7 @@ public class AllTests ex.printStackTrace(); test(false); } - background.ice_getConnection().close(false); + background.ice_getConnection().close(com.zeroc.Ice.ConnectionClose.CloseGracefullyAndWait); for(int i = 0; i < 4; i++) { @@ -498,7 +498,7 @@ public class AllTests { test(false); } - background.ice_getConnection().close(false); + background.ice_getConnection().close(com.zeroc.Ice.ConnectionClose.CloseGracefullyAndWait); try { @@ -510,7 +510,7 @@ public class AllTests { test(false); } - background.ice_getConnection().close(false); + background.ice_getConnection().close(com.zeroc.Ice.ConnectionClose.CloseGracefullyAndWait); try { @@ -554,7 +554,7 @@ public class AllTests { test(false); } - background.ice_getConnection().close(false); + background.ice_getConnection().close(com.zeroc.Ice.ConnectionClose.CloseGracefullyAndWait); try { @@ -589,7 +589,7 @@ public class AllTests } configuration.initializeException(new com.zeroc.Ice.SocketException()); - background.ice_getCachedConnection().close(true); + background.ice_getCachedConnection().close(com.zeroc.Ice.ConnectionClose.CloseForcefully); try { Thread.sleep(10); @@ -615,7 +615,7 @@ public class AllTests } configuration.initializeSocketStatus(com.zeroc.IceInternal.SocketOperation.Write); - background.ice_getCachedConnection().close(true); + background.ice_getCachedConnection().close(com.zeroc.Ice.ConnectionClose.CloseForcefully); try { @@ -630,7 +630,7 @@ public class AllTests configuration.initializeSocketStatus(com.zeroc.IceInternal.SocketOperation.None); ctl.initializeException(true); - background.ice_getCachedConnection().close(true); + background.ice_getCachedConnection().close(com.zeroc.Ice.ConnectionClose.CloseForcefully); try { Thread.sleep(10); @@ -658,7 +658,7 @@ public class AllTests try { ctl.initializeSocketStatus(com.zeroc.IceInternal.SocketOperation.Write); - background.ice_getCachedConnection().close(true); + background.ice_getCachedConnection().close(com.zeroc.Ice.ConnectionClose.CloseForcefully); background.op(); ctl.initializeSocketStatus(com.zeroc.IceInternal.SocketOperation.None); } @@ -693,7 +693,7 @@ public class AllTests { test(false); } - background.ice_getConnection().close(false); + background.ice_getConnection().close(com.zeroc.Ice.ConnectionClose.CloseGracefullyAndWait); try { @@ -741,7 +741,7 @@ public class AllTests ex.printStackTrace(); test(false); } - background.ice_getConnection().close(false); + background.ice_getConnection().close(com.zeroc.Ice.ConnectionClose.CloseGracefullyAndWait); try { @@ -815,7 +815,7 @@ public class AllTests ex.printStackTrace(); test(false); } - background.ice_getConnection().close(false); + background.ice_getConnection().close(com.zeroc.Ice.ConnectionClose.CloseGracefullyAndWait); try { @@ -845,7 +845,7 @@ public class AllTests backgroundBatchOneway.op(); ctl.resumeAdapter(); backgroundBatchOneway.ice_flushBatchRequests(); - backgroundBatchOneway.ice_getConnection().close(false); + backgroundBatchOneway.ice_getConnection().close(com.zeroc.Ice.ConnectionClose.CloseGracefullyAndWait); // // Send bigger requests to test with auto-flushing. @@ -857,7 +857,7 @@ public class AllTests backgroundBatchOneway.opWithPayload(seq); ctl.resumeAdapter(); backgroundBatchOneway.ice_flushBatchRequests(); - backgroundBatchOneway.ice_getConnection().close(false); + backgroundBatchOneway.ice_getConnection().close(com.zeroc.Ice.ConnectionClose.CloseGracefullyAndWait); // // Then try the same thing with async flush. @@ -869,7 +869,7 @@ public class AllTests backgroundBatchOneway.op(); ctl.resumeAdapter(); backgroundBatchOneway.ice_flushBatchRequestsAsync(); - backgroundBatchOneway.ice_getConnection().close(false); + backgroundBatchOneway.ice_getConnection().close(com.zeroc.Ice.ConnectionClose.CloseGracefullyAndWait); ctl.holdAdapter(); backgroundBatchOneway.opWithPayload(seq); @@ -879,7 +879,7 @@ public class AllTests ctl.resumeAdapter(); r = backgroundBatchOneway.ice_flushBatchRequestsAsync(); r.join(); - backgroundBatchOneway.ice_getConnection().close(false); + backgroundBatchOneway.ice_getConnection().close(com.zeroc.Ice.ConnectionClose.CloseGracefullyAndWait); } private static void readWriteTests(Configuration configuration, BackgroundPrx background, @@ -1274,7 +1274,7 @@ public class AllTests } background.ice_ping(); - background.ice_getCachedConnection().close(true); + background.ice_getCachedConnection().close(com.zeroc.Ice.ConnectionClose.CloseForcefully); try { Thread.sleep(10); @@ -1283,7 +1283,7 @@ public class AllTests { } - background.ice_getCachedConnection().close(true); + background.ice_getCachedConnection().close(com.zeroc.Ice.ConnectionClose.CloseForcefully); } thread1._destroy(); diff --git a/java/test/src/main/java/test/Ice/binding/AllTests.java b/java/test/src/main/java/test/Ice/binding/AllTests.java index e464b71d8af..068307d7c96 100644 --- a/java/test/src/main/java/test/Ice/binding/AllTests.java +++ b/java/test/src/main/java/test/Ice/binding/AllTests.java @@ -16,6 +16,7 @@ import test.Ice.binding.Test.RemoteObjectAdapterPrx; import test.Ice.binding.Test.TestIntfPrx; import test.Util.Application; +import com.zeroc.Ice.ConnectionClose; import com.zeroc.Ice.Endpoint; import com.zeroc.Ice.EndpointSelectionType; @@ -132,7 +133,7 @@ public class AllTests test(test2.ice_getConnection() == test3.ice_getConnection()); names.remove(test1.getAdapterName()); - test1.ice_getConnection().close(false); + test1.ice_getConnection().close(com.zeroc.Ice.ConnectionClose.CloseGracefullyAndWait); } // @@ -154,7 +155,7 @@ public class AllTests for(RemoteObjectAdapterPrx p : adapters) { - p.getTestIntf().ice_getConnection().close(false); + p.getTestIntf().ice_getConnection().close(com.zeroc.Ice.ConnectionClose.CloseGracefullyAndWait); } } @@ -179,7 +180,7 @@ public class AllTests test(test2.ice_getConnection() == test3.ice_getConnection()); names.remove(test1.getAdapterName()); - test1.ice_getConnection().close(false); + test1.ice_getConnection().close(com.zeroc.Ice.ConnectionClose.CloseGracefullyAndWait); } // @@ -287,7 +288,7 @@ public class AllTests { try { - a.getTestIntf().ice_getConnection().close(false); + a.getTestIntf().ice_getConnection().close(com.zeroc.Ice.ConnectionClose.CloseGracefullyAndWait); } catch(com.zeroc.Ice.LocalException ex) { @@ -328,7 +329,7 @@ public class AllTests test(test2.ice_getConnection() == test3.ice_getConnection()); names.remove(getAdapterNameWithAMI(test1)); - test1.ice_getConnection().close(false); + test1.ice_getConnection().close(com.zeroc.Ice.ConnectionClose.CloseGracefullyAndWait); } // @@ -350,7 +351,7 @@ public class AllTests for(RemoteObjectAdapterPrx p : adapters) { - p.getTestIntf().ice_getConnection().close(false); + p.getTestIntf().ice_getConnection().close(com.zeroc.Ice.ConnectionClose.CloseGracefullyAndWait); } } @@ -375,7 +376,7 @@ public class AllTests test(test2.ice_getConnection() == test3.ice_getConnection()); names.remove(getAdapterNameWithAMI(test1)); - test1.ice_getConnection().close(false); + test1.ice_getConnection().close(com.zeroc.Ice.ConnectionClose.CloseGracefullyAndWait); } // @@ -408,7 +409,7 @@ public class AllTests while(!names.isEmpty()) { names.remove(test.getAdapterName()); - test.ice_getConnection().close(false); + test.ice_getConnection().close(com.zeroc.Ice.ConnectionClose.CloseGracefullyAndWait); } test = test.ice_endpointSelection(EndpointSelectionType.Random); @@ -420,7 +421,7 @@ public class AllTests while(!names.isEmpty()) { names.remove(test.getAdapterName()); - test.ice_getConnection().close(false); + test.ice_getConnection().close(com.zeroc.Ice.ConnectionClose.CloseGracefullyAndWait); } deactivate(rcom, adapters); @@ -484,11 +485,11 @@ public class AllTests adapters.add(rcom.createObjectAdapter("Adapter36", endpoints[2].toString())); for(i = 0; i < nRetry && test.getAdapterName().equals("Adapter36"); i++); test(i == nRetry); - test.ice_getConnection().close(false); + test.ice_getConnection().close(com.zeroc.Ice.ConnectionClose.CloseGracefullyAndWait); adapters.add(rcom.createObjectAdapter("Adapter35", endpoints[1].toString())); for(i = 0; i < nRetry && test.getAdapterName().equals("Adapter35"); i++); test(i == nRetry); - test.ice_getConnection().close(false); + test.ice_getConnection().close(com.zeroc.Ice.ConnectionClose.CloseGracefullyAndWait); adapters.add(rcom.createObjectAdapter("Adapter34", endpoints[0].toString())); for(i = 0; i < nRetry && test.getAdapterName().equals("Adapter34"); i++); test(i == nRetry); @@ -785,7 +786,7 @@ public class AllTests for(i = 0; i < 5; i++) { test(test.getAdapterName().equals("Adapter82")); - test.ice_getConnection().close(false); + test.ice_getConnection().close(com.zeroc.Ice.ConnectionClose.CloseGracefullyAndWait); } TestIntfPrx testSecure = test.ice_secure(true); @@ -801,7 +802,7 @@ public class AllTests for(i = 0; i < 5; i++) { test(test.getAdapterName().equals("Adapter81")); - test.ice_getConnection().close(false); + test.ice_getConnection().close(com.zeroc.Ice.ConnectionClose.CloseGracefullyAndWait); } rcom.createObjectAdapter("Adapter83", (test.ice_getEndpoints()[1]).toString()); // Reactive tcp OA. @@ -809,7 +810,7 @@ public class AllTests for(i = 0; i < 5; i++) { test(test.getAdapterName().equals("Adapter83")); - test.ice_getConnection().close(false); + test.ice_getConnection().close(com.zeroc.Ice.ConnectionClose.CloseGracefullyAndWait); } rcom.deactivateObjectAdapter(adapters.get(0)); @@ -1004,7 +1005,7 @@ public class AllTests // Close the connection now to free a FD (it could be done after the sleep but // there could be race condiutation since the connection might not be closed // immediately due to threading). - test.ice_connectionId("0").ice_getConnection().close(false); + test.ice_connectionId("0").ice_getConnection().close(ConnectionClose.CloseGracefullyAndWait); // // The server closed the acceptor, wait one second and retry after freeing a FD. diff --git a/java/test/src/main/java/test/Ice/hold/AllTests.java b/java/test/src/main/java/test/Ice/hold/AllTests.java index 31db0c827da..36974038091 100644 --- a/java/test/src/main/java/test/Ice/hold/AllTests.java +++ b/java/test/src/main/java/test/Ice/hold/AllTests.java @@ -205,7 +205,7 @@ public class AllTests { f.waitForSent(); holdSerialized.ice_ping(); // Ensure everything's dispatched - holdSerialized.ice_getConnection().close(false); + holdSerialized.ice_getConnection().close(com.zeroc.Ice.ConnectionClose.CloseGracefullyAndWait); } } r.join(); diff --git a/java/test/src/main/java/test/Ice/interrupt/AllTests.java b/java/test/src/main/java/test/Ice/interrupt/AllTests.java index 233a595197d..62a1d6034e1 100644 --- a/java/test/src/main/java/test/Ice/interrupt/AllTests.java +++ b/java/test/src/main/java/test/Ice/interrupt/AllTests.java @@ -336,7 +336,7 @@ public class AllTests { final Thread mainThread = Thread.currentThread(); - p.ice_getConnection().close(false); + p.ice_getConnection().close(com.zeroc.Ice.ConnectionClose.CloseGracefullyAndWait); CompletableFuture<com.zeroc.Ice.Connection> r = p.ice_getConnectionAsync(); mainThread.interrupt(); @@ -358,7 +358,7 @@ public class AllTests // Expected } - p.ice_getConnection().close(false); + p.ice_getConnection().close(com.zeroc.Ice.ConnectionClose.CloseGracefullyAndWait); final Callback cb = new Callback(); mainThread.interrupt(); diff --git a/java/test/src/main/java/test/Ice/location/AllTests.java b/java/test/src/main/java/test/Ice/location/AllTests.java index 60bcd506d8f..2b6fb9aa789 100644 --- a/java/test/src/main/java/test/Ice/location/AllTests.java +++ b/java/test/src/main/java/test/Ice/location/AllTests.java @@ -592,7 +592,7 @@ public class AllTests out.flush(); hello = HelloPrx.checkedCast(communicator.stringToProxy("hello")); obj.migrateHello(); - hello.ice_getConnection().close(false); + hello.ice_getConnection().close(com.zeroc.Ice.ConnectionClose.CloseGracefullyAndWait); hello.sayHello(); obj.migrateHello(); hello.sayHello(); diff --git a/java/test/src/main/java/test/Ice/metrics/AMDMetricsI.java b/java/test/src/main/java/test/Ice/metrics/AMDMetricsI.java index 916af54b6ae..c329b58a85b 100644 --- a/java/test/src/main/java/test/Ice/metrics/AMDMetricsI.java +++ b/java/test/src/main/java/test/Ice/metrics/AMDMetricsI.java @@ -29,7 +29,7 @@ public final class AMDMetricsI implements Metrics @Override public CompletionStage<Void> failAsync(com.zeroc.Ice.Current current) { - current.con.close(true); + current.con.close(com.zeroc.Ice.ConnectionClose.CloseForcefully); return CompletableFuture.completedFuture((Void)null); } diff --git a/java/test/src/main/java/test/Ice/metrics/AllTests.java b/java/test/src/main/java/test/Ice/metrics/AllTests.java index 051af2be8a2..5f7ada1e51f 100644 --- a/java/test/src/main/java/test/Ice/metrics/AllTests.java +++ b/java/test/src/main/java/test/Ice/metrics/AllTests.java @@ -260,7 +260,7 @@ public class AllTests { if(proxy.ice_getCachedConnection() != null) { - proxy.ice_getCachedConnection().close(false); + proxy.ice_getCachedConnection().close(com.zeroc.Ice.ConnectionClose.CloseGracefullyAndWait); } try @@ -273,7 +273,7 @@ public class AllTests if(proxy.ice_getCachedConnection() != null) { - proxy.ice_getCachedConnection().close(false); + proxy.ice_getCachedConnection().close(com.zeroc.Ice.ConnectionClose.CloseGracefullyAndWait); } } @@ -478,8 +478,9 @@ public class AllTests if(!collocated) { - metrics.ice_getConnection().close(false); - metrics.ice_connectionId("Con1").ice_getConnection().close(false); + metrics.ice_getConnection().close(com.zeroc.Ice.ConnectionClose.CloseGracefullyAndWait); + metrics.ice_connectionId("Con1").ice_getConnection().close( + com.zeroc.Ice.ConnectionClose.CloseGracefullyAndWait); waitForCurrent(clientMetrics, "View", "Connection", 0); waitForCurrent(serverMetrics, "View", "Connection", 0); @@ -582,7 +583,7 @@ public class AllTests map = toMap(serverMetrics.getMetricsView("View").returnValue.get("Connection")); test(map.get("holding").current == 1); - metrics.ice_getConnection().close(false); + metrics.ice_getConnection().close(com.zeroc.Ice.ConnectionClose.CloseGracefullyAndWait); map = toMap(clientMetrics.getMetricsView("View").returnValue.get("Connection")); test(map.get("closing").current == 1); @@ -597,7 +598,7 @@ public class AllTests props.put("IceMX.Metrics.View.Map.Connection.GroupBy", "none"); updateProps(clientProps, serverProps, props, "Connection"); - metrics.ice_getConnection().close(false); + metrics.ice_getConnection().close(com.zeroc.Ice.ConnectionClose.CloseGracefullyAndWait); metrics.ice_timeout(500).ice_ping(); controller.hold(); @@ -659,7 +660,7 @@ public class AllTests testAttribute(clientMetrics, clientProps, "Connection", "mcastHost", "", out); testAttribute(clientMetrics, clientProps, "Connection", "mcastPort", "", out); - m.ice_getConnection().close(false); + m.ice_getConnection().close(com.zeroc.Ice.ConnectionClose.CloseGracefullyAndWait); waitForCurrent(clientMetrics, "View", "Connection", 0); waitForCurrent(serverMetrics, "View", "Connection", 0); @@ -680,7 +681,7 @@ public class AllTests clientMetrics.getMetricsView("View").returnValue.get("ConnectionEstablishment")[0]; test(m1.current == 0 && m1.total == 1 && m1.id.equals(hostAndPort)); - metrics.ice_getConnection().close(false); + metrics.ice_getConnection().close(com.zeroc.Ice.ConnectionClose.CloseGracefullyAndWait); controller.hold(); try { @@ -737,7 +738,7 @@ public class AllTests try { prx.ice_ping(); - prx.ice_getConnection().close(false); + prx.ice_getConnection().close(com.zeroc.Ice.ConnectionClose.CloseGracefullyAndWait); } catch(com.zeroc.Ice.LocalException ex) { diff --git a/java/test/src/main/java/test/Ice/metrics/MetricsI.java b/java/test/src/main/java/test/Ice/metrics/MetricsI.java index 8a8342431b1..7c9e1a527e5 100644 --- a/java/test/src/main/java/test/Ice/metrics/MetricsI.java +++ b/java/test/src/main/java/test/Ice/metrics/MetricsI.java @@ -25,7 +25,7 @@ public final class MetricsI implements Metrics @Override public void fail(com.zeroc.Ice.Current current) { - current.con.close(true); + current.con.close(com.zeroc.Ice.ConnectionClose.CloseForcefully); } @Override diff --git a/java/test/src/main/java/test/Ice/operations/BatchOneways.java b/java/test/src/main/java/test/Ice/operations/BatchOneways.java index d47af8c6bc2..30a5672e80d 100644 --- a/java/test/src/main/java/test/Ice/operations/BatchOneways.java +++ b/java/test/src/main/java/test/Ice/operations/BatchOneways.java @@ -109,7 +109,7 @@ class BatchOneways batch1.ice_ping(); batch2.ice_ping(); batch1.ice_flushBatchRequests(); - batch1.ice_getConnection().close(false); + batch1.ice_getConnection().close(com.zeroc.Ice.ConnectionClose.CloseGracefullyAndWait); batch1.ice_ping(); batch2.ice_ping(); @@ -117,7 +117,7 @@ class BatchOneways batch2.ice_getConnection(); batch1.ice_ping(); - batch1.ice_getConnection().close(false); + batch1.ice_getConnection().close(com.zeroc.Ice.ConnectionClose.CloseGracefullyAndWait); batch1.ice_ping(); batch2.ice_ping(); } diff --git a/java/test/src/main/java/test/Ice/operations/BatchOnewaysAMI.java b/java/test/src/main/java/test/Ice/operations/BatchOnewaysAMI.java index c759e3dc6e9..1093418d3b1 100644 --- a/java/test/src/main/java/test/Ice/operations/BatchOnewaysAMI.java +++ b/java/test/src/main/java/test/Ice/operations/BatchOnewaysAMI.java @@ -100,7 +100,7 @@ class BatchOnewaysAMI batch.ice_pingAsync(); batch2.ice_pingAsync(); batch.ice_flushBatchRequestsAsync().join(); - batch.ice_getConnection().close(false); + batch.ice_getConnection().close(com.zeroc.Ice.ConnectionClose.CloseGracefullyAndWait); batch.ice_pingAsync(); batch2.ice_pingAsync(); @@ -108,7 +108,7 @@ class BatchOnewaysAMI batch2.ice_getConnection(); batch.ice_pingAsync(); - batch.ice_getConnection().close(false); + batch.ice_getConnection().close(com.zeroc.Ice.ConnectionClose.CloseGracefullyAndWait); test(!batch.ice_pingAsync().isCompletedExceptionally()); test(!batch2.ice_pingAsync().isCompletedExceptionally()); } diff --git a/java/test/src/main/java/test/Ice/retry/RetryI.java b/java/test/src/main/java/test/Ice/retry/RetryI.java index 827365878ee..23d09ead06e 100644 --- a/java/test/src/main/java/test/Ice/retry/RetryI.java +++ b/java/test/src/main/java/test/Ice/retry/RetryI.java @@ -24,7 +24,7 @@ public final class RetryI implements Retry { if(current.con != null) { - current.con.close(true); + current.con.close(com.zeroc.Ice.ConnectionClose.CloseForcefully); } else { diff --git a/java/test/src/main/java/test/Ice/timeout/AllTests.java b/java/test/src/main/java/test/Ice/timeout/AllTests.java index 0ba6091a244..1b8172762f9 100644 --- a/java/test/src/main/java/test/Ice/timeout/AllTests.java +++ b/java/test/src/main/java/test/Ice/timeout/AllTests.java @@ -262,7 +262,7 @@ public class AllTests TimeoutPrx to = TimeoutPrx.checkedCast(obj.ice_timeout(100 * mult)); com.zeroc.Ice.Connection connection = to.ice_getConnection(); timeout.holdAdapter(500); - connection.close(false); + connection.close(com.zeroc.Ice.ConnectionClose.CloseGracefullyAndWait); try { connection.getInfo(); // getInfo() doesn't throw in the closing state. @@ -283,9 +283,10 @@ public class AllTests connection.getInfo(); test(false); } - catch(com.zeroc.Ice.CloseConnectionException ex) + catch(com.zeroc.Ice.ConnectionManuallyClosedException ex) { // Expected. + test(ex.graceful); } timeout.op(); // Ensure adapter is active. } diff --git a/java/test/src/main/java/test/Ice/udp/AllTests.java b/java/test/src/main/java/test/Ice/udp/AllTests.java index 302f9849122..8fddc3c1388 100644 --- a/java/test/src/main/java/test/Ice/udp/AllTests.java +++ b/java/test/src/main/java/test/Ice/udp/AllTests.java @@ -124,7 +124,7 @@ public class AllTests { test(seq.length > 16384); } - obj.ice_getConnection().close(false); + obj.ice_getConnection().close(com.zeroc.Ice.ConnectionClose.CloseGracefullyAndWait); communicator.getProperties().setProperty("Ice.UDP.SndSize", "64000"); seq = new byte[50000]; try diff --git a/java/test/src/main/java/test/IceSSL/configuration/AllTests.java b/java/test/src/main/java/test/IceSSL/configuration/AllTests.java index 6c21b6c5e08..1ece2537cac 100644 --- a/java/test/src/main/java/test/IceSSL/configuration/AllTests.java +++ b/java/test/src/main/java/test/IceSSL/configuration/AllTests.java @@ -889,7 +889,7 @@ public class AllTests // verifier.reset(); verifier.returnValue(false); - server.ice_getConnection().close(false); + server.ice_getConnection().close(com.zeroc.Ice.ConnectionClose.CloseGracefullyAndWait); try { server.ice_ping(); |