diff options
Diffstat (limited to 'java/src')
-rw-r--r-- | java/src/Ice/ObjectAdapterI.java | 18 | ||||
-rw-r--r-- | java/src/Ice/ObjectPrx.java | 1 | ||||
-rw-r--r-- | java/src/Ice/ObjectPrxHelper.java | 16 | ||||
-rw-r--r-- | java/src/Ice/Util.java | 116 | ||||
-rw-r--r-- | java/src/IceInternal/Connection.java | 2 | ||||
-rw-r--r-- | java/src/IceInternal/Endpoint.java | 13 | ||||
-rw-r--r-- | java/src/IceInternal/Reference.java | 99 | ||||
-rw-r--r-- | java/src/IceInternal/ReferenceFactory.java | 22 | ||||
-rw-r--r-- | java/src/IceInternal/TcpEndpoint.java | 66 | ||||
-rw-r--r-- | java/src/IceInternal/UdpEndpoint.java | 64 | ||||
-rw-r--r-- | java/src/IceInternal/UnknownEndpoint.java | 21 |
11 files changed, 318 insertions, 120 deletions
diff --git a/java/src/Ice/ObjectAdapterI.java b/java/src/Ice/ObjectAdapterI.java index ac363d513ab..ef614f9786d 100644 --- a/java/src/Ice/ObjectAdapterI.java +++ b/java/src/Ice/ObjectAdapterI.java @@ -349,8 +349,8 @@ public final class ObjectAdapterI extends LocalObjectImpl implements ObjectAdapt // IceInternal.Endpoint[] endpoints = new IceInternal.Endpoint[0]; IceInternal.Reference ref = - _instance.referenceFactory().create(ident, new String[0], IceInternal.Reference.ModeTwoway, false, false, - "", endpoints, null, null, this, true); + _instance.referenceFactory().create(ident, new String[0], IceInternal.Reference.ModeTwoway, + false, "", endpoints, null, null, this, true); return _instance.proxyFactory().referenceToProxy(ref); } @@ -662,10 +662,9 @@ public final class ObjectAdapterI extends LocalObjectImpl implements ObjectAdapt // proxy for the reference. // IceInternal.Endpoint[] endpoints = new IceInternal.Endpoint[0]; - IceInternal.Reference reference = _instance.referenceFactory().create(ident, new String[0], - IceInternal.Reference.ModeTwoway, - false, false, _id, - endpoints, null, null, null, true); + IceInternal.Reference reference = + _instance.referenceFactory().create(ident, new String[0], IceInternal.Reference.ModeTwoway, + false, _id, endpoints, null, null, null, true); return _instance.proxyFactory().referenceToProxy(reference); } } @@ -702,10 +701,9 @@ public final class ObjectAdapterI extends LocalObjectImpl implements ObjectAdapt // // Create a reference and return a proxy for this reference. // - IceInternal.Reference reference = _instance.referenceFactory().create(ident, new String[0], - IceInternal.Reference.ModeTwoway, - false, false, "", - endpoints, null, null, null, true); + IceInternal.Reference reference = + _instance.referenceFactory().create(ident, new String[0], IceInternal.Reference.ModeTwoway, + false, "", endpoints, null, null, null, true); return _instance.proxyFactory().referenceToProxy(reference); } diff --git a/java/src/Ice/ObjectPrx.java b/java/src/Ice/ObjectPrx.java index 8219c4564de..ee078f8d940 100644 --- a/java/src/Ice/ObjectPrx.java +++ b/java/src/Ice/ObjectPrx.java @@ -57,6 +57,7 @@ public interface ObjectPrx boolean ice_isBatchDatagram(); ObjectPrx ice_secure(boolean b); + ObjectPrx ice_compress(boolean co); ObjectPrx ice_timeout(int t); ObjectPrx ice_router(Ice.RouterPrx router); ObjectPrx ice_locator(Ice.LocatorPrx locator); diff --git a/java/src/Ice/ObjectPrxHelper.java b/java/src/Ice/ObjectPrxHelper.java index c525bce1dd2..d70efc89cbf 100644 --- a/java/src/Ice/ObjectPrxHelper.java +++ b/java/src/Ice/ObjectPrxHelper.java @@ -411,6 +411,22 @@ public class ObjectPrxHelper implements ObjectPrx } public final ObjectPrx + ice_compress(boolean co) + { + IceInternal.Reference ref = _reference.changeCompress(co); + if(ref.equals(_reference)) + { + return this; + } + else + { + ObjectPrxHelper proxy = new ObjectPrxHelper(); + proxy.setup(ref); + return proxy; + } + } + + public final ObjectPrx ice_timeout(int t) { IceInternal.Reference ref = _reference.changeTimeout(t); diff --git a/java/src/Ice/Util.java b/java/src/Ice/Util.java index d15bf89ba6c..ae40096ebe1 100644 --- a/java/src/Ice/Util.java +++ b/java/src/Ice/Util.java @@ -220,54 +220,84 @@ public final class Util public static int proxyIdentityCompare(ObjectPrx lhs, ObjectPrx rhs) { - Identity lhsIdentity = lhs.ice_getIdentity(); - Identity rhsIdentity = rhs.ice_getIdentity(); - int n; - if((n = lhsIdentity.name.compareTo(rhsIdentity.name)) != 0) - { - return n; - } - return lhsIdentity.category.compareTo(rhsIdentity.category); + if(lhs == null && rhs == null) + { + return 0; + } + else if(lhs == null && rhs != null) + { + return -1; + } + else if(lhs != null && rhs == null) + { + return 1; + } + else + { + Identity lhsIdentity = lhs.ice_getIdentity(); + Identity rhsIdentity = rhs.ice_getIdentity(); + int n; + if((n = lhsIdentity.name.compareTo(rhsIdentity.name)) != 0) + { + return n; + } + return lhsIdentity.category.compareTo(rhsIdentity.category); + } } public static int proxyIdentityAndFacetCompare(ObjectPrx lhs, ObjectPrx rhs) { - Identity lhsIdentity = lhs.ice_getIdentity(); - Identity rhsIdentity = rhs.ice_getIdentity(); - int n; - if((n = lhsIdentity.name.compareTo(rhsIdentity.name)) != 0) - { - return n; - } - if((n = lhsIdentity.category.compareTo(rhsIdentity.category)) != 0) - { - return n; - } - - String[] lhsFacet = lhs.ice_getFacet(); - String[] rhsFacet = rhs.ice_getFacet(); - int i; - for(i = 0; i < lhsFacet.length && i < rhsFacet.length; i++) - { - if((n = lhsFacet[i].compareTo(rhsFacet[i])) != 0) - { - return n; - } - } - - if(lhsFacet.length == rhsFacet.length) - { - return 0; - } - else if(lhsFacet.length < rhsFacet.length) - { - return -1; - } - else - { - return 1; - } + if(lhs == null && rhs == null) + { + return 0; + } + else if(lhs == null && rhs != null) + { + return -1; + } + else if(lhs != null && rhs == null) + { + return 1; + } + else + { + Identity lhsIdentity = lhs.ice_getIdentity(); + Identity rhsIdentity = rhs.ice_getIdentity(); + int n; + if((n = lhsIdentity.name.compareTo(rhsIdentity.name)) != 0) + { + return n; + } + if((n = lhsIdentity.category.compareTo(rhsIdentity.category)) != 0) + { + return n; + } + + String[] lhsFacet = lhs.ice_getFacet(); + String[] rhsFacet = rhs.ice_getFacet(); + int i; + for(i = 0; i < lhsFacet.length && i < rhsFacet.length; i++) + { + if((n = lhsFacet[i].compareTo(rhsFacet[i])) != 0) + { + return n; + } + } + + if(lhsFacet.length == rhsFacet.length) + { + return 0; + } + else if(lhsFacet.length < rhsFacet.length) + { + return -1; + } + else + { + return 1; + } + } } private static Properties _defaultProperties = null; diff --git a/java/src/IceInternal/Connection.java b/java/src/IceInternal/Connection.java index e32bbd72761..80d7259c4d6 100644 --- a/java/src/IceInternal/Connection.java +++ b/java/src/IceInternal/Connection.java @@ -955,7 +955,6 @@ public final class Connection extends EventHandler _adapter = adapter; _logger = instance.logger(); // Chached for better performance. _traceLevels = instance.traceLevels(); // Chached for better performance. - _defaultsAndOverrides = instance.defaultsAndOverrides(); // Chached for better performance. _registeredWithPool = false; _warn = false; _acmTimeout = 0; @@ -1307,7 +1306,6 @@ public final class Connection extends EventHandler private final Ice.Logger _logger; private final TraceLevels _traceLevels; - private final DefaultsAndOverrides _defaultsAndOverrides; private boolean _registeredWithPool; diff --git a/java/src/IceInternal/Endpoint.java b/java/src/IceInternal/Endpoint.java index 828c50771fa..f9ba7dc1f22 100644 --- a/java/src/IceInternal/Endpoint.java +++ b/java/src/IceInternal/Endpoint.java @@ -45,6 +45,19 @@ public interface Endpoint extends java.lang.Comparable Endpoint timeout(int t); // + // Return true if the endpoints support bzip2 compress, or false + // otherwise. + // + boolean compress(); + + // + // Return a new endpoint with a different compression value, + // provided that compression is supported by the + // endpoint. Otherwise the same endpoint is returned. + // + Endpoint compress(boolean co); + + // // Return true if the endpoint is datagram-based. // boolean datagram(); diff --git a/java/src/IceInternal/Reference.java b/java/src/IceInternal/Reference.java index caa6a5259c0..a22530f749a 100644 --- a/java/src/IceInternal/Reference.java +++ b/java/src/IceInternal/Reference.java @@ -69,11 +69,6 @@ public final class Reference return false; } - if(compress != r.compress) - { - return false; - } - if(!adapterId.equals(r.adapterId)) { return false; @@ -136,8 +131,6 @@ public final class Reference s.writeBool(secure); - s.writeBool(compress); - s.writeSize(endpoints.length); if(endpoints.length > 0) @@ -249,11 +242,6 @@ public final class Reference s.append(" -s"); } - if(compress) - { - s.append(" -c"); - } - if(endpoints.length > 0) { assert(adapterId.equals("")); @@ -296,7 +284,6 @@ public final class Reference final public String[] facet; final public int mode; final public boolean secure; - final public boolean compress; final public String adapterId; final public Endpoint[] endpoints; // Actual endpoints, changed by a location forward. final public RouterInfo routerInfo; // Null if no router is used. @@ -318,7 +305,7 @@ public final class Reference } else { - return instance.referenceFactory().create(newIdentity, facet, mode, secure, compress, adapterId, + return instance.referenceFactory().create(newIdentity, facet, mode, secure, adapterId, endpoints, routerInfo, locatorInfo, reverseAdapter, collocationOptimization); } @@ -333,14 +320,14 @@ public final class Reference } else { - return instance.referenceFactory().create(identity, newFacet, mode, secure, compress, adapterId, + return instance.referenceFactory().create(identity, newFacet, mode, secure, adapterId, endpoints, routerInfo, locatorInfo, reverseAdapter, collocationOptimization); } } public Reference - changeTimeout(int timeout) + changeTimeout(int newTimeout) { // // We change the timeout settings in all endpoints. @@ -348,7 +335,7 @@ public final class Reference Endpoint[] newEndpoints = new Endpoint[endpoints.length]; for(int i = 0; i < endpoints.length; i++) { - newEndpoints[i] = endpoints[i].timeout(timeout); + newEndpoints[i] = endpoints[i].timeout(newTimeout); } // @@ -361,8 +348,8 @@ public final class Reference try { Ice.RouterPrx newRouter = - Ice.RouterPrxHelper.uncheckedCast(routerInfo.getRouter().ice_timeout(timeout)); - Ice.ObjectPrx newClientProxy = routerInfo.getClientProxy().ice_timeout(timeout); + Ice.RouterPrxHelper.uncheckedCast(routerInfo.getRouter().ice_timeout(newTimeout)); + Ice.ObjectPrx newClientProxy = routerInfo.getClientProxy().ice_timeout(newTimeout); newRouterInfo = instance.routerManager().get(newRouter); newRouterInfo.setClientProxy(newClientProxy); } @@ -380,11 +367,11 @@ public final class Reference if(locatorInfo != null) { Ice.LocatorPrx newLocator = - Ice.LocatorPrxHelper.uncheckedCast(locatorInfo.getLocator().ice_timeout(timeout)); + Ice.LocatorPrxHelper.uncheckedCast(locatorInfo.getLocator().ice_timeout(newTimeout)); newLocatorInfo = instance.locatorManager().get(newLocator); } - return instance.referenceFactory().create(identity, facet, mode, secure, compress, adapterId, + return instance.referenceFactory().create(identity, facet, mode, secure, adapterId, newEndpoints, newRouterInfo, newLocatorInfo, reverseAdapter, collocationOptimization); } @@ -398,7 +385,7 @@ public final class Reference } else { - return instance.referenceFactory().create(identity, facet, newMode, secure, compress, adapterId, + return instance.referenceFactory().create(identity, facet, newMode, secure, adapterId, endpoints, routerInfo, locatorInfo, reverseAdapter, collocationOptimization); } @@ -413,7 +400,7 @@ public final class Reference } else { - return instance.referenceFactory().create(identity, facet, mode, newSecure, compress, adapterId, + return instance.referenceFactory().create(identity, facet, mode, newSecure, adapterId, endpoints, routerInfo, locatorInfo, reverseAdapter, collocationOptimization); } @@ -422,16 +409,51 @@ public final class Reference public Reference changeCompress(boolean newCompress) { - if(newCompress == compress) + // + // We change the compress settings in all endpoints. + // + Endpoint[] newEndpoints = new Endpoint[endpoints.length]; + for(int i = 0; i < endpoints.length; i++) { - return this; + newEndpoints[i] = endpoints[i].compress(newCompress); } - else + + // + // If we have a router, we also change the compress settings on the + // router and the router's client proxy. + // + RouterInfo newRouterInfo = null; + if(routerInfo != null) { - return instance.referenceFactory().create(identity, facet, mode, secure, newCompress, adapterId, - endpoints, routerInfo, locatorInfo, reverseAdapter, - collocationOptimization); + try + { + Ice.RouterPrx newRouter = + Ice.RouterPrxHelper.uncheckedCast(routerInfo.getRouter().ice_compress(newCompress)); + Ice.ObjectPrx newClientProxy = routerInfo.getClientProxy().ice_compress(newCompress); + newRouterInfo = instance.routerManager().get(newRouter); + newRouterInfo.setClientProxy(newClientProxy); + } + catch(Ice.NoEndpointException ex) + { + // Ignore non-existing client proxies. + } } + + // + // If we have a locator, we also change the compress settings + // on the locator. + // + LocatorInfo newLocatorInfo = null; + if(locatorInfo != null) + { + Ice.LocatorPrx newLocator = + Ice.LocatorPrxHelper.uncheckedCast(locatorInfo.getLocator().ice_compress(newCompress)); + newLocatorInfo = instance.locatorManager().get(newLocator); + } + + return instance.referenceFactory().create(identity, facet, mode, secure, adapterId, + newEndpoints, newRouterInfo, newLocatorInfo, reverseAdapter, + collocationOptimization); } public Reference @@ -443,7 +465,7 @@ public final class Reference } else { - return instance.referenceFactory().create(identity, facet, mode, secure, compress, newAdapterId, + return instance.referenceFactory().create(identity, facet, mode, secure, newAdapterId, endpoints, routerInfo, locatorInfo, reverseAdapter, collocationOptimization); } @@ -458,7 +480,7 @@ public final class Reference } else { - return instance.referenceFactory().create(identity, facet, mode, secure, compress, adapterId, + return instance.referenceFactory().create(identity, facet, mode, secure, adapterId, newEndpoints, routerInfo, locatorInfo, reverseAdapter, collocationOptimization); } @@ -476,7 +498,7 @@ public final class Reference } else { - return instance.referenceFactory().create(identity, facet, mode, secure, compress, adapterId, + return instance.referenceFactory().create(identity, facet, mode, secure, adapterId, endpoints, newRouterInfo, locatorInfo, reverseAdapter, collocationOptimization); } @@ -494,7 +516,7 @@ public final class Reference } else { - return instance.referenceFactory().create(identity, facet, mode, secure, compress, adapterId, + return instance.referenceFactory().create(identity, facet, mode, secure, adapterId, endpoints, routerInfo, newLocatorInfo, reverseAdapter, collocationOptimization); } @@ -509,7 +531,7 @@ public final class Reference } else { - return instance.referenceFactory().create(identity, facet, mode, secure, compress, adapterId, + return instance.referenceFactory().create(identity, facet, mode, secure, adapterId, endpoints, routerInfo, locatorInfo, reverseAdapter, newCollocationOptimization); } @@ -521,9 +543,8 @@ public final class Reference RouterInfo routerInfo = instance.routerManager().get(instance.referenceFactory().getDefaultRouter()); LocatorInfo locatorInfo = instance.locatorManager().get(instance.referenceFactory().getDefaultLocator()); - return instance.referenceFactory().create(identity, new String[0], ModeTwoway, false, false, - adapterId, endpoints, - routerInfo, locatorInfo, null, true); + return instance.referenceFactory().create(identity, new String[0], ModeTwoway, false, adapterId, + endpoints, routerInfo, locatorInfo, null, true); } // @@ -534,7 +555,6 @@ public final class Reference String[] fac, int md, boolean sec, - boolean com, String adptId, Endpoint[] endpts, RouterInfo rtrInfo, @@ -552,7 +572,6 @@ public final class Reference facet = fac; mode = md; secure = sec; - compress = com; adapterId = adptId; endpoints = endpts; routerInfo = rtrInfo; @@ -587,8 +606,6 @@ public final class Reference h = 5 * h + (secure ? 1 : 0); - h = 5 * h + (compress ? 1 : 0); - // // TODO: Should we also take the endpoints into account for hash // calculation? Perhaps not, the code above should be good enough diff --git a/java/src/IceInternal/ReferenceFactory.java b/java/src/IceInternal/ReferenceFactory.java index e0e8346fcf2..08a206029c8 100644 --- a/java/src/IceInternal/ReferenceFactory.java +++ b/java/src/IceInternal/ReferenceFactory.java @@ -21,7 +21,6 @@ public final class ReferenceFactory String[] facet, int mode, boolean secure, - boolean compress, String adapterId, Endpoint[] endpoints, RouterInfo routerInfo, @@ -42,7 +41,7 @@ public final class ReferenceFactory // // Create a new reference // - Reference ref = new Reference(_instance, ident, facet, mode, secure, compress, adapterId, + Reference ref = new Reference(_instance, ident, facet, mode, secure, adapterId, endpoints, routerInfo, locatorInfo, reverseAdapter, collocationOptimization); // @@ -171,7 +170,6 @@ public final class ReferenceFactory java.util.ArrayList facet = new java.util.ArrayList(); int mode = Reference.ModeTwoway; boolean secure = false; - boolean compress = false; String adapter = ""; while(true) @@ -384,18 +382,6 @@ public final class ReferenceFactory break; } - case 'c': - { - if(argument != null) - { - Ice.ProxyParseException e = new Ice.ProxyParseException(); - e.str = s; - throw e; - } - compress = true; - break; - } - default: { Ice.ProxyParseException e = new Ice.ProxyParseException(); @@ -476,7 +462,7 @@ public final class ReferenceFactory RouterInfo routerInfo = _instance.routerManager().get(getDefaultRouter()); LocatorInfo locatorInfo = _instance.locatorManager().get(getDefaultLocator()); - return create(ident, fac, mode, secure, compress, adapter, endp, routerInfo, locatorInfo, null, true); + return create(ident, fac, mode, secure, adapter, endp, routerInfo, locatorInfo, null, true); } public Reference @@ -502,8 +488,6 @@ public final class ReferenceFactory boolean secure = s.readBool(); - boolean compress = s.readBool(); - Endpoint[] endpoints; String adapterId = ""; @@ -524,7 +508,7 @@ public final class ReferenceFactory RouterInfo routerInfo = _instance.routerManager().get(getDefaultRouter()); LocatorInfo locatorInfo = _instance.locatorManager().get(getDefaultLocator()); - return create(ident, facet, mode, secure, compress, adapterId, endpoints, routerInfo, locatorInfo, null, true); + return create(ident, facet, mode, secure, adapterId, endpoints, routerInfo, locatorInfo, null, true); } public synchronized void diff --git a/java/src/IceInternal/TcpEndpoint.java b/java/src/IceInternal/TcpEndpoint.java index 2aaa3f791e9..c61f1d51cf0 100644 --- a/java/src/IceInternal/TcpEndpoint.java +++ b/java/src/IceInternal/TcpEndpoint.java @@ -19,12 +19,13 @@ final class TcpEndpoint implements Endpoint final static short TYPE = 1; public - TcpEndpoint(Instance instance, String ho, int po, int ti) + TcpEndpoint(Instance instance, String ho, int po, int ti, boolean co) { _instance = instance; _host = ho; _port = po; _timeout = ti; + _compress = co; calcHashValue(); } @@ -35,6 +36,7 @@ final class TcpEndpoint implements Endpoint _host = null; _port = 0; _timeout = -1; + _compress = false; String[] arr = str.split("[ \t\n\r]+"); @@ -122,6 +124,19 @@ final class TcpEndpoint implements Endpoint break; } + case 'z': + { + if(argument != null) + { + Ice.EndpointParseException e = new Ice.EndpointParseException(); + e.str = "tcp " + str; + throw e; + } + + _compress = true; + break; + } + default: { Ice.EndpointParseException e = new Ice.EndpointParseException(); @@ -147,6 +162,7 @@ final class TcpEndpoint implements Endpoint _host = s.readString(); _port = s.readInt(); _timeout = s.readInt(); + _compress = s.readBool(); s.endReadEncaps(); calcHashValue(); } @@ -162,6 +178,7 @@ final class TcpEndpoint implements Endpoint s.writeString(_host); s.writeInt(_port); s.writeInt(_timeout); + s.writeBool(_compress); s.endWriteEncaps(); } @@ -176,6 +193,10 @@ final class TcpEndpoint implements Endpoint { s += " -t " + _timeout; } + if(_compress) + { + s += " -z"; + } return s; } @@ -212,7 +233,35 @@ final class TcpEndpoint implements Endpoint } else { - return new TcpEndpoint(_instance, _host, _port, timeout); + return new TcpEndpoint(_instance, _host, _port, timeout, _compress); + } + } + + // + // Return true if the endpoints support bzip2 compress, or false + // otherwise. + // + public boolean + compress() + { + return _compress; + } + + // + // Return a new endpoint with a different compression value, + // provided that compression is supported by the + // endpoint. Otherwise the same endpoint is returned. + // + public Endpoint + compress(boolean compress) + { + if(compress == _compress) + { + return this; + } + else + { + return new TcpEndpoint(_instance, _host, _port, _timeout, compress); } } @@ -288,7 +337,7 @@ final class TcpEndpoint implements Endpoint acceptor(EndpointHolder endpoint) { TcpAcceptor p = new TcpAcceptor(_instance, _host, _port); - endpoint.value = new TcpEndpoint(_instance, _host, p.effectivePort(), _timeout); + endpoint.value = new TcpEndpoint(_instance, _host, p.effectivePort(), _timeout, _compress); return p; } @@ -369,6 +418,15 @@ final class TcpEndpoint implements Endpoint return 1; } + if(!_compress && p._compress) + { + return -1; + } + else if(!p._compress && _compress) + { + return 1; + } + if(!_host.equals(p._host)) { // @@ -403,11 +461,13 @@ final class TcpEndpoint implements Endpoint _hashCode = _host.hashCode(); _hashCode = 5 * _hashCode + _port; _hashCode = 5 * _hashCode + _timeout; + _hashCode = 5 * _hashCode + (_compress ? 1 : 0); } private Instance _instance; private String _host; private int _port; private int _timeout; + private boolean _compress; private int _hashCode; } diff --git a/java/src/IceInternal/UdpEndpoint.java b/java/src/IceInternal/UdpEndpoint.java index 31c6b0a342a..6e6ec7bb8a2 100644 --- a/java/src/IceInternal/UdpEndpoint.java +++ b/java/src/IceInternal/UdpEndpoint.java @@ -19,12 +19,13 @@ final class UdpEndpoint implements Endpoint final static short TYPE = 3; public - UdpEndpoint(Instance instance, String ho, int po) + UdpEndpoint(Instance instance, String ho, int po, boolean co) { _instance = instance; _host = ho; _port = po; _connect = false; + _compress = co; calcHashValue(); } @@ -35,6 +36,7 @@ final class UdpEndpoint implements Endpoint _host = null; _port = 0; _connect = false; + _compress = false; String[] arr = str.split("[ \t\n\r]+"); @@ -112,6 +114,19 @@ final class UdpEndpoint implements Endpoint break; } + case 'z': + { + if(argument != null) + { + Ice.EndpointParseException e = new Ice.EndpointParseException(); + e.str = "udp " + str; + throw e; + } + + _compress = true; + break; + } + default: { Ice.EndpointParseException e = new Ice.EndpointParseException(); @@ -139,6 +154,7 @@ final class UdpEndpoint implements Endpoint // Not transmitted. //_connect = s.readBool(); _connect = false; + _compress = s.readBool(); s.endReadEncaps(); calcHashValue(); } @@ -155,6 +171,7 @@ final class UdpEndpoint implements Endpoint s.writeInt(_port); // Not transmitted. //s.writeBool(_connect); + s.writeBool(_compress); s.endWriteEncaps(); } @@ -169,6 +186,10 @@ final class UdpEndpoint implements Endpoint { s += " -c"; } + if(_compress) + { + s += " -z"; + } return s; } @@ -192,6 +213,34 @@ final class UdpEndpoint implements Endpoint } // + // Return true if the endpoints support bzip2 compress, or false + // otherwise. + // + public boolean + compress() + { + return _compress; + } + + // + // Return a new endpoint with a different compression value, + // provided that compression is supported by the + // endpoint. Otherwise the same endpoint is returned. + // + public Endpoint + compress(boolean compress) + { + if(compress == _compress) + { + return this; + } + else + { + return new UdpEndpoint(_instance, _host, _port, compress); + } + } + + // // Return a new endpoint with a different timeout value, provided // that timeouts are supported by the endpoint. Otherwise the same // endpoint is returned. @@ -250,7 +299,7 @@ final class UdpEndpoint implements Endpoint serverTransceiver(EndpointHolder endpoint) { UdpTransceiver p = new UdpTransceiver(_instance, _host, _port, _connect); - endpoint.value = new UdpEndpoint(_instance, _host, p.effectivePort()); + endpoint.value = new UdpEndpoint(_instance, _host, p.effectivePort(), _compress); return p; } @@ -355,6 +404,15 @@ final class UdpEndpoint implements Endpoint return 1; } + if(!_compress && p._compress) + { + return -1; + } + else if(!p._compress && _compress) + { + return 1; + } + if(!_host.equals(p._host)) { // @@ -389,11 +447,13 @@ final class UdpEndpoint implements Endpoint _hashCode = _host.hashCode(); _hashCode = 5 * _hashCode + _port; _hashCode = 5 * _hashCode + (_connect ? 1 : 0); + _hashCode = 5 * _hashCode + (_compress ? 1 : 0); } private Instance _instance; private String _host; private int _port; private boolean _connect; + private boolean _compress; private int _hashCode; } diff --git a/java/src/IceInternal/UnknownEndpoint.java b/java/src/IceInternal/UnknownEndpoint.java index 9684fa14446..a7d5e00a03c 100644 --- a/java/src/IceInternal/UnknownEndpoint.java +++ b/java/src/IceInternal/UnknownEndpoint.java @@ -80,6 +80,27 @@ final class UnknownEndpoint implements Endpoint } // + // Return true if the endpoints support bzip2 compress, or false + // otherwise. + // + public boolean + compress() + { + return false; + } + + // + // Return a new endpoint with a different compression value, + // provided that compression is supported by the + // endpoint. Otherwise the same endpoint is returned. + // + public Endpoint + compress(boolean compress) + { + return this; + } + + // // Return true if the endpoint is datagram-based. // public boolean |