Пример #1
0
        private IAsyncResult RemoteAsyncCallView(TupleSpace space)
        {
            AsyncViewDelegate RemoteDel = new AsyncViewDelegate(space.RequestView);
            IAsyncResult      RemAr     = RemoteDel.BeginInvoke(null, null);

            return(RemAr);
        }
Пример #2
0
        private IAsyncResult RemoteAsyncCallAdd(TupleSpace space, ITuple tuple, string id, int seq)
        {
            AsyncAddDelegate RemoteDel = new AsyncAddDelegate(space.Add);
            IAsyncResult     RemAr     = RemoteDel.BeginInvoke(tuple, id, seq, RemoteAsyncCallBackAdd, null);

            return(RemAr);
        }
Пример #3
0
        private IAsyncResult RemoteAsyncCallTakeRemove(TupleSpace space, ITuple tuple, HashSet <ITuple> locked, string id, int seq)
        {
            AsyncTakeRemoveDelegate RemoteDel = new AsyncTakeRemoveDelegate(space.TakeRemove);
            IAsyncResult            RemAr     = RemoteDel.BeginInvoke(tuple, locked, id, seq, RemoteAsyncCallBackTakeRemove, null);

            return(RemAr);
        }
Пример #4
0
        private IAsyncResult RemoteAsyncCallUnlock(TupleSpace space, HashSet <ITuple> locked, string id, int seq)
        {
            AsyncUnlockDelegate RemoteDel = new AsyncUnlockDelegate(space.Unlock);
            IAsyncResult        RemAr     = RemoteDel.BeginInvoke(locked, id, seq, RemoteAsyncCallBackUnlock, null);

            return(RemAr);
        }
Пример #5
0
        private IAsyncResult RemoteAsyncCallTakeSelect(TupleSpace space, ISchema schema, string id, int seq)
        {
            AsyncTakeSelectDelegate RemoteDel = new AsyncTakeSelectDelegate(space.TakeSelect);
            IAsyncResult            RemAr     = RemoteDel.BeginInvoke(schema, id, seq, null, null);

            return(RemAr);
        }
Пример #6
0
        private IAsyncResult RemoteAsyncCallContinue(TupleSpace space)
        {
            AsyncContinueDelegate RemoteDel = new AsyncContinueDelegate(space.Continue);
            IAsyncResult          RemAr     = RemoteDel.BeginInvoke(null, null);

            return(RemAr);
        }
Пример #7
0
        private IAsyncResult RemoteAsyncCallStop(TupleSpace space)
        {
            AsyncStopDelegate RemoteDel = new AsyncStopDelegate(space.Stop);
            IAsyncResult      RemAr     = RemoteDel.BeginInvoke(null, null);

            return(RemAr);
        }
Пример #8
0
        private IAsyncResult RemoteAsyncCallAsk(TupleSpace space)
        {
            AsyncAskDelegate RemoteDel = new AsyncAskDelegate(space.RequestData);
            IAsyncResult     RemAr     = RemoteDel.BeginInvoke(null, null);

            return(RemAr);
        }
Пример #9
0
        public void Update()
        {
            string copyUrl = null;

            while (copyUrl == null)
            {
                copyUrl = viewManager.RequestView().First();
            }
            TupleSpace copySpace = (TupleSpace)otherTupleSpaces[copyUrl];

            bool Stopped = copySpace.Stop();

            if (!Stopped)
            {
                return;
            }
            UpdateLatest(copySpace.RequestData());
            copySpace.Continue();
        }
Пример #10
0
        public ServerApi(string id, string url, int minDelay, int maxDelay, List <String> urls)
        {
            int        port    = DU.ExtractPortFromUrl(url);
            TcpChannel Channel = new TcpChannel(DU.ExtractPortFromUrl(url));

            ChannelServices.RegisterChannel(Channel, false);

            Dictionary <string, Pingable> TupleSpaces = new Dictionary <string, Pingable>();
            string selfURL = "";

            foreach (string serverUrl in urls)
            {
                if (port != DU.ExtractPortFromUrl(serverUrl))
                {
                    Console.WriteLine(serverUrl);
                    TupleSpaces.Add(serverUrl, (TupleSpace)Activator.GetObject(typeof(TupleSpace), serverUrl));
                }
                else
                {
                    selfURL = serverUrl;
                }
            }

            TupleSpace tupleSpace = new TupleSpace(selfURL, minDelay, maxDelay, TupleSpaces);

            RemotingServices.Marshal(tupleSpace, DU.ExtractObjectNameFromUrl(url));
            tupleSpace.Stopped = true;
            List <TupleSpace> tupleSpaces = new List <TupleSpace>();

            foreach (var entry in TupleSpaces)
            {
                tupleSpaces.Add((TupleSpace)entry.Value);
            }
            tupleSpace.Update();
            tupleSpace.Stopped = false;
            Console.WriteLine("Enter to exit");
            Console.ReadLine();
        }