当前位置: 首页>>代码示例>>C#>>正文


C# Group.OrderedSend方法代码示例

本文整理汇总了C#中Group.OrderedSend方法的典型用法代码示例。如果您正苦于以下问题:C# Group.OrderedSend方法的具体用法?C# Group.OrderedSend怎么用?C# Group.OrderedSend使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Group的用法示例。


在下文中一共展示了Group.OrderedSend方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: sendsynchUser

        /*
         * This Function is to be Called when a Entire User Needs to be Moved
        */
        public bool sendsynchUser(UserFileSystem file, OOBHandler oobhandle, Group group, List<Address> where)
        {
            try {
                Logger.Debug ("File Operations Synch - sendsynchUser >> BEGIN");
                bool operationResult = false;
                string fileName = FileServerComm.getInstance ().transManager.generateTransactionId (file.metadata.clientId);

                Transaction trans = new Transaction (fileName);

                if (true == FileServerComm.getInstance ().transManager.insertTransaction (trans)) {
                    try {
                        MemoryMappedFile transferFile = null;
                        int writtenBytesLength = 0;
                        transferFile = oobhandle.serializeIntoMemoryMappedFile (fileName, file, ref writtenBytesLength);

                        OOBTransaction oobtrabs = new OOBTransaction (fileName, IsisSystem.GetMyAddress (), writtenBytesLength);
                        oobhandle.sendOOBData (group, transferFile, fileName, where);

                        trans.waitTillSignalled ();
                        operationResult = !trans.isTimedOut;

                        if (operationResult) {
                            group.OrderedSend (FileServerComm.UpdateUser, oobtrabs);
                            trans.waitTillSignalled ();
                            operationResult = !trans.isTimedOut;
                        }
                        FileServerComm.getInstance ().transManager.removeAndGetTransaction (fileName);
                        operationResult = !trans.isTimedOut;
                    } catch (Exception e) {
                        Logger.Debug ("Exception during File Operations Synch - sendsynchUser" + e.ToString ());
                    }
                }

                return operationResult;
            } catch (Exception e) {
                Logger.Debug ("File Operations Synch - sendsynchUser >> Encountered Exception : " + e.ToString());
                return false;
            }
        }
开发者ID:piyushmh,项目名称:cloud-filesystem,代码行数:42,代码来源:FileOperation.cs

示例2: sendsynchUserMetaData

        /*
         * This Function is called when a New User Is Added or the Meta Data of the User Needs to be Changed and Synched
         */
        public bool sendsynchUserMetaData(UserMetaData data, OOBHandler handler, Group group, bool waitToFinish = true)
        {
            try {
                Logger.Debug ("File Operations Synch - sendsynchUserMetaData >> BEGIN");
                bool operationResult = false;

                if (waitToFinish) {
                    string transactionId = FileServerComm.getInstance ().transManager.generateTransactionId (data.clientId);
                    Transaction trans = new Transaction (transactionId);
                    if (true == FileServerComm.getInstance ().transManager.insertTransaction (trans)) {
                        UserMetaDataSync sync = new UserMetaDataSync (transactionId, IsisSystem.GetMyAddress (), data);
                        group.OrderedSend (FileServerComm.UpdateUserMetaData, sync);
                        Logger.Debug ("File Operations Synch - Making a Ordered Send");
                        trans.waitTillSignalled ();
                        FileServerComm.getInstance ().transManager.removeAndGetTransaction (transactionId);
                        operationResult = !trans.isTimedOut;
                    } else {
                        Logger.Debug ("File Operations Synch - sendsynchUserMetaData >> Generation of Transaction ID Failed: " + transactionId);
                    }
                } else {
                    UserMetaDataSync sync = new UserMetaDataSync ("", IsisSystem.GetMyAddress (), data);
                    group.OrderedSend (FileServerComm.UpdateUserMetaData, sync);
                    operationResult = true;
                }
                Logger.Debug ("File Operations Synch - sendsynchUserMetaData >> END Operation Status " + operationResult);
                return operationResult;
            } catch (Exception e) {
                Logger.Debug("File Operations Synch - sendsynchUserMetaData threw an Exception " + e.ToString());
                return false;
            }
        }
开发者ID:piyushmh,项目名称:cloud-filesystem,代码行数:34,代码来源:FileOperation.cs

示例3: sendSynchUnShareRequest

        public bool sendSynchUnShareRequest(UnShareFileWithUser request, OOBHandler handler, Group group, bool waitToFinish = true)
        {
            try {
                Logger.Debug ("File Operations Synch - sendSynchUnShareRequest >> BEGIN");
                bool operationResult = false;

                if (waitToFinish) {
                    string transactionId = FileServerComm.getInstance ().transManager.generateTransactionId (request.filename);
                    Transaction trans = new Transaction (transactionId);
                    if (true == FileServerComm.getInstance ().transManager.insertTransaction (trans)) {
                        SyncUnSharedUser sync = new SyncUnSharedUser (transactionId, IsisSystem.GetMyAddress (), request.clientId,
                                                                      request.password, request.filename, request.sharedWithUser);
                        group.OrderedSend (FileServerComm.UnshareWithUser, sync);
                        trans.waitTillSignalled ();
                        FileServerComm.getInstance ().transManager.removeAndGetTransaction (transactionId);
                        operationResult = !trans.isTimedOut;
                    } else {
                        Logger.Debug ("File Operations Synch - sendsynchdeleteFile >> Generation of Transaction ID Failed: " + transactionId);
                    }
                } else {
                    SyncUnSharedUser sync = new SyncUnSharedUser ("", IsisSystem.GetMyAddress (), request.clientId,
                                                                request.password, request.filename, request.sharedWithUser);
                    group.OrderedSend (FileServerComm.UnshareWithUser, sync);
                    operationResult = true;
                }

                Logger.Debug ("File Operations Synch - sendsynchdeleteFileFromMemory >> END Operation Status " + operationResult);
                return operationResult;
            } catch (Exception e) {
                Logger.Debug("File Operations Synch - sendSynchUnShareRequest Encountered a Exeption: " + e.ToString());
                return false;
            }
        }
开发者ID:piyushmh,项目名称:cloud-filesystem,代码行数:33,代码来源:FileOperation.cs

示例4: sendsynchdeleteFileFromMemory

        /*
            This Function is called when a File Needs to be Delete from the Memory
            This could be when the LRU replacement policy is chosen and we need to delete a File From memory
        */
        public bool sendsynchdeleteFileFromMemory(FileMetaData filemetadata, OOBHandler handler, Group group, bool waitToFinish = true)
        {
            try {
                Logger.Debug ("File Operations Synch - sendsynchdeleteFileFromMemory >> BEGIN");
                bool operationResult = false;

                if (waitToFinish) {
                    string transactionId = FileServerComm.getInstance ().transManager.generateTransactionId (filemetadata.filepath);
                    Transaction trans = new Transaction (transactionId);
                    if (true == FileServerComm.getInstance ().transManager.insertTransaction (trans)) {
                        FileMetaDataSync sync = new FileMetaDataSync (transactionId, IsisSystem.GetMyAddress (), filemetadata);
                        group.OrderedSend (FileServerComm.DeleteFileFromMemory, sync);
                        trans.waitTillSignalled ();
                        FileServerComm.getInstance ().transManager.removeAndGetTransaction (transactionId);
                        operationResult = !trans.isTimedOut;
                    } else {
                        Logger.Debug ("File Operations Synch - sendsynchUserMetaData >> Generation of Transaction ID Failed: " + transactionId);
                    }
                } else {
                    FileMetaDataSync sync = new FileMetaDataSync ("", IsisSystem.GetMyAddress (), filemetadata);
                    group.OrderedSend (FileServerComm.DeleteFileFromMemory, sync);
                    operationResult = true;
                }

                Logger.Debug ("File Operations Synch - sendsynchdeleteFileFromMemory >> END Operation Status " + operationResult);
                return operationResult;
            } catch (Exception e) {
                Logger.Debug("File Operations Synch - sendsynchdeleteFileFromMemory Encountered Exception: " + e.ToString());
                return false;
            }
        }
开发者ID:piyushmh,项目名称:cloud-filesystem,代码行数:35,代码来源:FileOperation.cs

示例5: sendsynchaddFileToMemory

        /*
            This Function is called when a New File Needs to be Added into the memory
         */
        public bool sendsynchaddFileToMemory(string UserName, UserFile file, OOBHandler oobhandle, Group group, List<Address> where)
        {
            try {
                Logger.Debug ("File Operations Synch - sendsynchaddFileToMemory >> BEGIN");
                bool operationResult = false;
                MemoryMappedFile transferFile = null;

                string fileName = FileServerComm.getInstance ().transManager.generateTransactionId (UserName + "_" + file.filemetadata.filepath);
                Transaction trans = new Transaction (fileName);

                if (true == FileServerComm.getInstance ().transManager.insertTransaction (trans)) {
                    try {

                        int writtenBytesLength = 0;
                        transferFile = oobhandle.serializeIntoMemoryMappedFile (fileName, file,ref writtenBytesLength);

                        oobhandle.sendOOBData (group, transferFile, fileName, where);

                        trans.waitTillSignalled ();
                        Logger.Debug ("File Operations Synch - sendsynchaddFileToMemory >> OOB Transfer of Data Complete for : "
                                      + file.filemetadata.filepath);

                        operationResult = !trans.isTimedOut;

                        OOBTransaction oobtrabs = new OOBTransaction (fileName, IsisSystem.GetMyAddress (), writtenBytesLength);

                        if (operationResult) {
                            group.OrderedSend (FileServerComm.SaveFileToMemory, oobtrabs);
                            trans.waitTillSignalled ();
                            Logger.Debug ("File Operations Synch - sendsynchaddFileToMemory >> Ordered Send Complete Complete for : "
                                          + file.filemetadata.filepath);
                            operationResult = !trans.isTimedOut;
                        }
                        FileServerComm.getInstance ().transManager.removeAndGetTransaction (fileName);
                        operationResult = !trans.isTimedOut;
                    } catch (Exception e) {
                        Logger.Debug ("Exception during File Operations Synch - sendsynchaddFileToMemory" + e.ToString ());
                        FileServerComm.getInstance ().transManager.removeAndGetTransaction (fileName);
                        operationResult = false;
                    }
                } else {
                    Logger.Debug ("File Operations Synch - sendsynchaddFileToMemory >> Generation of Transaction ID Failed: " + fileName);
                }
                return operationResult;
            } catch (Exception e) {
                Logger.Debug("Caught Exception " + e.ToString());
            }
            return false;
        }
开发者ID:piyushmh,项目名称:cloud-filesystem,代码行数:52,代码来源:FileOperation.cs

示例6: Main

 static void Main(string[] args)
 {
     IsisSystem.Start();
     Group g = new Group("foo");
     int myRank = 0;
     g.ViewHandlers += (ViewHandler)delegate(View v)
     {
         IsisSystem.WriteLine("New View: " + v);
         myRank = v.GetMyRank();
         if (v.members.Length == 3)
             go.Release(1);
     };
     g.Handlers[UPDATE] += (Action<int, int>)delegate(int rank, int n)
     {
         database.Add(new tuple(n, rank));
         IsisSystem.WriteLine("[" + database.Count() + "]  New tuple: " + rank + "/" + n);
         if (database.Count() == 15)
             dbFull.Release(1);
     };
     g.Handlers[LOOKUP] += (Action<int>)delegate(int arg)
     {
         IsisSystem.WriteLine("=== Query for arg=" + arg);
         List<int> answer = new List<int>();
         int index = 0;
         foreach (tuple tp in database)
             if (index++ % 3 == myRank)
             {
                 IsisSystem.WriteLine("Looking at " + tp.rank + "/" + tp.value);
                 if (tp.rank == arg)
                 {
                     IsisSystem.WriteLine("Including " + tp.rank + "/" + tp.value);
                     answer.Add(tp.value);
                 }
             }
         g.Reply(answer);
     };
     g.Join();
     go.WaitOne();
     for (int n = 0; n < 5; n++)
         g.OrderedSend(UPDATE, myRank, n);
     IsisSystem.WriteLine("Wait until database is full!");
     dbFull.WaitOne();
     IsisSystem.WriteLine("Database is fully populated!");
     if (myRank == 1)
         for (int n = 0; n < 3; n++)
         {
             List<List<int>> results = new List<List<int>>();
             g.OrderedQuery(Group.ALL, LOOKUP, n, new Isis.EOLMarker(), results);
             IsisSystem.WriteLine("\r\nAnswers for Query rank=" + n);
             foreach (List<int> list in results)
                 foreach (int value in list)
                     IsisSystem.Write(value + " ");
         }
     IsisSystem.WaitForever();
 }
开发者ID:jhc247,项目名称:CS5412-Smartcar,代码行数:55,代码来源:Program.cs

示例7: Main


//.........这里部分代码省略.........
            //                   int attr_count = r.Next(0, attributeName.Length);
            //                   for (int i = 0; i < attr_count; i++)
            //                   {
            //                       int rint = r.Next(0, attributeName.Length);
            //                       attributeList.Add(attributeName[rint]);
            //                   }
            //                   int rentity = r.Next(0, entityName.Length);
            //                   Stopwatch sw = new Stopwatch();
            //                   sw.Start();
            //                   Get(entityName[rentity], attributeList);
            //                   sw.Stop();
            //                   average.Add(sw.ElapsedTicks / (Stopwatch.Frequency / (1000L)));
            //                   counter--;
            //                   Thread.Sleep(500);
            //               }

            //               long time = average.Sum();
            //               Console.WriteLine("server set time(ms)" + time);
            //               g.OrderedSend(calculateTime, time);
            //           });
            //testThread3.Start();

            #endregion

            //Test case4,5,6,7,8: x SET and y Get (keep on changing the setCount and getCount. Tested for (SET=99,Get=1),(SET=1,Get=99),(SET=50,Get=50),(SET=75,Get=25),(SET=25,Get=75),
            #region test case4
            Thread testThread4 = new Thread(delegate()
            {
                Console.WriteLine("testing in test case");
                long time = 0;
                int count = 100;
                int totalSET = 0;
                int totalGet = 0;
                int setCount = 75;
                int getCount = 25;

                Random r = new Random();
                List<long> average = new List<long>();

                while (count > 0)
                {
                    int handler = r.Next(0, 100);
                    if (totalSET >= setCount)
                    {
                        handler = 2;
                    }
                    if (totalGet >= getCount)
                    {
                        handler = 1;
                    }
                    if (handler % 2 == 0)
                    {
                        List<string> attributeList = new List<string>();
                        int attr_count = r.Next(0, attributeName.Length);
                        for (int i = 0; i < attr_count; i++)
                        {
                            int rint = r.Next(0, attributeName.Length);
                            attributeList.Add(attributeName[rint]);
                        }
                        count--;
                        totalGet++;

                        Stopwatch sw = new Stopwatch();
                        sw.Start();
                        Get(entityName[r.Next(0, entityName.Length)], attributeList);
                        sw.Stop();
                        average.Add(sw.ElapsedTicks / (Stopwatch.Frequency / (1000L)));
                        Thread.Sleep(500);
                    }
                    else
                    {
                        List<string> attributeList = new List<string>();
                        int attr_count = r.Next(0, attributeName.Length);
                        for (int i = 0; i < attr_count; i++)
                        {
                            int rint = r.Next(0, attributeName.Length);
                            attributeList.Add(attributeName[rint] + "=" + "manvi");
                        }
                        count--;
                        totalSET++;
                        Stopwatch sw = new Stopwatch();
                        sw.Start();
                        g.OrderedSend(SET, entityName[r.Next(0, entityName.Length)], attributeList);
                        sw.Stop();
                        average.Add(sw.ElapsedTicks / (Stopwatch.Frequency / 1000L));
                        Thread.Sleep(500);
                    }
                }
                time = average.Sum();
                g.OrderedSend(calculateTime, time);

            });

            testThread4.Start();
            #endregion

            timeSem.WaitOne();
            Console.WriteLine("total time=" + (totalTime.Sum()) / totalTime.Count);
            IsisSystem.WaitForever();
        }
开发者ID:manvi90,项目名称:WCF-based-Information-Tracking-Service,代码行数:101,代码来源:Program.cs


注:本文中的Group.OrderedSend方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。