internal IdentityModule(PlatformModule platformModule, File clusterStateDirectory) { FileSystemAbstraction fileSystem = platformModule.FileSystem; LogProvider logProvider = platformModule.Logging.InternalLogProvider; Log log = logProvider.getLog(this.GetType()); SimpleStorage <MemberId> memberIdStorage = new SimpleFileStorage <MemberId>(fileSystem, clusterStateDirectory, CORE_MEMBER_ID_NAME, new MemberId.Marshal(), logProvider); try { if (memberIdStorage.Exists()) { _myself = memberIdStorage.ReadState(); if (_myself == null) { throw new Exception("I was null"); } } else { System.Guid uuid = System.Guid.randomUUID(); _myself = new MemberId(uuid); memberIdStorage.WriteState(_myself); log.Info(string.Format("Generated new id: {0} ({1})", _myself, uuid)); } } catch (IOException e) { throw new Exception(e); } platformModule.JobScheduler.TopLevelGroupName = "Core " + _myself; }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: void dump() throws java.io.IOException internal virtual void Dump() { SimpleStorage <MemberId> memberIdStorage = new SimpleFileStorage <MemberId>(_fs, _clusterStateDirectory, CORE_MEMBER_ID_NAME, new MemberId.Marshal(), NullLogProvider.Instance); if (memberIdStorage.Exists()) { MemberId memberId = memberIdStorage.ReadState(); @out.println(CORE_MEMBER_ID_NAME + ": " + memberId); } DumpState(LAST_FLUSHED_NAME, new LongIndexMarshal()); DumpState(LOCK_TOKEN_NAME, new ReplicatedLockTokenState.Marshal(new MemberId.Marshal())); DumpState(ID_ALLOCATION_NAME, new IdAllocationState.Marshal()); DumpState(SESSION_TRACKER_NAME, new GlobalSessionTrackerState.Marshal(new MemberId.Marshal())); /* raft state */ DumpState(RAFT_MEMBERSHIP_NAME, new RaftMembershipState.Marshal()); DumpState(RAFT_TERM_NAME, new TermState.Marshal()); DumpState(RAFT_VOTE_NAME, new VoteState.Marshal(new MemberId.Marshal())); }