summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
authorMarc Laukien <marc@zeroc.com>2004-02-17 18:23:04 +0000
committerMarc Laukien <marc@zeroc.com>2004-02-17 18:23:04 +0000
commited4330c0f7274190b2eff63bfbfe4925a08fa154 (patch)
treee17a0178d1840e7e282bf6e2875c20878433dfdf /java
parentmore AMI and other cleanup (diff)
downloadice-ed4330c0f7274190b2eff63bfbfe4925a08fa154.tar.bz2
ice-ed4330c0f7274190b2eff63bfbfe4925a08fa154.tar.xz
ice-ed4330c0f7274190b2eff63bfbfe4925a08fa154.zip
fix
Diffstat (limited to 'java')
-rw-r--r--java/config/TestUtil.py6
-rw-r--r--java/src/Ice/CommunicatorI.java4
-rw-r--r--java/src/Ice/PropertiesI.java24
-rw-r--r--java/src/Ice/Util.java65
-rw-r--r--java/src/IceInternal/Instance.java7
-rw-r--r--java/test/Ice/faultTolerance/Client.java12
-rw-r--r--java/test/Ice/operations/Client.java14
7 files changed, 61 insertions, 71 deletions
diff --git a/java/config/TestUtil.py b/java/config/TestUtil.py
index deb64be9389..918960c9b6f 100644
--- a/java/config/TestUtil.py
+++ b/java/config/TestUtil.py
@@ -135,11 +135,13 @@ if host != "":
else:
defaultHost = ""
-commonServerOptions = " --Ice.PrintAdapterReady" + \
+commonClientOptions = " --Ice.NullHandleAbort --Ice.Warn.Connections"
+
+commonServerOptions = " --Ice.PrintAdapterReady --Ice.NullHandleAbort" + \
" --Ice.Warn.Connections --Ice.ServerIdleTime=30" + \
" --Ice.ThreadPool.Server.Size=1 --Ice.ThreadPool.Server.SizeMax=10"
-clientOptions = clientProtocol + defaultHost
+clientOptions = clientProtocol + defaultHost + commonClientOptions
serverOptions = serverProtocol + defaultHost + commonServerOptions
clientServerOptions = clientServerProtocol + defaultHost + commonServerOptions
collocatedOptions = clientServerProtocol + defaultHost
diff --git a/java/src/Ice/CommunicatorI.java b/java/src/Ice/CommunicatorI.java
index d4da913b664..ddba3466287 100644
--- a/java/src/Ice/CommunicatorI.java
+++ b/java/src/Ice/CommunicatorI.java
@@ -269,10 +269,10 @@ final class CommunicatorI extends LocalObjectImpl implements Communicator
_instance.flushBatchRequests();
}
- CommunicatorI(StringSeqHolder args, Properties properties)
+ CommunicatorI(Properties properties)
{
_destroyed = false;
- _instance = new IceInternal.Instance(this, args, properties);
+ _instance = new IceInternal.Instance(this, properties);
}
protected void
diff --git a/java/src/Ice/PropertiesI.java b/java/src/Ice/PropertiesI.java
index b2f799ac5c9..d57b5504495 100644
--- a/java/src/Ice/PropertiesI.java
+++ b/java/src/Ice/PropertiesI.java
@@ -230,30 +230,16 @@ final class PropertiesI extends LocalObjectImpl implements Properties
public synchronized Properties
_clone()
{
- PropertiesI p = new PropertiesI(new String[0]);
- p._properties.putAll(_properties);
- return p;
+ return new PropertiesI(this);
}
- PropertiesI()
+ PropertiesI(PropertiesI p)
{
+ _properties.putAll(p._properties);
}
- PropertiesI(String[] args)
+ PropertiesI()
{
- for(int i = 0; i < args.length; i++)
- {
- if(args[i].startsWith("--Ice.Config"))
- {
- String line = args[i];
- if(line.indexOf('=') == -1)
- {
- line += "=1";
- }
- parseLine(line.substring(2));
- }
- }
-
loadConfig();
}
@@ -280,6 +266,8 @@ final class PropertiesI extends LocalObjectImpl implements Properties
}
loadConfig();
+
+ args.value = parseIceCommandLineOptions(args.value);
}
private void
diff --git a/java/src/Ice/Util.java b/java/src/Ice/Util.java
index 590299d1067..e701cca37d5 100644
--- a/java/src/Ice/Util.java
+++ b/java/src/Ice/Util.java
@@ -17,21 +17,30 @@ package Ice;
public final class Util
{
public static Properties
- getDefaultProperties()
+ createProperties()
{
- if(_defaultProperties == null)
- {
- _defaultProperties = createProperties();
- }
- return _defaultProperties;
+ return new PropertiesI();
}
public static Properties
- getDefaultProperties(String[] args)
+ createProperties(StringSeqHolder args)
+ {
+ return new PropertiesI(args);
+ }
+
+ public static Properties
+ createProperties(String[] args)
+ {
+ StringSeqHolder argsH = new StringSeqHolder(args);
+ return createProperties(argsH);
+ }
+
+ public static Properties
+ getDefaultProperties()
{
if(_defaultProperties == null)
{
- _defaultProperties = createProperties(args);
+ _defaultProperties = createProperties();
}
return _defaultProperties;
}
@@ -47,38 +56,30 @@ public final class Util
}
public static Properties
- createProperties()
- {
- return new PropertiesI();
- }
-
- public static Properties
- createProperties(String[] args)
+ getDefaultProperties(String[] args)
{
- return new PropertiesI(args);
+ StringSeqHolder argsH = new StringSeqHolder(args);
+ return getDefaultProperties(argsH);
}
- public static Properties
- createProperties(StringSeqHolder args)
+ public static Communicator
+ initialize(StringSeqHolder args)
{
- return new PropertiesI(args);
+ Properties properties = getDefaultProperties(args);
+ return initializeWithProperties(args, properties);
}
public static Communicator
initialize(String[] args)
{
StringSeqHolder argsH = new StringSeqHolder(args);
- Properties defaultProperties = getDefaultProperties(argsH);
- CommunicatorI result = new CommunicatorI(argsH, defaultProperties);
- result.finishSetup(argsH);
- return result;
+ return initialize(argsH);
}
public static Communicator
- initialize(StringSeqHolder args)
+ initializeWithProperties(StringSeqHolder args, Properties properties)
{
- Properties defaultProperties = getDefaultProperties(args);
- CommunicatorI result = new CommunicatorI(args, defaultProperties);
+ CommunicatorI result = new CommunicatorI(properties);
result.finishSetup(args);
return result;
}
@@ -87,17 +88,7 @@ public final class Util
initializeWithProperties(String[] args, Properties properties)
{
StringSeqHolder argsH = new StringSeqHolder(args);
- CommunicatorI result = new CommunicatorI(argsH, properties);
- result.finishSetup(argsH);
- return result;
- }
-
- public static Communicator
- initializeWithProperties(StringSeqHolder args, Properties properties)
- {
- CommunicatorI result = new CommunicatorI(args, properties);
- result.finishSetup(args);
- return result;
+ return initializeWithProperties(argsH, properties);
}
public static IceInternal.Instance
diff --git a/java/src/IceInternal/Instance.java b/java/src/IceInternal/Instance.java
index 57791047dc5..ba460ff50d2 100644
--- a/java/src/IceInternal/Instance.java
+++ b/java/src/IceInternal/Instance.java
@@ -274,16 +274,11 @@ public class Instance
// Only for use by Ice.CommunicatorI
//
public
- Instance(Ice.Communicator communicator, Ice.StringSeqHolder args, Ice.Properties properties)
+ Instance(Ice.Communicator communicator, Ice.Properties properties)
{
_destroyed = false;
_properties = properties;
- //
- // Convert command-line options to properties.
- //
- args.value = _properties.parseIceCommandLineOptions(args.value);
-
try
{
if(_properties.getPropertyAsInt("Ice.UseSyslog") > 0)
diff --git a/java/test/Ice/faultTolerance/Client.java b/java/test/Ice/faultTolerance/Client.java
index bfa08039476..434d3ed441b 100644
--- a/java/test/Ice/faultTolerance/Client.java
+++ b/java/test/Ice/faultTolerance/Client.java
@@ -75,8 +75,16 @@ public class Client
try
{
- communicator = Ice.Util.initialize(args);
- status = run(args, communicator);
+ Ice.StringSeqHolder argsH = new Ice.StringSeqHolder(args);
+ Ice.Properties properties = Ice.Util.getDefaultProperties(argsH);
+
+ //
+ // This test aborts servers, so we don't want warnings.
+ //
+ properties.setProperty("Ice.Warn.Connections", "0");
+
+ communicator = Ice.Util.initialize(argsH);
+ status = run(argsH.value, communicator);
}
catch(Ice.LocalException ex)
{
diff --git a/java/test/Ice/operations/Client.java b/java/test/Ice/operations/Client.java
index 2afe9118fe6..53ffb0637d6 100644
--- a/java/test/Ice/operations/Client.java
+++ b/java/test/Ice/operations/Client.java
@@ -43,12 +43,18 @@ public class Client
try
{
- Ice.Properties properties = Ice.Util.getDefaultProperties();
- properties.setProperty("Ice.ThreadPool.Client.Size", "2"); // For nested AMI.
+ Ice.StringSeqHolder argsH = new Ice.StringSeqHolder(args);
+ Ice.Properties properties = Ice.Util.getDefaultProperties(argsH);
+
+ //
+ // In this test, we need at least two threads in the
+ // client side thread pool for nested AMI.
+ //
+ properties.setProperty("Ice.ThreadPool.Client.Size", "2");
properties.setProperty("Ice.ThreadPool.Client.SizeWarn", "0");
- communicator = Ice.Util.initialize(args);
- status = run(args, communicator);
+ communicator = Ice.Util.initialize(argsH);
+ status = run(argsH.value, communicator);
}
catch(Ice.LocalException ex)
{