diff options
author | Marc Laukien <marc@zeroc.com> | 2002-11-27 21:54:20 +0000 |
---|---|---|
committer | Marc Laukien <marc@zeroc.com> | 2002-11-27 21:54:20 +0000 |
commit | 8042456879b8fde8683df20274e7dc887a1e6737 (patch) | |
tree | f8ef3dc13589e6610e5473d5e5319125af2ee754 /java/src | |
parent | added ami (diff) | |
download | ice-8042456879b8fde8683df20274e7dc887a1e6737.tar.bz2 ice-8042456879b8fde8683df20274e7dc887a1e6737.tar.xz ice-8042456879b8fde8683df20274e7dc887a1e6737.zip |
various changes
Diffstat (limited to 'java/src')
-rw-r--r-- | java/src/Ice/LocationForward.java | 30 | ||||
-rw-r--r-- | java/src/Ice/ObjectPrxHelper.java | 56 | ||||
-rw-r--r-- | java/src/Ice/_ObjectDel.java | 12 | ||||
-rw-r--r-- | java/src/Ice/_ObjectDelD.java | 46 | ||||
-rw-r--r-- | java/src/Ice/_ObjectDelM.java | 15 | ||||
-rw-r--r-- | java/src/IceInternal/Connection.java | 25 | ||||
-rw-r--r-- | java/src/IceInternal/DispatchStatus.java | 16 | ||||
-rw-r--r-- | java/src/IceInternal/Incoming.java | 19 | ||||
-rw-r--r-- | java/src/IceInternal/Instance.java | 4 | ||||
-rw-r--r-- | java/src/IceInternal/Outgoing.java | 33 | ||||
-rw-r--r-- | java/src/IceInternal/ThreadPool.java | 4 | ||||
-rw-r--r-- | java/src/IceInternal/TraceUtil.java | 6 |
12 files changed, 60 insertions, 206 deletions
diff --git a/java/src/Ice/LocationForward.java b/java/src/Ice/LocationForward.java deleted file mode 100644 index a1c67c4558d..00000000000 --- a/java/src/Ice/LocationForward.java +++ /dev/null @@ -1,30 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2002 -// ZeroC, Inc. -// Billerica, MA, USA -// -// All Rights Reserved. -// -// Ice is free software; you can redistribute it and/or modify it under -// the terms of the GNU General Public License version 2 as published by -// the Free Software Foundation. -// -// ********************************************************************** - -package Ice; - -// -// LocationForward must be an unchecked exception, because it can -// be thrown from any servant operation -// -public class LocationForward extends RuntimeException -{ - public - LocationForward(ObjectPrx prx) - { - _prx = prx; - } - - public ObjectPrx _prx; -} diff --git a/java/src/Ice/ObjectPrxHelper.java b/java/src/Ice/ObjectPrxHelper.java index 840463753f2..bc5c6196c72 100644 --- a/java/src/Ice/ObjectPrxHelper.java +++ b/java/src/Ice/ObjectPrxHelper.java @@ -45,10 +45,6 @@ public class ObjectPrxHelper implements ObjectPrx _ObjectDel __del = __getDelegate(); return __del.ice_isA(__id, __context); } - catch(LocationForward __ex) - { - __locationForward(__ex); - } catch(IceInternal.NonRepeatable __ex) { __cnt = __handleException(__ex.get(), __cnt); @@ -78,10 +74,6 @@ public class ObjectPrxHelper implements ObjectPrx __del.ice_ping(__context); return; } - catch(LocationForward __ex) - { - __locationForward(__ex); - } catch(IceInternal.NonRepeatable __ex) { __cnt = __handleException(__ex.get(), __cnt); @@ -110,10 +102,6 @@ public class ObjectPrxHelper implements ObjectPrx _ObjectDel __del = __getDelegate(); return __del.ice_ids(__context); } - catch(LocationForward __ex) - { - __locationForward(__ex); - } catch(IceInternal.NonRepeatable __ex) { __cnt = __handleException(__ex.get(), __cnt); @@ -142,10 +130,6 @@ public class ObjectPrxHelper implements ObjectPrx _ObjectDel __del = __getDelegate(); return __del.ice_id(__context); } - catch(LocationForward __ex) - { - __locationForward(__ex); - } catch(IceInternal.NonRepeatable __ex) { __cnt = __handleException(__ex.get(), __cnt); @@ -174,10 +158,6 @@ public class ObjectPrxHelper implements ObjectPrx _ObjectDel __del = __getDelegate(); return __del.ice_facets(__context); } - catch(LocationForward __ex) - { - __locationForward(__ex); - } catch(IceInternal.NonRepeatable __ex) { __cnt = __handleException(__ex.get(), __cnt); @@ -207,10 +187,6 @@ public class ObjectPrxHelper implements ObjectPrx _ObjectDel __del = __getDelegate(); return __del.ice_invoke(operation, mode, inParams, outParams, __context); } - catch(LocationForward __ex) - { - __locationForward(__ex); - } catch(IceInternal.NonRepeatable __ex) { if(mode == OperationMode.Nonmutating || mode == OperationMode.Idempotent) @@ -588,38 +564,6 @@ public class ObjectPrxHelper implements ObjectPrx throw ex; } - public final synchronized void - __locationForward(LocationForward ex) - { - _delegate = null; - - ObjectPrxHelper h = (ObjectPrxHelper)ex._prx; - if(!_reference.identity.equals(h.__reference().identity)) - { - throw new LocationForwardIdentityException(); - } - - // - // TODO: BENOIT: This is not thread-safe. Everywhere else in the - // code, _reference is considered immutable and is not mutex - // protected. - // - _reference = _reference.changeAdapterId(h.__reference().adapterId); - _reference = _reference.changeEndpoints(h.__reference().endpoints); - - /* - IceInternal.TraceLevels traceLevels = - _reference.instance.traceLevels(); - Logger logger = _reference.instance.logger(); - - if(traceLevels.locationForward >= 1) - { - String s = "location forward for object with identity `" + _reference.identity + "'"; - logger.trace(traceLevels.locationForwardCat, s); - } - */ - } - public final synchronized _ObjectDel __getDelegate() { diff --git a/java/src/Ice/_ObjectDel.java b/java/src/Ice/_ObjectDel.java index 3b7427573a7..1d277eb9e24 100644 --- a/java/src/Ice/_ObjectDel.java +++ b/java/src/Ice/_ObjectDel.java @@ -17,23 +17,23 @@ package Ice; public interface _ObjectDel { boolean ice_isA(String __id, java.util.Map __context) - throws LocationForward, IceInternal.NonRepeatable; + throws IceInternal.NonRepeatable; void ice_ping(java.util.Map __context) - throws LocationForward, IceInternal.NonRepeatable; + throws IceInternal.NonRepeatable; String[] ice_ids(java.util.Map __context) - throws LocationForward, IceInternal.NonRepeatable; + throws IceInternal.NonRepeatable; String ice_id(java.util.Map __context) - throws LocationForward, IceInternal.NonRepeatable; + throws IceInternal.NonRepeatable; String[] ice_facets(java.util.Map __context) - throws LocationForward, IceInternal.NonRepeatable; + throws IceInternal.NonRepeatable; boolean ice_invoke(String operation, Ice.OperationMode mode, byte[] inParams, ByteSeqHolder outParams, java.util.Map context) - throws LocationForward, IceInternal.NonRepeatable; + throws IceInternal.NonRepeatable; void ice_flush(); } diff --git a/java/src/Ice/_ObjectDelD.java b/java/src/Ice/_ObjectDelD.java index 046517b4f5d..518bcc697ee 100644 --- a/java/src/Ice/_ObjectDelD.java +++ b/java/src/Ice/_ObjectDelD.java @@ -18,7 +18,7 @@ public class _ObjectDelD implements _ObjectDel { public boolean ice_isA(String __id, java.util.Map __context) - throws LocationForward, IceInternal.NonRepeatable + throws IceInternal.NonRepeatable { Current __current = new Current(); __initCurrent(__current, "ice_isA", OperationMode.Nonmutating, __context); @@ -38,7 +38,7 @@ public class _ObjectDelD implements _ObjectDel public void ice_ping(java.util.Map __context) - throws LocationForward, IceInternal.NonRepeatable + throws IceInternal.NonRepeatable { Current __current = new Current(); __initCurrent(__current, "ice_ping", OperationMode.Nonmutating, __context); @@ -59,7 +59,7 @@ public class _ObjectDelD implements _ObjectDel public String[] ice_ids(java.util.Map __context) - throws LocationForward, IceInternal.NonRepeatable + throws IceInternal.NonRepeatable { Current __current = new Current(); __initCurrent(__current, "ice_ids", OperationMode.Nonmutating, __context); @@ -79,7 +79,7 @@ public class _ObjectDelD implements _ObjectDel public String ice_id(java.util.Map __context) - throws LocationForward, IceInternal.NonRepeatable + throws IceInternal.NonRepeatable { Current __current = new Current(); __initCurrent(__current, "ice_id", OperationMode.Nonmutating, __context); @@ -99,7 +99,7 @@ public class _ObjectDelD implements _ObjectDel public String[] ice_facets(java.util.Map __context) - throws LocationForward, IceInternal.NonRepeatable + throws IceInternal.NonRepeatable { Current __current = new Current(); __initCurrent(__current, "ice_facets", OperationMode.Nonmutating, __context); @@ -119,46 +119,20 @@ public class _ObjectDelD implements _ObjectDel public boolean ice_invoke(String operation, Ice.OperationMode mode, byte[] inParams, ByteSeqHolder outParams, - java.util.Map context) - throws LocationForward, IceInternal.NonRepeatable + java.util.Map context) + throws IceInternal.NonRepeatable { - Current current = new Current(); - __initCurrent(current, operation, mode, context); - while(true) - { - IceInternal.Direct __direct = new IceInternal.Direct(current); - try - { - Blobject servant = null; - try - { - servant = (Blobject)__direct.facetServant(); - } - catch(ClassCastException ex) - { - OperationNotExistException opEx = new OperationNotExistException(); - opEx.id = current.id; - opEx.facet = current.facet; - opEx.operation = current.operation; - throw opEx; - } - return servant.ice_invoke(inParams, outParams, current); - } - finally - { - __direct.destroy(); - } - } + throw new CollocationOptimizationException(); } public void ice_flush() { - // Nothing to do for direct delegates + // Nothing to do for direct delegates. } // - // Only for use by ObjectPrx + // Only for use by ObjectPrx. // final void __copyFrom(_ObjectDelD from) diff --git a/java/src/Ice/_ObjectDelM.java b/java/src/Ice/_ObjectDelM.java index ee1ed8bcf98..12aabfcd57a 100644 --- a/java/src/Ice/_ObjectDelM.java +++ b/java/src/Ice/_ObjectDelM.java @@ -18,7 +18,7 @@ public class _ObjectDelM implements _ObjectDel { public boolean ice_isA(String __id, java.util.Map __context) - throws LocationForward, IceInternal.NonRepeatable + throws IceInternal.NonRepeatable { IceInternal.Outgoing __out = getOutgoing("ice_isA", OperationMode.Nonmutating, __context); try @@ -40,7 +40,7 @@ public class _ObjectDelM implements _ObjectDel public void ice_ping(java.util.Map __context) - throws LocationForward, IceInternal.NonRepeatable + throws IceInternal.NonRepeatable { IceInternal.Outgoing __out = getOutgoing("ice_ping", OperationMode.Nonmutating, __context); try @@ -58,7 +58,7 @@ public class _ObjectDelM implements _ObjectDel public String[] ice_ids(java.util.Map __context) - throws LocationForward, IceInternal.NonRepeatable + throws IceInternal.NonRepeatable { IceInternal.Outgoing __out = getOutgoing("ice_ids", OperationMode.Nonmutating, __context); try @@ -78,7 +78,7 @@ public class _ObjectDelM implements _ObjectDel public String ice_id(java.util.Map __context) - throws LocationForward, IceInternal.NonRepeatable + throws IceInternal.NonRepeatable { IceInternal.Outgoing __out = getOutgoing("ice_id", OperationMode.Nonmutating, __context); try @@ -98,7 +98,7 @@ public class _ObjectDelM implements _ObjectDel public String[] ice_facets(java.util.Map __context) - throws LocationForward, IceInternal.NonRepeatable + throws IceInternal.NonRepeatable { IceInternal.Outgoing __out = getOutgoing("ice_facets", OperationMode.Nonmutating, __context); try @@ -117,9 +117,8 @@ public class _ObjectDelM implements _ObjectDel } public boolean - ice_invoke(String operation, OperationMode mode, byte[] inParams, ByteSeqHolder outParams, - java.util.Map __context) - throws LocationForward, IceInternal.NonRepeatable + ice_invoke(String operation, OperationMode mode, byte[] inParams, ByteSeqHolder outParams, java.util.Map __context) + throws IceInternal.NonRepeatable { IceInternal.Outgoing __out = getOutgoing(operation, OperationMode.Nonmutating, __context); try diff --git a/java/src/IceInternal/Connection.java b/java/src/IceInternal/Connection.java index f78ee3d08d8..9a9070265eb 100644 --- a/java/src/IceInternal/Connection.java +++ b/java/src/IceInternal/Connection.java @@ -182,9 +182,8 @@ public final class Connection extends EventHandler }; public void - prepareRequest(Outgoing out) + prepareRequest(BasicStream os) { - BasicStream os = out.os(); os.writeBlob(_requestHdr); } @@ -246,7 +245,7 @@ public final class Connection extends EventHandler } } - private final static byte[] _batchRequestHdr = + private final static byte[] _requestBatchHdr = { Protocol.protocolVersion, Protocol.encodingVersion, @@ -255,7 +254,7 @@ public final class Connection extends EventHandler }; public void - prepareBatchRequest(Outgoing out) + prepareBatchRequest(BasicStream os) { _mutex.lock(); @@ -267,24 +266,24 @@ public final class Connection extends EventHandler assert(_state < StateClosing); // - // The Connection now belongs to `out', until finishBatchRequest() is - // called. + // The Connection now belongs to the caller, until + // finishBatchRequest() is called. // if(_batchStream.size() == 0) { - _batchStream.writeBlob(_batchRequestHdr); + _batchStream.writeBlob(_requestBatchHdr); } // - // Give the batch stream to `out', until finishBatchRequest() is - // called. + // Give the batch stream to caller, until finishBatchRequest() + // is called. // - _batchStream.swap(out.os()); + _batchStream.swap(os); } public void - finishBatchRequest(Outgoing out) + finishBatchRequest(BasicStream os) { if(_exception != null) { @@ -293,7 +292,7 @@ public final class Connection extends EventHandler } assert(_state < StateClosing); - _batchStream.swap(out.os()); // Get the batch stream back. + _batchStream.swap(os); // Get the batch stream back. _mutex.unlock(); // Give the Connection back. } @@ -570,7 +569,7 @@ public final class Connection extends EventHandler // // Method invocation must be done outside the thread - // synchronization, so that nested callbacks are possible. + // synchronization, so that nested calls are possible. // if(in != null) { diff --git a/java/src/IceInternal/DispatchStatus.java b/java/src/IceInternal/DispatchStatus.java index 385b8fbc492..ef31a51aa1e 100644 --- a/java/src/IceInternal/DispatchStatus.java +++ b/java/src/IceInternal/DispatchStatus.java @@ -23,25 +23,23 @@ public final class DispatchStatus public static final DispatchStatus DispatchOK = new DispatchStatus(_DispatchOK); public static final int _DispatchUserException = 1; public static final DispatchStatus DispatchUserException = new DispatchStatus(_DispatchUserException); - public static final int _DispatchLocationForward = 2; - public static final DispatchStatus DispatchLocationForward = new DispatchStatus(_DispatchLocationForward); - public static final int _DispatchObjectNotExist = 3; + public static final int _DispatchObjectNotExist = 2; public static final DispatchStatus DispatchObjectNotExist = new DispatchStatus(_DispatchObjectNotExist); - public static final int _DispatchFacetNotExist = 4; + public static final int _DispatchFacetNotExist = 3; public static final DispatchStatus DispatchFacetNotExist = new DispatchStatus(_DispatchFacetNotExist); - public static final int _DispatchOperationNotExist = 5; + public static final int _DispatchOperationNotExist = 4; public static final DispatchStatus DispatchOperationNotExist = new DispatchStatus(_DispatchOperationNotExist); - public static final int _DispatchUnknownLocalException = 6; + public static final int _DispatchUnknownLocalException = 5; public static final DispatchStatus DispatchUnknownLocalException = new DispatchStatus(_DispatchUnknownLocalException); - public static final int _DispatchUnknownUserException = 7; + public static final int _DispatchUnknownUserException = 6; public static final DispatchStatus DispatchUnknownUserException = new DispatchStatus(_DispatchUnknownUserException); - public static final int _DispatchUnknownException = 8; + public static final int _DispatchUnknownException = 7; public static final DispatchStatus DispatchUnknownException = new DispatchStatus(_DispatchUnknownException); public static DispatchStatus convert(int val) { - assert val < 9; + assert val < 8; return __values[val]; } diff --git a/java/src/IceInternal/Incoming.java b/java/src/IceInternal/Incoming.java index a5bfd15eaad..9aa3b0b7dd0 100644 --- a/java/src/IceInternal/Incoming.java +++ b/java/src/IceInternal/Incoming.java @@ -173,25 +173,6 @@ public class Incoming } } } - catch(Ice.LocationForward ex) - { - if(locator != null && servant != null) - { - locator.finished(_current, servant, _cookie.value); - } - - _is.endReadEncaps(); - - if(response) - { - _os.endWriteEncaps(); - _os.resize(statusPos, false); - _os.writeByte((byte)DispatchStatus._DispatchLocationForward); - _os.writeProxy(ex._prx); - } - - return; - } catch(Ice.RequestFailedException ex) { if(locator != null && servant != null) diff --git a/java/src/IceInternal/Instance.java b/java/src/IceInternal/Instance.java index bc44f65c7ea..10c0b4bd3e2 100644 --- a/java/src/IceInternal/Instance.java +++ b/java/src/IceInternal/Instance.java @@ -104,7 +104,7 @@ public class Instance { if(_clientThreadPool == null) // Lazy initialization. { - _clientThreadPool = new ThreadPool(this, false, "ClientThreadPool"); + _clientThreadPool = new ThreadPool(this, false, "ThreadPool.Client"); } } @@ -118,7 +118,7 @@ public class Instance { if(_serverThreadPool == null) // Lazy initialization. { - _serverThreadPool = new ThreadPool(this, true, "ServerThreadPool"); + _serverThreadPool = new ThreadPool(this, true, "ThreadPool.Server"); } } diff --git a/java/src/IceInternal/Outgoing.java b/java/src/IceInternal/Outgoing.java index 23b3bee1aa8..e3bb782ce1e 100644 --- a/java/src/IceInternal/Outgoing.java +++ b/java/src/IceInternal/Outgoing.java @@ -57,7 +57,7 @@ public final class Outgoing // Returns true if ok, false if user exception. public boolean invoke() - throws Ice.LocationForward, NonRepeatable + throws NonRepeatable { _os.endWriteEncaps(); @@ -137,12 +137,6 @@ public final class Outgoing return false; } - if(_state == StateLocationForward) - { - Ice.ObjectPrx p = _is.readProxy(); - throw new Ice.LocationForward(p); - } - assert(_state == StateOK); break; } @@ -167,7 +161,7 @@ public final class Outgoing // illegal. // _state = StateInProgress; - _connection.finishBatchRequest(this); + _connection.finishBatchRequest(_os); break; } } @@ -178,6 +172,10 @@ public final class Outgoing public synchronized void finished(BasicStream is) { + // + // The state might be StateLocalException if there was a + // timeout in invoke(). + // if(_state == StateInProgress) { _is.swap(is); @@ -209,12 +207,6 @@ public final class Outgoing break; } - case DispatchStatus._DispatchLocationForward: - { - _state = StateLocationForward; - break; - } - case DispatchStatus._DispatchObjectNotExist: case DispatchStatus._DispatchFacetNotExist: case DispatchStatus._DispatchOperationNotExist: @@ -311,6 +303,10 @@ public final class Outgoing public synchronized void finished(Ice.LocalException ex) { + // + // The state might be StateLocalException if there was a + // timeout in invoke(). + // if(_state == StateInProgress) { _state = StateLocalException; @@ -340,14 +336,14 @@ public final class Outgoing case Reference.ModeOneway: case Reference.ModeDatagram: { - _connection.prepareRequest(this); + _connection.prepareRequest(_os); break; } case Reference.ModeBatchOneway: case Reference.ModeBatchDatagram: { - _connection.prepareBatchRequest(this); + _connection.prepareBatchRequest(_os); break; } } @@ -391,9 +387,8 @@ public final class Outgoing private static final int StateUnsent = 0; private static final int StateInProgress = 1; private static final int StateOK = 2; - private static final int StateLocationForward = 3; - private static final int StateUserException = 4; - private static final int StateLocalException = 5; + private static final int StateUserException = 3; + private static final int StateLocalException = 4; private int _state; private BasicStream _is; diff --git a/java/src/IceInternal/ThreadPool.java b/java/src/IceInternal/ThreadPool.java index fe25053a322..289aa69554a 100644 --- a/java/src/IceInternal/ThreadPool.java +++ b/java/src/IceInternal/ThreadPool.java @@ -187,11 +187,11 @@ public final class ThreadPool { _timeout = _instance.properties().getPropertyAsInt("Ice.ServerIdleTime"); _timeoutMillis = _timeout * 1000; - _threadNum = _instance.properties().getPropertyAsIntWithDefault("Ice.ServerThreadPool.Size", 10); + _threadNum = _instance.properties().getPropertyAsIntWithDefault("Ice.ThreadPool.Server.Size", 10); } else { - _threadNum = _instance.properties().getPropertyAsIntWithDefault("Ice.ClientThreadPool.Size", 1); + _threadNum = _instance.properties().getPropertyAsIntWithDefault("Ice.ThreadPool.Client.Size", 1); } if(_threadNum < 1) diff --git a/java/src/IceInternal/TraceUtil.java b/java/src/IceInternal/TraceUtil.java index e9e8bef8d50..9b7b842fa7c 100644 --- a/java/src/IceInternal/TraceUtil.java +++ b/java/src/IceInternal/TraceUtil.java @@ -117,12 +117,6 @@ final class TraceUtil break; } - case DispatchStatus._DispatchLocationForward: - { - s.write("(location forward)"); - break; - } - case DispatchStatus._DispatchObjectNotExist: case DispatchStatus._DispatchFacetNotExist: case DispatchStatus._DispatchOperationNotExist: |