summaryrefslogtreecommitdiff
path: root/java/src/IceInternal/Instance.java
diff options
context:
space:
mode:
authorMark Spruiell <mes@zeroc.com>2002-01-29 06:49:10 +0000
committerMark Spruiell <mes@zeroc.com>2002-01-29 06:49:10 +0000
commit0001dc614d21380fb22a22566a44e6d2eae88542 (patch)
treec2a50cf5bd26da7ce3844146473989ebac902515 /java/src/IceInternal/Instance.java
parentadding server (diff)
downloadice-0001dc614d21380fb22a22566a44e6d2eae88542.tar.bz2
ice-0001dc614d21380fb22a22566a44e6d2eae88542.tar.xz
ice-0001dc614d21380fb22a22566a44e6d2eae88542.zip
align with stable_31
Diffstat (limited to 'java/src/IceInternal/Instance.java')
-rw-r--r--java/src/IceInternal/Instance.java133
1 files changed, 85 insertions, 48 deletions
diff --git a/java/src/IceInternal/Instance.java b/java/src/IceInternal/Instance.java
index b63a1451af7..cfad5195615 100644
--- a/java/src/IceInternal/Instance.java
+++ b/java/src/IceInternal/Instance.java
@@ -42,6 +42,32 @@ public class Instance
return _traceLevels;
}
+ public String
+ defaultProtocol()
+ {
+ // No synchronization necessary
+ return _defaultProtocol;
+ }
+
+ public String
+ defaultHost()
+ {
+ // No synchronization necessary
+ return _defaultHost;
+ }
+
+ public synchronized RouterManager
+ routerManager()
+ {
+ return _routerManager;
+ }
+
+ public synchronized ReferenceFactory
+ referenceFactory()
+ {
+ return _referenceFactory;
+ }
+
public synchronized ProxyFactory
proxyFactory()
{
@@ -78,20 +104,6 @@ public class Instance
return _threadPool;
}
- public String
- defaultProtocol()
- {
- // No synchronization necessary
- return _defaultProtocol;
- }
-
- public String
- defaultHost()
- {
- // No synchronization necessary
- return _defaultHost;
- }
-
//
// TODO: This should be synchronized, but it causes a deadlock
// on shutdown if a BasicStream is created while the Instance
@@ -116,12 +128,6 @@ public class Instance
{
_logger = new Ice.LoggerI();
_traceLevels = new TraceLevels(_properties);
- _proxyFactory = new ProxyFactory(this);
- _outgoingConnectionFactory = new OutgoingConnectionFactory(this);
- _servantFactoryManager = new ObjectFactoryManager();
- _userExceptionFactoryManager = new UserExceptionFactoryManager();
- _objectAdapterFactory = new ObjectAdapterFactory(this);
- _threadPool = new ThreadPool(this);
_defaultProtocol = _properties.getProperty("Ice.DefaultProtocol");
if (_defaultProtocol == null)
{
@@ -132,6 +138,21 @@ public class Instance
{
_defaultHost = Network.getLocalHost(true);
}
+ _routerManager = new RouterManager();
+ _referenceFactory = new ReferenceFactory(this);
+ _proxyFactory = new ProxyFactory(this);
+ String value = _properties.getProperty("Ice.DefaultRouter");
+ if (value != null)
+ {
+ _referenceFactory.setDefaultRouter(
+ Ice.RouterPrxHelper.uncheckedCast(
+ _proxyFactory.stringToProxy(value)));
+ }
+ _outgoingConnectionFactory = new OutgoingConnectionFactory(this);
+ _servantFactoryManager = new ObjectFactoryManager();
+ _userExceptionFactoryManager = new UserExceptionFactoryManager();
+ _objectAdapterFactory = new ObjectAdapterFactory(this);
+ _threadPool = new ThreadPool(this);
_bufferManager = new BufferManager();
}
catch (Ice.LocalException ex)
@@ -149,6 +170,8 @@ public class Instance
assert(_properties == null);
assert(_logger == null);
assert(_traceLevels == null);
+ assert(_routerManager == null);
+ assert(_referenceFactory == null);
assert(_proxyFactory == null);
assert(_outgoingConnectionFactory == null);
assert(_servantFactoryManager == null);
@@ -173,28 +196,33 @@ public class Instance
if (_communicator != null)
{
// Don't destroy the communicator -- the communicator destroys
- // this object, not the other way
+ // this object, not the other way.
_communicator = null;
}
- if (_properties != null)
+ if (_objectAdapterFactory != null)
{
- // No destroy function defined
- // _properties.destroy();
- _properties = null;
+ _objectAdapterFactory.shutdown(); // ObjectAdapterFactory has
+ // shutdown(), not destroy()
+ _objectAdapterFactory = null;
}
- if (_logger != null)
+ if (_servantFactoryManager != null)
{
- _logger.destroy();
- _logger = null;
+ _servantFactoryManager.destroy();
+ _servantFactoryManager = null;
}
- if (_traceLevels != null)
+ if (_userExceptionFactoryManager != null)
{
- // No destroy function defined
- // _traceLevels.destroy();
- _traceLevels = null;
+ _userExceptionFactoryManager.destroy();
+ _userExceptionFactoryManager = null;
+ }
+
+ if (_referenceFactory != null)
+ {
+ _referenceFactory.destroy();
+ _referenceFactory = null;
}
if (_proxyFactory != null)
@@ -210,23 +238,10 @@ public class Instance
_outgoingConnectionFactory = null;
}
- if (_servantFactoryManager != null)
- {
- _servantFactoryManager.destroy();
- _servantFactoryManager = null;
- }
-
- if (_userExceptionFactoryManager != null)
- {
- _userExceptionFactoryManager.destroy();
- _userExceptionFactoryManager = null;
- }
-
- if (_objectAdapterFactory != null)
+ if (_routerManager != null)
{
- _objectAdapterFactory.shutdown(); // ObjectAdapterFactory has
- // shutdown(), not destroy()
- _objectAdapterFactory = null;
+ _routerManager.destroy();
+ _routerManager = null;
}
if (_threadPool != null)
@@ -237,6 +252,26 @@ public class Instance
_threadPool = null;
}
+ if (_properties != null)
+ {
+ // No destroy function defined
+ // _properties.destroy();
+ _properties = null;
+ }
+
+ if (_logger != null)
+ {
+ _logger.destroy();
+ _logger = null;
+ }
+
+ if (_traceLevels != null)
+ {
+ // No destroy function defined
+ // _traceLevels.destroy();
+ _traceLevels = null;
+ }
+
if (_bufferManager != null)
{
_bufferManager.destroy();
@@ -248,6 +283,8 @@ public class Instance
private Ice.Properties _properties;
private Ice.Logger _logger;
private TraceLevels _traceLevels;
+ private RouterManager _routerManager;
+ private ReferenceFactory _referenceFactory;
private ProxyFactory _proxyFactory;
private OutgoingConnectionFactory _outgoingConnectionFactory;
private ObjectFactoryManager _servantFactoryManager;