From ed0a5118faaa72345285ad9f5454cdc725e00d12 Mon Sep 17 00:00:00 2001 From: hzzz Date: Fri, 8 Jun 2018 16:57:15 +0800 Subject: [PATCH] env --- designer-base/src/com/fr/env/SignIn.java | 27 ++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/designer-base/src/com/fr/env/SignIn.java b/designer-base/src/com/fr/env/SignIn.java index 902acdaf19..b76c67853a 100644 --- a/designer-base/src/com/fr/env/SignIn.java +++ b/designer-base/src/com/fr/env/SignIn.java @@ -1,9 +1,15 @@ package com.fr.env; +import com.fr.base.operator.connect.ConnectOperator; +import com.fr.common.rpc.RemoteCallServerConfig; +import com.fr.common.rpc.netty.RemoteCallClient; +import com.fr.common.rpc.serialize.SerializeProtocol; import com.fr.core.env.EnvConfig; import com.fr.core.env.EnvContext; import com.fr.core.env.EnvEvent; +import com.fr.core.env.proxy.EnvMessageSendProxy; +import com.fr.core.env.resource.RemoteEnvConfig; import com.fr.design.mainframe.DesignerContext; import com.fr.design.utils.DesignUtils; import com.fr.event.Event; @@ -12,8 +18,9 @@ import com.fr.event.Listener; import com.fr.event.Null; import com.fr.general.ComparatorUtils; import com.fr.general.Inter; +import com.fr.third.guava.reflect.Reflection; -import javax.swing.*; +import javax.swing.JOptionPane; public class SignIn { @@ -34,10 +41,26 @@ public class SignIn { * @throws Exception 异常 */ public static void signIn(EnvConfig selectedEnv) throws Exception { - + SerializeProtocol serializeProtocol = RemoteCallServerConfig.getInstance().getSerializeProtocol(); + if (EnvContext.currentEnv() != null && !ComparatorUtils.equals(EnvContext.currentEnv(), selectedEnv)) { EnvContext.signOut(); } + if (selectedEnv instanceof RemoteEnvConfig) { + RemoteCallClient.getInstance().load( + ((RemoteEnvConfig) selectedEnv).getHost(), + ((RemoteEnvConfig) selectedEnv).getPort(), + serializeProtocol); + } DesignUtils.switchToEnv(selectedEnv); } + + public static void main(String[] args) { + RemoteCallClient.getInstance().load( + "127.0.0.1", + 39999, + SerializeProtocol.KRYOSERIALIZE); + ConnectOperator connectOperator = Reflection.newProxy(ConnectOperator.class, new EnvMessageSendProxy()); + connectOperator.connect("1", "1"); + } } \ No newline at end of file