summaryrefslogtreecommitdiff
path: root/java/src/IceInternal/BatchOutgoing.java
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2007-11-27 11:58:35 +0100
committerBenoit Foucher <benoit@zeroc.com>2007-11-27 11:58:35 +0100
commit47f800495093fd7679a315e2d730fea22f6135b7 (patch)
treea7b8d3488f3841367dd03d10cae293f36fd10481 /java/src/IceInternal/BatchOutgoing.java
parentFixed SystemException to no longer derive from LocalException (diff)
downloadice-47f800495093fd7679a315e2d730fea22f6135b7.tar.bz2
ice-47f800495093fd7679a315e2d730fea22f6135b7.tar.xz
ice-47f800495093fd7679a315e2d730fea22f6135b7.zip
- Added support for non-blocking AMI/batch requests, connection
creation. - Added support for AMI oneway requests. - Changed collocation optimization to not perform any DNS lookups.
Diffstat (limited to 'java/src/IceInternal/BatchOutgoing.java')
-rw-r--r--java/src/IceInternal/BatchOutgoing.java92
1 files changed, 92 insertions, 0 deletions
diff --git a/java/src/IceInternal/BatchOutgoing.java b/java/src/IceInternal/BatchOutgoing.java
new file mode 100644
index 00000000000..1e0071f047a
--- /dev/null
+++ b/java/src/IceInternal/BatchOutgoing.java
@@ -0,0 +1,92 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2007 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;
+
+public final class BatchOutgoing implements OutgoingMessageCallback
+{
+ public
+ BatchOutgoing(Ice.ConnectionI connection, Instance instance)
+ {
+ _connection = connection;
+ _sent = false;
+ _os = new BasicStream(instance);
+ }
+
+ public
+ BatchOutgoing(RequestHandler handler)
+ {
+ _handler = handler;
+ _sent = false;
+ _os = new BasicStream(handler.getReference().getInstance());
+ }
+
+ public void
+ invoke()
+ {
+ assert(_handler != null || _connection != null);
+
+ if(_handler != null && !_handler.flushBatchRequests(this) ||
+ _connection != null && !_connection.flushBatchRequests(this))
+ synchronized(this)
+ {
+ while(_exception == null && !_sent)
+ {
+ try
+ {
+ wait();
+ }
+ catch(java.lang.InterruptedException ex)
+ {
+ }
+ }
+
+ if(_exception != null)
+ {
+ throw _exception;
+ }
+ }
+ }
+
+ public void
+ sent(boolean notify)
+ {
+ if(notify)
+ {
+ synchronized(this)
+ {
+ _sent = true;
+ notify();
+ }
+ }
+ else
+ {
+ _sent = true;
+ }
+ }
+
+ public synchronized void
+ finished(Ice.LocalException ex)
+ {
+ _exception = ex;
+ notify();
+ }
+
+ public BasicStream
+ os()
+ {
+ return _os;
+ }
+
+ private RequestHandler _handler;
+ private Ice.ConnectionI _connection;
+ private BasicStream _os;
+ private boolean _sent;
+ private Ice.LocalException _exception;
+}