private void InitAction()
 {
     ProtocolServer.RegistProtocol(Sr.ProtocolPhone.LxRtu.wst_rtu_user_oc_info,
                                   //.wlst_svr_ans_cnt_request_snd_rtu_time,
                                   //.ClientPart.wlst_asyntime_server_ans_clinet_order_sendweeksetk1k3,
                                   ResponseUserOcInfo, typeof(UserOcInfoViewModel), this);
 }
 public void InitAction()
 {
     ProtocolServer.RegistProtocol(
         Wlst.Sr.ProtocolPhone.LxSpe.wlst_spe_zc_sim,
         UpdateSimAck,
         typeof(SimManageViewModel), this);
 }
Esempio n. 3
0
 private void InitAction()
 {
     ProtocolServer.RegistProtocol(
         Wlst.Sr.ProtocolPhone.LxSpe.wlst_request_or_update_group_class_info,       //ProtocolCnt.ClientPart.wlst_RecordEvent_server_ans_clinet_request_data,
         Request,
         typeof(TreeTabRtuSetvM), this, true);
 }
 private void InitAction()
 {
     ProtocolServer.RegistProtocol(
         Wlst.Sr.ProtocolPhone.LxRtu.wst_ldl_sxx_avg_set,// .wlst_svr_ans_cnt_wj3090_request_ldl_loop_current_avg,//.ClientPart.wlst_Measures_server_ans_clinet_rqup_loop_sxx,
         RequestOrUpdateFaultTypeInfo,
         typeof(RapidSetRtuAmp), this, true);
 }
Esempio n. 5
0
        /// <summary>
        /// Constructs a Protocol object.
        /// </summary>
        /// <param name="treeView">TreeViewEx object which holds the contact list for the application</param>
        /// <param name="taskbarNotify">TaskbarNotify object which pops up on certain events</param>
        /// <param name="fileName">Filename of the plugin assembly</param>
        /// <param name="mainStorage">IStorage instance where the application's settings are stored</param>
        public Protocol(TreeViewEx treeView, TaskbarNotifier taskbarNotify, string fileName,
                        IStorage mainStorage)
        {
            this.treeView      = treeView;
            this.taskbarNotify = taskbarNotify;

            this.classFactory = new ClassFactory(fileName);

            // create plugin constants class
            IConstants constants = classFactory.CreateConstants();

            this.localStorage = mainStorage.CreateSubSection(constants.Name);

            // create registry key for this protocol to store the settings
            this.settings = classFactory.CreateSettings(constants, this.localStorage, this.optionsList);
            this.settings.Load();

            // create protocol control and register this class to be an event listener
            this.protocolServer = new ProtocolServer();
            this.protocolServer.AddListener(this);

            this.protocolControl = new ProtocolControl(this.protocolServer);

            this.reporter = new NBM.Diagnostics.ProtocolReporter(this);
        }
 private void InitAction()
 {
     ProtocolServer.RegistProtocol(
         Wlst.Sr.ProtocolPhone.LxFault.wlst_user_define_fault_alarms,     //.ProtocolCnt.ClientPart.wlst_EquipemntLightFault_server_ans_clinet_request_UserIndividuationFault,
         RequestOrUpdateUserIndividuationFault,
         typeof(UserDisplayErrorSelfSetInfoHold), this);
 }
 private void InitAction()
 {
     ProtocolServer.RegistProtocol(
         Wlst.Sr.ProtocolPhone.LxSys.wst_sys_rep_sh,
         RequestSystemInfo,
         typeof(SystemInformationViewModel), this, true);
 }
 public void InitAction()
 {
     ProtocolServer.RegistProtocol(
         Wlst.Sr.ProtocolPhone.LxRtu.wst_rtu_elec_stats_data, // .wlst_svr_ans_cnt_request_wj3090_measure_data ,
         RecordDataRequest,
         typeof(ElectricityStatisticsViewModel), this);
 }
Esempio n. 9
0
        public virtual ClusterInstance NewCopy()
        {
            // A very invasive method of cloning a protocol server. Nonetheless, since this is mostly an experiment at this
            // point, it seems we can refactor later on to have a cleaner clone mechanism.
            // Because state machines share state, and are simultaneously conceptually unaware of each other, implementing
            // a clean snapshot mechanism is very hard. I've opted for having a dirty one here in the test code rather
            // than introducing a hack into the runtime code.

            ProverTimeouts timeoutsSnapshot = _timeouts.snapshot();
            InMemoryAcceptorInstanceStore snapshotAcceptorInstances = _acceptorInstanceStore.snapshot();

            ClusterInstanceOutput output = new ClusterInstanceOutput(_uri);
            ClusterInstanceInput  input  = new ClusterInstanceInput();

            DelayedDirectExecutor executor = new DelayedDirectExecutor(_logging);

            ObjectStreamFactory objectStreamFactory = new ObjectStreamFactory();
            MultiPaxosContext   snapshotCtx         = _ctx.snapshot(_logging, timeoutsSnapshot, executor, snapshotAcceptorInstances, objectStreamFactory, objectStreamFactory, new DefaultElectionCredentialsProvider(_server.ServerId, new StateVerifierLastTxIdGetter(), new MemberInfoProvider())
                                                                    );

            IList <StateMachine> snapshotMachines = new List <StateMachine>();

            foreach (StateMachine stateMachine in _server.StateMachines.StateMachines)
            {
                snapshotMachines.Add(SnapshotStateMachine(_logging, snapshotCtx, stateMachine));
            }

            ProtocolServer snapshotProtocolServer = _factory.constructSupportingInfrastructureFor(_server.ServerId, input, output, executor, timeoutsSnapshot, _stateMachineExecutor, snapshotCtx, snapshotMachines.ToArray());

            return(new ClusterInstance(_stateMachineExecutor, _logging, _factory, snapshotProtocolServer, snapshotCtx, snapshotAcceptorInstances, timeoutsSnapshot, input, output, _uri));
        }
Esempio n. 10
0
 public ClusterJoin(Configuration config, ProtocolServer protocolServer, LogService logService)
 {
     this._config         = config;
     this._protocolServer = protocolServer;
     this._userLog        = logService.GetUserLog(this.GetType());
     this._messagesLog    = logService.GetInternalLog(this.GetType());
 }
        /// <summary>
        /// 事件过滤
        /// </summary>
        /// <param name="args"></param>
        /// <returns></returns>
        //private bool FundOrderFilter(PublishEventArgs args)
        //{
        //    return _isfilter;

        //}
        //public bool FundOrderFilters(PublishEventArgs args) //接收终端选中变更事件
        //{
        //    try
        //    {
        //    }
        //    catch (Exception ex)
        //    {
        //        Wlst.Cr.Core.UtilityFunction.WriteLog.WriteLogError("Error:" + ex);
        //    }
        //    return false;
        //}

        private void InitAction()
        {
            ProtocolServer.RegistProtocol(Sr.ProtocolPhone.LxRtu.wst_rtu_orders, //.wlst_svr_ans_cnt_request_snd_rtu_time,
                                                                                 //.ClientPart.wlst_asyntime_server_ans_clinet_order_sendweeksetk1k3,
                                          ResponseSndWeekSetK1K3, typeof(UserOperateMsgViewModel), this, true);


            ProtocolServer.RegistProtocol(
                Wlst.Sr.ProtocolPhone.LxRtu.wst_svr_ans_cnt_order_rtu_open_close_light,// .wlst_svr_ans_cnt_wj3090_order_open_close_light ,//.ClientPart.wlst_OpenCloseLight_server_ans_clinet_order_opencloseLight ,
                ExExecuteOpenLight,
                typeof(UserOperateMsgViewModel), this, true);


            ProtocolServer.RegistProtocol(
                Wlst.Sr.ProtocolPhone.LxSlu.wst_svr_ans_slu_right_operator,// .wst_slu_right_operator,
                // .wlst_svr_ans_cnt_wj2090_order_right_operator ,//.ClientPart.wlst_Wj2090svr_ans_clinet_right_operator_slu,
                SluMeasureBack,
                typeof(UserOperateMsgViewModel), this, true);

            ProtocolServer.RegistProtocol(
                Wlst.Sr.ProtocolPhone.LxSlu.wst_svr_ans_slu_ctrl_measure,
                // .wlst_svr_ans_cnt_wj2090_order_auto_fe ,//.ClientPart.wlst_Wj2090_svr_to_clinet_slu_auto_fe,
                SluCtrlMeasure,
                typeof(UserOperateMsgViewModel), this, true);

            ProtocolServer.RegistProtocol(
                Wlst.Sr.ProtocolPhone.LxSlu.wst_svr_ans_read_ctrl_args,
                CtrlArgsMeasure,
                typeof(UserOperateMsgViewModel), this, true);
        }
Esempio n. 12
0
 private void InitAction()
 {
     ProtocolServer.RegistProtocol(
         Sr.ProtocolPhone.LxRtu.wst_rtu_sd_reply,
         OnRtuSDReplay,
         typeof(SDCardQueryViewModel), this);
 }
Esempio n. 13
0
 public void InitAction()
 {
     ProtocolServer.RegistProtocol(
         Wlst.Sr.ProtocolPhone.LxAls.wst_svr_ans_lux_orders,   // .wlst_svr_ans_cnt_lux_measure ,//.ClientPart.wlst_Wj1080_server_ans_clinet_order_Measure,
         LuxDataMeasureEvent,
         typeof(LuxOnTabViewModel), this);
 }
 private void InitAction()
 {
     ProtocolServer.RegistProtocol(
         Sr.ProtocolCnt.ClientPart.wlst_Wj1090_server_ans_clinet_order_ClearBrightLightBase,
         GetRecClearBrightLightData,
         typeof(NavWj1090ClearBrightLightBase), this);
 }
Esempio n. 15
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public ClusterNetworkIT(int nrOfServers, ClusterTestScript script) throws java.net.URISyntaxException
        public ClusterNetworkIT(int nrOfServers, ClusterTestScript script)
        {
            this._script = script;

            @out.Clear();
            @in.Clear();

            for (int i = 0; i < nrOfServers; i++)
            {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final java.net.URI uri = new java.net.URI("neo4j://localhost:" + org.neo4j.ports.allocation.PortAuthority.allocatePort());
                URI uri = new URI("neo4j://localhost:" + PortAuthority.allocatePort());

                Monitors monitors = new Monitors();
                NetworkedServerFactory factory = new NetworkedServerFactory(_life, new MultiPaxosServerFactory(new ClusterConfiguration("default", NullLogProvider.Instance), NullLogProvider.Instance, monitors.NewMonitor(typeof(StateMachines.Monitor))), new FixedTimeoutStrategy(1000), NullLogProvider.Instance, new ObjectStreamFactory(), new ObjectStreamFactory(), monitors.NewMonitor(typeof(NetworkReceiver.Monitor)), monitors.NewMonitor(typeof(NetworkSender.Monitor)), monitors.NewMonitor(typeof(NamedThreadFactory.Monitor)));

                ServerIdElectionCredentialsProvider electionCredentialsProvider = new ServerIdElectionCredentialsProvider();
                ProtocolServer server = factory.NewNetworkedServer(Config.defaults(MapUtil.stringMap(ClusterSettings.cluster_server.name(), uri.Host + ":" + uri.Port, ClusterSettings.server_id.name(), "" + i)), new InMemoryAcceptorInstanceStore(), electionCredentialsProvider);
                server.AddBindingListener(electionCredentialsProvider);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final Cluster cluster2 = server.newClient(Cluster.class);
                Cluster cluster2 = server.NewClient(typeof(Cluster));
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final java.util.concurrent.atomic.AtomicReference<ClusterConfiguration> config2 = clusterStateListener(uri, cluster2);
                AtomicReference <ClusterConfiguration> config2 = ClusterStateListener(uri, cluster2);

                _servers.Add(cluster2);
                @out.Add(cluster2);
                _configurations.Add(config2);
            }

            _life.start();
        }
Esempio n. 16
0
        public static ClusterInstance NewClusterInstance(InstanceId id, URI uri, Monitors monitors, ClusterConfiguration configuration, int maxSurvivableFailedMembers, LogProvider logging)
        {
            MultiPaxosServerFactory factory = new MultiPaxosServerFactory(configuration, logging, monitors.NewMonitor(typeof(StateMachines.Monitor)));

            ClusterInstanceInput  input  = new ClusterInstanceInput();
            ClusterInstanceOutput output = new ClusterInstanceOutput(uri);

            ObjectStreamFactory objStreamFactory = new ObjectStreamFactory();

            ProverTimeouts timeouts = new ProverTimeouts(uri);

            InMemoryAcceptorInstanceStore acceptorInstances = new InMemoryAcceptorInstanceStore();

            Config config = mock(typeof(Config));

            when(config.Get(ClusterSettings.max_acceptors)).thenReturn(maxSurvivableFailedMembers);

            DelayedDirectExecutor executor = new DelayedDirectExecutor(logging);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.cluster.protocol.atomicbroadcast.multipaxos.context.MultiPaxosContext context = new org.neo4j.cluster.protocol.atomicbroadcast.multipaxos.context.MultiPaxosContext(id, org.neo4j.helpers.collection.Iterables.iterable(new org.neo4j.cluster.protocol.election.ElectionRole(org.neo4j.cluster.protocol.cluster.ClusterConfiguration.COORDINATOR)), new org.neo4j.cluster.protocol.cluster.ClusterConfiguration(configuration.getName(), logging, configuration.getMemberURIs()), executor, logging, objStreamFactory, objStreamFactory, acceptorInstances, timeouts, new org.neo4j.kernel.ha.cluster.DefaultElectionCredentialsProvider(id, new StateVerifierLastTxIdGetter(), new MemberInfoProvider()), config);
            MultiPaxosContext context = new MultiPaxosContext(id, Iterables.iterable(new ElectionRole(ClusterConfiguration.COORDINATOR)), new ClusterConfiguration(configuration.Name, logging, configuration.MemberURIs), executor, logging, objStreamFactory, objStreamFactory, acceptorInstances, timeouts, new DefaultElectionCredentialsProvider(id, new StateVerifierLastTxIdGetter(), new MemberInfoProvider()), config);

            context.ClusterContext.BoundAt = uri;

            SnapshotContext snapshotContext = new SnapshotContext(context.ClusterContext, context.LearnerContext);

            DelayedDirectExecutor taskExecutor = new DelayedDirectExecutor(logging);
            ProtocolServer        ps           = factory.NewProtocolServer(id, input, output, DirectExecutor, taskExecutor, timeouts, context, snapshotContext);

            return(new ClusterInstance(DirectExecutor, logging, factory, ps, context, acceptorInstances, timeouts, input, output, uri));
        }
Esempio n. 17
0
 private void InitAction()
 {
     ProtocolServer.RegistProtocol(
         Sr.ProtocolPhone.LxFault.wlst_fault_pre,
         OnRequestFault,
         typeof(CurrentEquipmentFaultViewModel), this);
 }
Esempio n. 18
0
 public void InitAction()
 {
     ProtocolServer.RegistProtocol(
         Wlst.Sr.ProtocolPhone.LxFault.wlst_fault_occu_data,
         OnRcvSvrFaultHappenData,
         typeof(FaultDataShow), this);
 }
Esempio n. 19
0
 private void InitAction()
 {
     //todo
     ProtocolServer.RegistProtocol(
         Wlst.Sr.ProtocolPhone.LxFault.wst_fault_hlbph_level,//.ClientPart.wlst_server_ans_clinet_request_sys_title,
         ActionRcvLnSetting,
         typeof(EquipmentFaultManageSettingViewModel), this);
 }
Esempio n. 20
0
        public ClusterClient(LifeSupport life, ProtocolServer protocolServer)
        {
            this._life           = life;
            this._protocolServer = protocolServer;

            _cluster   = protocolServer.NewClient(typeof(Cluster));
            _broadcast = protocolServer.NewClient(typeof(AtomicBroadcast));
            _heartbeat = protocolServer.NewClient(typeof(Heartbeat));
            _snapshot  = protocolServer.NewClient(typeof(Snapshot));
            _election  = protocolServer.NewClient(typeof(Election));
        }
Esempio n. 21
0
 internal ClusterInstance(Executor stateMachineExecutor, LogProvider logging, MultiPaxosServerFactory factory, ProtocolServer server, MultiPaxosContext ctx, InMemoryAcceptorInstanceStore acceptorInstanceStore, ProverTimeouts timeouts, ClusterInstanceInput input, ClusterInstanceOutput output, URI uri)
 {
     this._stateMachineExecutor = stateMachineExecutor;
     this._logging = logging;
     this._factory = factory;
     this._server  = server;
     this._ctx     = ctx;
     this._acceptorInstanceStore = acceptorInstanceStore;
     this._timeouts = timeouts;
     this._input    = input;
     this._output   = output;
     this._uri      = uri;
 }
Esempio n. 22
0
        public void InitAction()
        {
            ProtocolServer.RegistProtocol(
                Wlst.Sr.ProtocolPhone.LxRtu.wst_svr_ans_cnt_order_rtu_open_close_light,   // .wlst_svr_ans_cnt_wj3090_order_open_close_light ,//.ClientPart.wlst_OpenCloseLight_server_ans_clinet_order_opencloseLight ,
                ExExecuteOpenLight,
                typeof(OpenCloseLightDataDispatch), this);

            //ProtocolServer.RegistProtocol(
            //    Wlst.Sr.ProtocolCnt.ClientPart.wlst_OpenCloseLight_server_ans_clinet_order_closeLight,
            //    ExExecuteCloseLight,
            //    typeof(OpenCloseLightDataDispatch), this);

            ProtocolServer.RegistProtocol(
                Wlst.Sr.ProtocolPhone.LxRtu.wst_rtu_orders,   // .wlst_svr_ans_cnt_request_asyn_rtu_time ,//.ClientPart.wlst_asyntime_server_ans_client_order_asynrtutime,
                ExAsynTime,
                typeof(OpenCloseLightDataDispatch), this);
        }
Esempio n. 23
0
        private void InitAction()
        {
            ProtocolServer.RegistProtocol(
                Wlst.Sr.ProtocolPhone.LxFault.wlst_fault_curr,
                RequestOrUpdateTmlExistFaultsData,
                typeof(TmlExistFaultsInfo), this);

            ProtocolServer.RegistProtocol(
                Wlst.Sr.ProtocolPhone.LxSpe.wst_spe_special_rtus,
                RequestOrUpdateTmlExistFaultsData1,
                typeof(TmlExistFaultsInfo), this);
            //lvf 2018年6月28日13:26:35  处理火零不平衡
            ProtocolServer.RegistProtocol(
                Wlst.Sr.ProtocolPhone.LxFault.wst_fault_curr_update,
                RequestTmlExistFaultsLnData,
                typeof(TmlExistFaultsInfo), this);
        }
Esempio n. 24
0
//JAVA TO C# CONVERTER WARNING: 'final' parameters are ignored unless the option to convert to C# 7.2 'in' parameters is selected:
//ORIGINAL LINE: public ClusterClientModule(org.neo4j.kernel.lifecycle.LifeSupport life, org.neo4j.kernel.impl.util.Dependencies dependencies, final org.neo4j.kernel.monitoring.Monitors monitors, final org.neo4j.kernel.configuration.Config config, org.neo4j.logging.internal.LogService logService, org.neo4j.cluster.protocol.election.ElectionCredentialsProvider electionCredentialsProvider)
        public ClusterClientModule(LifeSupport life, Dependencies dependencies, Monitors monitors, Config config, LogService logService, ElectionCredentialsProvider electionCredentialsProvider)
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.logging.LogProvider logging = org.neo4j.cluster.logging.AsyncLogging.provider(life, logService.getInternalLogProvider());
            LogProvider logging = AsyncLogging.provider(life, logService.InternalLogProvider);

            InternalLoggerFactory.DefaultFactory = new NettyLoggerFactory(logging);

            TimeoutStrategy timeoutStrategy = (new MessageTimeoutStrategy(new FixedTimeoutStrategy(config.Get(ClusterSettings.default_timeout).toMillis()))).timeout(HeartbeatMessage.sendHeartbeat, config.Get(ClusterSettings.heartbeat_interval).toMillis()).timeout(HeartbeatMessage.timed_out, config.Get(ClusterSettings.heartbeat_timeout).toMillis()).timeout(AtomicBroadcastMessage.broadcastTimeout, config.Get(ClusterSettings.broadcast_timeout).toMillis()).timeout(LearnerMessage.learnTimedout, config.Get(ClusterSettings.learn_timeout).toMillis()).timeout(ProposerMessage.phase1Timeout, config.Get(ClusterSettings.phase1_timeout).toMillis()).timeout(ProposerMessage.phase2Timeout, config.Get(ClusterSettings.phase2_timeout).toMillis()).timeout(ClusterMessage.joiningTimeout, config.Get(ClusterSettings.join_timeout).toMillis()).timeout(ClusterMessage.configurationTimeout, config.Get(ClusterSettings.configuration_timeout).toMillis()).timeout(ClusterMessage.leaveTimedout, config.Get(ClusterSettings.leave_timeout).toMillis()).timeout(ElectionMessage.electionTimeout, config.Get(ClusterSettings.election_timeout).toMillis());

            MultiPaxosServerFactory protocolServerFactory = new MultiPaxosServerFactory(new ClusterConfiguration(config.Get(ClusterSettings.cluster_name), logging), logging, monitors.NewMonitor(typeof(StateMachines.Monitor)));

            NetworkReceiver receiver = dependencies.satisfyDependency(new NetworkReceiver(monitors.NewMonitor(typeof(NetworkReceiver.Monitor)), new ConfigurationAnonymousInnerClass(this, config)
                                                                                          , logging));

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.cluster.protocol.atomicbroadcast.ObjectInputStreamFactory objectInputStreamFactory = new org.neo4j.cluster.protocol.atomicbroadcast.ObjectStreamFactory();
            ObjectInputStreamFactory objectInputStreamFactory = new ObjectStreamFactory();
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.cluster.protocol.atomicbroadcast.ObjectOutputStreamFactory objectOutputStreamFactory = new org.neo4j.cluster.protocol.atomicbroadcast.ObjectStreamFactory();
            ObjectOutputStreamFactory objectOutputStreamFactory = new ObjectStreamFactory();

            receiver.AddNetworkChannelsListener(new NetworkChannelsListenerAnonymousInnerClass(this, logging, objectInputStreamFactory, objectOutputStreamFactory));

            NetworkSender sender = dependencies.satisfyDependency(new NetworkSender(monitors.NewMonitor(typeof(NetworkSender.Monitor)), new ConfigurationAnonymousInnerClass(this, config)
                                                                                    , receiver, logging));

            ExecutorLifecycleAdapter stateMachineExecutor = new ExecutorLifecycleAdapter(() => Executors.newSingleThreadExecutor(new NamedThreadFactory("State machine", monitors.NewMonitor(typeof(NamedThreadFactory.Monitor)))));

            AcceptorInstanceStore acceptorInstanceStore = new InMemoryAcceptorInstanceStore();

            _server = protocolServerFactory.NewProtocolServer(config.Get(ClusterSettings.server_id), timeoutStrategy, receiver, sender, acceptorInstanceStore, electionCredentialsProvider, stateMachineExecutor, objectInputStreamFactory, objectOutputStreamFactory, config);

            life.Add(sender);
            life.Add(stateMachineExecutor);
            life.Add(receiver);

            // Timeout timer - triggers every 10 ms
            life.Add(new TimeoutTrigger(_server, monitors));

            life.add(new ClusterJoin(new ConfigurationAnonymousInnerClass(this, config)
                                     , _server, logService));

            ClusterClient = dependencies.SatisfyDependency(new ClusterClient(life, _server));
        }
Esempio n. 25
0
        public void InitAciotn()
        {
            if (_init)
            {
                return;
            }
            _init = true;
            ProtocolServer.RegistProtocol(
                Wlst.Sr.ProtocolPhone.LxSys.wst_sys_file_lst,
                OnReqFileLst,
                typeof(FileSyncWithSvr), this);


            ProtocolServer.RegistProtocol(
                Wlst.Sr.ProtocolPhone.LxSys.wst_sys_file_brief_info,
                OnReqFileBriefInfo,
                typeof(FileSyncWithSvr), this);

            ProtocolServer.RegistProtocol(
                Wlst.Sr.ProtocolPhone.LxSys.wst_sys_request_file,
                OnReqFileInfo
                ,
                typeof(FileSyncWithSvr), this);

            ProtocolServer.RegistProtocol(
                Wlst.Sr.ProtocolPhone.LxSys.wst_sys_request_file_back,
                OnReqFileInfoBack
                ,
                typeof(FileSyncWithSvr), this);

            //注册调度函数
            Wlst.Cr.Coreb.AsyncTask.Qtz.AddQtz("nt", 0, DateTime.Now.AddMinutes(5).Ticks, 24 * 60 * 60,
                                               OnInit);
            Wlst.Cr.Coreb.AsyncTask.Qtz.AddQtz("nt", 0, DateTime.Now.AddMinutes(5).Ticks, 5,
                                               OnOnReqFileInfoBackWrInThrd);

            //if (DirFileNeed.Contains(@"D:\CETC50\FileSync\SingleLamp") == false)
            //    DirFileNeed.Add(@"D:\CETC50\FileSync\SingleLamp");
            SetNeedShareFileDir(@"D:\CETC50\FileSync\SingleLamp");
        }
Esempio n. 26
0
 private void InitAction()
 {
     ProtocolServer.RegistProtocol(Sr.ProtocolPhone.LxRtu.wst_rtu_orders, //.wlst_svr_ans_cnt_request_snd_rtu_time,
                                                                          //.ClientPart.wlst_asyntime_server_ans_clinet_order_sendweeksetk1k3,
                                   ResponseStopRunning, typeof(BatchStopRunning), this);
 }
Esempio n. 27
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void start() throws java.io.IOException
        public virtual void Start()
        {
            _broadcastSerializer = new AtomicBroadcastSerializer(new ObjectStreamFactory(), new ObjectStreamFactory());
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.kernel.lifecycle.LifeSupport life = new org.neo4j.kernel.lifecycle.LifeSupport();
            LifeSupport life = new LifeSupport();

            try
            {
                MessageTimeoutStrategy timeoutStrategy = (new MessageTimeoutStrategy(new FixedTimeoutStrategy(5000))).timeout(HeartbeatMessage.sendHeartbeat, 200);

                Monitors monitors = new Monitors();
                NetworkedServerFactory serverFactory = new NetworkedServerFactory(life, new MultiPaxosServerFactory(new ClusterConfiguration("default", NullLogProvider.Instance), NullLogProvider.Instance, monitors.NewMonitor(typeof(StateMachines.Monitor))), timeoutStrategy, NullLogProvider.Instance, new ObjectStreamFactory(), new ObjectStreamFactory(), monitors.NewMonitor(typeof(NetworkReceiver.Monitor)), monitors.NewMonitor(typeof(NetworkSender.Monitor)), monitors.NewMonitor(typeof(NamedThreadFactory.Monitor)));

                ServerIdElectionCredentialsProvider electionCredentialsProvider = new ServerIdElectionCredentialsProvider();
                _server = serverFactory.NewNetworkedServer(Config.defaults(), new InMemoryAcceptorInstanceStore(), electionCredentialsProvider);
                _server.addBindingListener(electionCredentialsProvider);
                _server.addBindingListener(me => Console.WriteLine("Listening at:" + me));

                Cluster = _server.newClient(typeof(Cluster));
                Cluster.addClusterListener(new ClusterListenerAnonymousInnerClass(this));

                Heartbeat heartbeat = _server.newClient(typeof(Heartbeat));
                heartbeat.AddHeartbeatListener(new HeartbeatListenerAnonymousInnerClass(this));

                Broadcast = _server.newClient(typeof(AtomicBroadcast));
                Broadcast.addAtomicBroadcastListener(value =>
                {
                    try
                    {
                        Console.WriteLine(_broadcastSerializer.receive(value));
                    }
                    catch (Exception e) when(e is IOException || e is ClassNotFoundException)
                    {
                        e.printStackTrace();
                    }
                });

                life.Start();

                string       command;
                StreamReader reader = new StreamReader(System.in);
                while (!(command = reader.ReadLine()).Equals("quit"))
                {
                    string[] arguments = command.Split(" ", true);
                    System.Reflection.MethodInfo method = GetCommandMethod(arguments[0]);
                    if (method != null)
                    {
                        string[] realArgs = new string[arguments.Length - 1];
                        Array.Copy(arguments, 1, realArgs, 0, realArgs.Length);
                        try
                        {
                            method.invoke(this, ( object[] )realArgs);
                        }
                        catch (Exception e) when(e is IllegalAccessException || e is System.ArgumentException || e is InvocationTargetException)
                        {
                            e.printStackTrace();
                        }
                    }
                }

                Cluster.leave();
            }
            finally
            {
                life.Shutdown();
                Console.WriteLine("Done");
            }
        }
Esempio n. 28
0
 internal TimeoutTrigger(ProtocolServer server, Monitors monitors)
 {
     this.Server   = server;
     this.Monitors = monitors;
 }
Esempio n. 29
0
 private void InitAction()
 {
     ProtocolServer.RegistProtocol(Sr.ProtocolPhone.LxRtuTime.wst_timetable_set,
                                   ExSaveWeek, typeof(TopDataViewModel), this, true);
 }
 private void InitAction()
 {
     ProtocolServer.RegistProtocol(Wlst.Sr.ProtocolPhone.LxSys.wlst_sys_svr_to_cnt_info,    //.ClientPart.wlst_Infrastructure_server_to_clinet_msginfo,
                                   MsgAction, typeof(NewSvrMsgViewModel), this, true);
     Wlst.Cr.CoreMims.ShowMsgInfo.ShowNewMsg.ActionAddShowInfo += AddNewRecordItem;
 }