summaryrefslogtreecommitdiff
path: root/java/src
diff options
context:
space:
mode:
authorMarc Laukien <marc@zeroc.com>2002-05-07 22:04:22 +0000
committerMarc Laukien <marc@zeroc.com>2002-05-07 22:04:22 +0000
commit13e9139863f8f14722cf4c1ac8fb973af2a55a58 (patch)
tree5665fbb849e08f635fc6afc1ab0588c7ee473302 /java/src
parentbug fix (diff)
downloadice-13e9139863f8f14722cf4c1ac8fb973af2a55a58.tar.bz2
ice-13e9139863f8f14722cf4c1ac8fb973af2a55a58.tar.xz
ice-13e9139863f8f14722cf4c1ac8fb973af2a55a58.zip
initial compression
Diffstat (limited to 'java/src')
-rw-r--r--java/src/Ice/ObjectAdapterI.java5
-rw-r--r--java/src/Ice/ObjectPrxHelper.java2
-rw-r--r--java/src/IceInternal/Connection.java10
-rw-r--r--java/src/IceInternal/Protocol.java3
-rw-r--r--java/src/IceInternal/Reference.java77
-rw-r--r--java/src/IceInternal/ReferenceFactory.java31
6 files changed, 89 insertions, 39 deletions
diff --git a/java/src/Ice/ObjectAdapterI.java b/java/src/Ice/ObjectAdapterI.java
index 708ff795de1..de5fec4c5fc 100644
--- a/java/src/Ice/ObjectAdapterI.java
+++ b/java/src/Ice/ObjectAdapterI.java
@@ -227,7 +227,7 @@ public class ObjectAdapterI implements ObjectAdapter
//
IceInternal.Endpoint[] endpoints = new IceInternal.Endpoint[0];
IceInternal.Reference ref =
- _instance.referenceFactory().create(ident, "", IceInternal.Reference.ModeTwoway, false, endpoints,
+ _instance.referenceFactory().create(ident, "", IceInternal.Reference.ModeTwoway, false, false, endpoints,
endpoints, null, this);
return _instance.proxyFactory().referenceToProxy(ref);
@@ -418,7 +418,8 @@ public class ObjectAdapterI implements ObjectAdapter
// Create a reference and return a proxy for this reference.
//
IceInternal.Reference reference = _instance.referenceFactory().create(ident, "",
- IceInternal.Reference.ModeTwoway, false,
+ IceInternal.Reference.ModeTwoway,
+ false, false,
endpoints, endpoints, null, null);
return _instance.proxyFactory().referenceToProxy(reference);
}
diff --git a/java/src/Ice/ObjectPrxHelper.java b/java/src/Ice/ObjectPrxHelper.java
index 95f5d408408..8f0e853f32f 100644
--- a/java/src/Ice/ObjectPrxHelper.java
+++ b/java/src/Ice/ObjectPrxHelper.java
@@ -554,7 +554,7 @@ public class ObjectPrxHelper implements ObjectPrx
ObjectPrxHelper h = (ObjectPrxHelper)ex._prx;
if (!_reference.identity.equals(h.__reference().identity))
{
- throw new ReferenceIdentityException();
+ throw new LocationForwardIdentityException();
}
_reference = _reference.changeEndpoints(h.__reference().endpoints);
diff --git a/java/src/IceInternal/Connection.java b/java/src/IceInternal/Connection.java
index e6cd256ded7..ce5f649f484 100644
--- a/java/src/IceInternal/Connection.java
+++ b/java/src/IceInternal/Connection.java
@@ -387,6 +387,13 @@ public final class Connection extends EventHandler
switch (messageType)
{
+ case Protocol.compressedRequestMsg:
+ case Protocol.compressedRequestBatchMsg:
+ case Protocol.compressedReplyMsg:
+ {
+ throw new Ice.CompressionNotSupportedException();
+ }
+
case Protocol.requestMsg:
{
if (_state == StateClosing)
@@ -766,8 +773,7 @@ public final class Connection extends EventHandler
if (!(ex instanceof Ice.CloseConnectionException ||
ex instanceof Ice.CommunicatorDestroyedException ||
ex instanceof Ice.ObjectAdapterDeactivatedException ||
- (ex instanceof Ice.ConnectionLostException &&
- _state == StateClosing)))
+ (ex instanceof Ice.ConnectionLostException && _state == StateClosing)))
{
warning("connection exception", ex);
}
diff --git a/java/src/IceInternal/Protocol.java b/java/src/IceInternal/Protocol.java
index 4b326fef4fc..1b34b22840c 100644
--- a/java/src/IceInternal/Protocol.java
+++ b/java/src/IceInternal/Protocol.java
@@ -35,4 +35,7 @@ final class Protocol
final static byte requestBatchMsg = 1;
final static byte replyMsg = 2;
final static byte closeConnectionMsg = 3;
+ final static byte compressedRequestMsg = 4;
+ final static byte compressedRequestBatchMsg = 5;
+ final static byte compressedReplyMsg = 6;
}
diff --git a/java/src/IceInternal/Reference.java b/java/src/IceInternal/Reference.java
index 7af1c4653c8..763447e19a8 100644
--- a/java/src/IceInternal/Reference.java
+++ b/java/src/IceInternal/Reference.java
@@ -65,6 +65,11 @@ public final class Reference
return false;
}
+ if (compress != r.compress)
+ {
+ return false;
+ }
+
if (!compare(origEndpoints, r.origEndpoints))
{
return false;
@@ -111,6 +116,8 @@ public final class Reference
s.writeBool(secure);
+ s.writeBool(compress);
+
s.writeSize(origEndpoints.length);
for (int i = 0; i < origEndpoints.length; i++)
{
@@ -185,6 +192,11 @@ public final class Reference
s.append(" -s");
}
+ if (compress)
+ {
+ s.append(" -c");
+ }
+
for (int i = 0; i < origEndpoints.length; i++)
{
s.append(':');
@@ -207,16 +219,17 @@ public final class Reference
//
// All members are treated as const, because References are immutable.
//
- public Instance instance;
- public Ice.Identity identity;
- public String facet;
- public int mode;
- public boolean secure;
- public Endpoint[] origEndpoints; // Original endpoints.
- public Endpoint[] endpoints; // Actual endpoints, changed by a location forward.
- public RouterInfo routerInfo; // Null if no router is used.
- public Ice.ObjectAdapter reverseAdapter; // For reverse communications using the adapter's incoming connections.
- public int hashValue;
+ final public Instance instance;
+ final public Ice.Identity identity;
+ final public String facet;
+ final public int mode;
+ final public boolean secure;
+ final public boolean compress;
+ final public Endpoint[] origEndpoints; // Original endpoints.
+ final public Endpoint[] endpoints; // Actual endpoints, changed by a location forward.
+ final public RouterInfo routerInfo; // Null if no router is used.
+ final public Ice.ObjectAdapter reverseAdapter; // For reverse comm. using the adapter's incoming connections.
+ final public int hashValue;
//
// Get a new reference, based on the existing one, overwriting
@@ -231,7 +244,7 @@ public final class Reference
}
else
{
- return instance.referenceFactory().create(newIdentity, facet, mode, secure,
+ return instance.referenceFactory().create(newIdentity, facet, mode, secure, compress,
origEndpoints, endpoints,
routerInfo, reverseAdapter);
}
@@ -246,7 +259,7 @@ public final class Reference
}
else
{
- return instance.referenceFactory().create(identity, newFacet, mode, secure,
+ return instance.referenceFactory().create(identity, newFacet, mode, secure, compress,
origEndpoints, endpoints,
routerInfo, reverseAdapter);
}
@@ -291,7 +304,7 @@ public final class Reference
}
}
- return instance.referenceFactory().create(identity, facet, mode, secure,
+ return instance.referenceFactory().create(identity, facet, mode, secure, compress,
newOrigEndpoints, newEndpoints,
newRouterInfo, reverseAdapter);
}
@@ -305,7 +318,7 @@ public final class Reference
}
else
{
- return instance.referenceFactory().create(identity, facet, newMode, secure,
+ return instance.referenceFactory().create(identity, facet, newMode, secure, compress,
origEndpoints, endpoints,
routerInfo, reverseAdapter);
}
@@ -320,7 +333,22 @@ public final class Reference
}
else
{
- return instance.referenceFactory().create(identity, facet, mode, newSecure,
+ return instance.referenceFactory().create(identity, facet, mode, newSecure, compress,
+ origEndpoints, endpoints,
+ routerInfo, reverseAdapter);
+ }
+ }
+
+ public Reference
+ changeCompress(boolean newCompress)
+ {
+ if (newCompress == compress)
+ {
+ return this;
+ }
+ else
+ {
+ return instance.referenceFactory().create(identity, facet, mode, secure, newCompress,
origEndpoints, endpoints,
routerInfo, reverseAdapter);
}
@@ -335,7 +363,7 @@ public final class Reference
}
else
{
- return instance.referenceFactory().create(identity, facet, mode, secure,
+ return instance.referenceFactory().create(identity, facet, mode, secure, compress,
origEndpoints, newEndpoints,
routerInfo, reverseAdapter);
}
@@ -353,7 +381,7 @@ public final class Reference
}
else
{
- return instance.referenceFactory().create(identity, facet, mode, secure,
+ return instance.referenceFactory().create(identity, facet, mode, secure, compress,
origEndpoints, endpoints,
newRouterInfo, reverseAdapter);
}
@@ -362,7 +390,7 @@ public final class Reference
public Reference
changeDefault()
{
- return instance.referenceFactory().create(identity, "", ModeTwoway, false,
+ return instance.referenceFactory().create(identity, "", ModeTwoway, false, false,
origEndpoints, origEndpoints,
null, null);
}
@@ -375,6 +403,7 @@ public final class Reference
String fac,
int md,
boolean sec,
+ boolean com,
Endpoint[] origEndpts,
Endpoint[] endpts,
RouterInfo rtrInfo,
@@ -385,18 +414,12 @@ public final class Reference
facet = fac;
mode = md;
secure = sec;
+ compress = com;
origEndpoints = origEndpts;
endpoints = endpts;
routerInfo = rtrInfo;
reverseAdapter = rvAdapter;
- hashValue = 0;
-
- calcHashValue();
- }
- private void
- calcHashValue()
- {
int h = 0;
int sz = identity.name.length();
@@ -421,13 +444,15 @@ 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
// for a good hash value.
//
- hashValue = h;
+ hashValue = h;
}
//
diff --git a/java/src/IceInternal/ReferenceFactory.java b/java/src/IceInternal/ReferenceFactory.java
index ddf84364c79..876bd466a97 100644
--- a/java/src/IceInternal/ReferenceFactory.java
+++ b/java/src/IceInternal/ReferenceFactory.java
@@ -17,6 +17,7 @@ public final class ReferenceFactory
String facet,
int mode,
boolean secure,
+ boolean compress,
Endpoint[] origEndpoints,
Endpoint[] endpoints,
RouterInfo routerInfo,
@@ -30,7 +31,7 @@ public final class ReferenceFactory
//
// Create a new reference
//
- Reference ref = new Reference(_instance, ident, facet, mode, secure,
+ Reference ref = new Reference(_instance, ident, facet, mode, secure, compress,
origEndpoints, endpoints,
routerInfo, reverseAdapter);
@@ -72,7 +73,7 @@ public final class ReferenceFactory
String s = str.trim();
if (s.length() == 0)
{
- throw new Ice.ReferenceParseException();
+ throw new Ice.ProxyParseException();
}
int colon = s.indexOf(':');
@@ -91,6 +92,7 @@ public final class ReferenceFactory
String facet = "";
int mode = Reference.ModeTwoway;
boolean secure = false;
+ boolean compress = false;
int i = 1;
while (i < arr.length)
@@ -98,7 +100,7 @@ public final class ReferenceFactory
String option = arr[i++];
if (option.length() != 2 || option.charAt(0) != '-')
{
- throw new Ice.ReferenceParseException();
+ throw new Ice.ProxyParseException();
}
String argument = null;
@@ -190,9 +192,20 @@ public final class ReferenceFactory
break;
}
+ case 'c':
+ {
+ if (argument != null)
+ {
+ throw new Ice.EndpointParseException();
+ }
+
+ compress = true;
+ break;
+ }
+
default:
{
- throw new Ice.ReferenceParseException();
+ throw new Ice.ProxyParseException();
}
}
}
@@ -217,7 +230,7 @@ public final class ReferenceFactory
{
if (!orig)
{
- throw new Ice.ReferenceParseException();
+ throw new Ice.ProxyParseException();
}
orig = false;
@@ -244,7 +257,7 @@ public final class ReferenceFactory
if (origEndpoints.size() == 0 || endpoints.size() == 0)
{
- throw new Ice.ReferenceParseException();
+ throw new Ice.ProxyParseException();
}
Endpoint[] origEndp = new Endpoint[origEndpoints.size()];
@@ -253,7 +266,7 @@ public final class ReferenceFactory
endpoints.toArray(endp);
RouterInfo routerInfo = _instance.routerManager().get(getDefaultRouter());
- return create(ident, facet, mode, secure, origEndp, endp, routerInfo, null);
+ return create(ident, facet, mode, secure, compress, origEndp, endp, routerInfo, null);
}
public Reference
@@ -274,6 +287,8 @@ public final class ReferenceFactory
boolean secure = s.readBool();
+ boolean compress = s.readBool();
+
Endpoint[] origEndpoints;
Endpoint[] endpoints;
@@ -300,7 +315,7 @@ public final class ReferenceFactory
}
RouterInfo routerInfo = _instance.routerManager().get(getDefaultRouter());
- return create(ident, facet, mode, secure, origEndpoints, endpoints, routerInfo, null);
+ return create(ident, facet, mode, secure, compress, origEndpoints, endpoints, routerInfo, null);
}
public synchronized void