summaryrefslogtreecommitdiff
path: root/java/src/Glacier2/SessionHelper.java
diff options
context:
space:
mode:
Diffstat (limited to 'java/src/Glacier2/SessionHelper.java')
-rw-r--r--java/src/Glacier2/SessionHelper.java60
1 files changed, 60 insertions, 0 deletions
diff --git a/java/src/Glacier2/SessionHelper.java b/java/src/Glacier2/SessionHelper.java
index 2ea89487044..49709b47a8d 100644
--- a/java/src/Glacier2/SessionHelper.java
+++ b/java/src/Glacier2/SessionHelper.java
@@ -501,6 +501,66 @@ public class SessionHelper
return;
}
+ if(_communicator.getDefaultRouter() != null)
+ {
+ completeConnect(factory);
+ }
+ else
+ {
+ Ice.RouterFinderPrx finder = Ice.RouterFinderPrxHelper.uncheckedCast(
+ _communicator.stringToProxy(_communicator.getProperties().getProperty("SessionHelper.RouterFinder")));
+ finder.begin_getRouter(new Ice.Callback()
+ {
+ @Override
+ public void completed(Ice.AsyncResult result)
+ {
+ try
+ {
+ Ice.RouterPrx router =
+ Ice.RouterFinderPrxHelper.uncheckedCast(
+ result.getProxy()).end_getRouter(result);
+ _communicator.setDefaultRouter(router);
+ }
+ catch(final Ice.Exception ex)
+ {
+ Ice.Communicator communicator = null;
+ synchronized(SessionHelper.this)
+ {
+ communicator = _communicator;
+ _communicator = null;
+ }
+
+ if(communicator != null)
+ {
+ try
+ {
+ communicator.destroy();
+ }
+ catch(Throwable ex1)
+ {
+ }
+ }
+
+ dispatchCallback(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ _callback.connectFailed(SessionHelper.this, ex);
+ }
+ }, null);
+ return;
+ }
+
+ completeConnect(factory);
+ }
+ });
+ }
+ }
+
+ private void
+ completeConnect(final ConnectStrategy factory)
+ {
new Thread(new Runnable()
{
@Override