summaryrefslogtreecommitdiff
path: root/java/src/IceInternal/BatchOutgoing.java
diff options
context:
space:
mode:
authorMatthew Newhook <matthew@zeroc.com>2014-09-03 11:01:11 -0230
committerMatthew Newhook <matthew@zeroc.com>2014-09-03 11:01:11 -0230
commit3b0588532354adf7bf3b86e611a8ae4996bfe6ad (patch)
tree253961cb83af7bc3b1dfc7633a8f934789476cd1 /java/src/IceInternal/BatchOutgoing.java
parentMore work on ICE-2400: the send log thread now uses a separate communicator t... (diff)
downloadice-3b0588532354adf7bf3b86e611a8ae4996bfe6ad.tar.bz2
ice-3b0588532354adf7bf3b86e611a8ae4996bfe6ad.tar.xz
ice-3b0588532354adf7bf3b86e611a8ae4996bfe6ad.zip
- C#, Java: Removed Outgoing, fixed generated code to make synchronous
requests using AMI. - Java: AsyncResult is now an interface. - Added --arg to allTests.py. - Fixed operations, adapterDeactivation and metrics test to work with background IO. - Added Collocated interrupt test. - Added support for batch oneway requests using AMI. - Added test in operations for batch oneway requests using AMI.
Diffstat (limited to 'java/src/IceInternal/BatchOutgoing.java')
-rw-r--r--java/src/IceInternal/BatchOutgoing.java220
1 files changed, 0 insertions, 220 deletions
diff --git a/java/src/IceInternal/BatchOutgoing.java b/java/src/IceInternal/BatchOutgoing.java
deleted file mode 100644
index a5f958eb10b..00000000000
--- a/java/src/IceInternal/BatchOutgoing.java
+++ /dev/null
@@ -1,220 +0,0 @@
-// **********************************************************************
-//
-// 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 IceInternal;
-
-import Ice.Instrumentation.Observer;
-import Ice.Instrumentation.InvocationObserver;
-
-public final class BatchOutgoing implements OutgoingMessageCallback
-{
- public
- BatchOutgoing(Ice.ConnectionI connection, Instance instance, String op)
- {
- _connection = connection;
- _sent = false;
- _os = new BasicStream(instance, Protocol.currentProtocolEncoding);
- _observer = IceInternal.ObserverHelper.get(instance, op);
- }
-
- public
- BatchOutgoing(Ice.ObjectPrxHelperBase proxy, String op)
- {
- _proxy = proxy;
- _sent = false;
- _os = new BasicStream(proxy.__reference().getInstance(), Protocol.currentProtocolEncoding);
- _observer = IceInternal.ObserverHelper.get(proxy, op);
- Protocol.checkSupportedProtocol(_proxy.__reference().getProtocol());
- }
-
- public void
- invoke()
- throws InterruptedException
- {
- assert(_proxy != null || _connection != null);
-
- if(_connection != null)
- {
- if(_connection.flushBatchRequests(this))
- {
- return;
- }
-
- synchronized(this)
- {
- while(_exception == null && !_sent)
- {
- wait();
- }
- if(_exception != null)
- {
- throw _exception;
- }
- }
- return;
- }
-
- RequestHandler handler = null;
- try
- {
- handler = _proxy.__getRequestHandler();
- if(handler.sendRequest(this))
- {
- return;
- }
-
- boolean timedOut = false;
- synchronized(this)
- {
- int timeout = _proxy.__reference().getInvocationTimeout();
- if(timeout > 0)
- {
- long now = Time.currentMonotonicTimeMillis();
- long deadline = now + timeout;
- while(_exception == null && !_sent && !timedOut)
- {
- wait(deadline - now);
- if(_exception == null && !_sent)
- {
- now = Time.currentMonotonicTimeMillis();
- timedOut = now >= deadline;
- }
- }
- }
- else
- {
- while(_exception == null && !_sent)
- {
- wait();
- }
- }
- }
-
- if(timedOut)
- {
- if(handler.requestCanceled(this, new Ice.InvocationTimeoutException()))
- {
- synchronized(this)
- {
- while(_exception == null)
- {
- wait();
- }
- }
- }
- }
-
- if(_exception != null)
- {
- throw (Ice.Exception)_exception.fillInStackTrace();
- }
- }
- catch(RetryException ex)
- {
- //
- // Clear request handler but don't retry or throw. Retrying
- // isn't useful, there were no batch requests associated with
- // the proxy's request handler.
- //
- _proxy.__setRequestHandler(handler, null);
- }
- catch(Ice.Exception ex)
- {
- _proxy.__setRequestHandler(handler, null); // Clear request handler
- if(_observer != null)
- {
- _observer.failed(ex.ice_name());
- }
- throw ex; // Throw to notify the user that batch requests were potentially lost.
- }
- }
-
- @Override
- public boolean
- send(Ice.ConnectionI connection, boolean compress, boolean response)
- {
- return connection.flushBatchRequests(this);
- }
-
- @Override
- public void
- invokeCollocated(CollocatedRequestHandler handler)
- {
- handler.invokeBatchRequests(this);
- }
-
- @Override
- synchronized public void
- sent()
- {
- if(_childObserver != null)
- {
- _childObserver.detach();
- _childObserver = null;
- }
- _sent = true;
- notify();
- }
-
- @Override
- public synchronized void
- finished(Ice.Exception ex)
- {
- if(_childObserver != null)
- {
- _childObserver.failed(ex.ice_name());
- _childObserver.detach();
- _childObserver = null;
- }
- _exception = ex;
- notify();
- }
-
- public BasicStream
- os()
- {
- return _os;
- }
-
- public void
- attachRemoteObserver(Ice.ConnectionInfo info, Ice.Endpoint endpt, int size)
- {
- if(_observer != null)
- {
- _childObserver = _observer.getRemoteObserver(info, endpt, 0, size);
- if(_childObserver != null)
- {
- _childObserver.attach();
- }
- }
- }
-
- public void
- attachCollocatedObserver(Ice.ObjectAdapter adapter, int requestId)
- {
- if(_observer != null)
- {
- _childObserver = _observer.getCollocatedObserver(adapter, requestId, _os.size() - Protocol.headerSize - 4);
- if(_childObserver != null)
- {
- _childObserver.attach();
- }
- }
- }
-
- private Ice.ObjectPrxHelperBase _proxy;
- private Ice.ConnectionI _connection;
- private BasicStream _os;
- private boolean _sent;
- private Ice.Exception _exception;
-
- private InvocationObserver _observer;
- private Observer _childObserver;
-
-}