예제 #1
0
        void handleBootStrappingContinue(BootStrappingCheckPoint request, Group group, OOBHandler oobhandle)
        {
            Logger.Debug("handleBootStrappingContinue , Response received from " + request.nodeAddress.ToStringVerboseFormat());
            int bootStrapStatus    = SUCCESS;
            int numberOfUsersAdded = 0;

            if (null != state.selectedNode && request.nodeAddress.Equals(state.selectedNode))
            {
                Logger.Debug("handleBootStrapping Continue :)");

                state.currState = eBootStrapState.ReceivingData;
                MemoryMappedFile transferredFile = group.OOBFetch(request.fileName);

                if (transferredFile != null)
                {
                    Logger.Debug("File" + request.fileName + "request Transfer Successfull!");
                    try
                    {
                        int index = 0;
                        InMemoryFileSystem tempFileSystem = null;
                        tempFileSystem = oobhandle.deserializeFromMemoryMappedFile(transferredFile, ref index, request.dataLength) as InMemoryFileSystem;

                        List <string> users = tempFileSystem.GetInMemoryUserList();
                        numberOfUsersAdded = users.Count;

                        foreach (string user in users)
                        {
                            UserFileSystem userfilesys = tempFileSystem.GetClonedInMemoryUserFileSystem(user);
                            if (null != userfilesys)
                            {
                                fileSystem.addFSToMapSynchronized(userfilesys, user);
                            }
                        }
                    }
                    catch (Exception e)
                    {
                        Logger.Debug("Exception Encountered : " + e.ToString());
                        bootStrapStatus = FAILURE;
                    }
                }
                else
                {
                    Logger.Debug("File" + request.fileName + "was Deleted!");
                    bootStrapStatus = FAILURE;
                }

                Logger.Debug("handleBootStrapping Added :)" + numberOfUsersAdded + " Users");
                group.OOBDelete(request.fileName);

                BootStrappingResponse response = null;
                response = new BootStrappingResponse(request.fileName, IsisSystem.GetMyAddress(), bootStrapStatus);

                group.P2PSend(request.nodeAddress, FileServerComm.BootStrapResponse, response);
            }
            else
            {
                Logger.Debug("handleBootStrappingContinue, Receieved from Another Node, Some Problem. Ignore this Plz :)");
            }
        }
예제 #2
0
 public void handleBootStarppingResponse(BootStrappingResponse response)
 {
     FileServerComm.getInstance().getFileHandler().TryReleaseLock(IsisSystem.GetMyAddress(), response.fileName);
 }
예제 #3
0
        void handleBootStrappingContinue(BootStrappingCheckPoint request, Group group, OOBHandler oobhandle)
        {
            Logger.Debug("handleBootStrappingContinue , Response received from " + request.nodeAddress.ToStringVerboseFormat());
            int bootStrapStatus = SUCCESS;
            int numberOfUsersAdded = 0;

            if (null != state.selectedNode && request.nodeAddress.Equals (state.selectedNode)) {
                Logger.Debug ("handleBootStrapping Continue :)");

                state.currState = eBootStrapState.ReceivingData;
                MemoryMappedFile transferredFile = group.OOBFetch (request.fileName);

                if (transferredFile != null) {
                    Logger.Debug ("File" + request.fileName + "request Transfer Successfull!");
                    try
                    {
                        int index = 0;
                        InMemoryFileSystem tempFileSystem = null;
                        tempFileSystem = oobhandle.deserializeFromMemoryMappedFile(transferredFile, ref index, request.dataLength) as InMemoryFileSystem;

                        List<string> users = tempFileSystem.GetInMemoryUserList ();
                        numberOfUsersAdded = users.Count;

                        foreach(string user in users) {
                            UserFileSystem userfilesys = tempFileSystem.GetClonedInMemoryUserFileSystem (user);
                            if(null != userfilesys) {
                                fileSystem.addFSToMapSynchronized(userfilesys,user);
                            }
                        }
                    }
                    catch (Exception e)
                    {
                        Logger.Debug("Exception Encountered : " + e.ToString());
                        bootStrapStatus = FAILURE;
                    }
                } else {
                    Logger.Debug ("File" + request.fileName + "was Deleted!");
                    bootStrapStatus = FAILURE;
                }

                Logger.Debug ("handleBootStrapping Added :)" + numberOfUsersAdded + " Users");
                group.OOBDelete (request.fileName);

                BootStrappingResponse response = null;
                response = new BootStrappingResponse(request.fileName, IsisSystem.GetMyAddress (), bootStrapStatus);

                group.P2PSend (request.nodeAddress, FileServerComm.BootStrapResponse, response);

            } else {
                Logger.Debug ("handleBootStrappingContinue, Receieved from Another Node, Some Problem. Ignore this Plz :)");
            }
        }
예제 #4
0
 public void handleBootStarppingResponse(BootStrappingResponse response)
 {
     FileServerComm.getInstance().getFileHandler().TryReleaseLock(IsisSystem.GetMyAddress(), response.fileName);
 }