Example #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void before()
        public virtual void Before()
        {
            _master         = mock(typeof(Master));
            _masterDelegate = new DelegateInvocationHandler <Master>(typeof(Master));
            _fs             = FileSystemRule.get();
            _fac            = new HaIdGeneratorFactory(_masterDelegate, NullLogProvider.Instance, mock(typeof(RequestContextFactory)), _fs, new CommunityIdTypeConfigurationProvider());
        }
Example #2
0
 public SlaveLockManager(Locks localLocks, RequestContextFactory requestContextFactory, Master master, AvailabilityGuard availabilityGuard, LogProvider logProvider, Config config)
 {
     this._requestContextFactory = requestContextFactory;
     this._availabilityGuard     = availabilityGuard;
     this._local       = localLocks;
     this._master      = master;
     this._logProvider = logProvider;
 }
Example #3
0
        //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
        //ORIGINAL LINE: @Before public void setUp()
        public virtual void SetUp()
        {
            _master = mock( typeof( Master ), new LockedOnMasterAnswer() );
              _lockManager = new ForsetiLockManager( Config.defaults(), Clocks.systemClock(), ResourceTypes.values() );
              _requestContextFactory = mock( typeof( RequestContextFactory ) );
              _databaseAvailabilityGuard = new DatabaseAvailabilityGuard( GraphDatabaseSettings.DEFAULT_DATABASE_NAME, Clocks.systemClock(), mock(typeof(Log)) );

              when( _requestContextFactory.newRequestContext( Mockito.anyInt() ) ).thenReturn(RequestContext.anonymous(1));
        }
Example #4
0
 public CommitProcessSwitcher(TransactionPropagator txPropagator, Master master, DelegateInvocationHandler <TransactionCommitProcess> @delegate, RequestContextFactory requestContextFactory, Monitors monitors, DependencyResolver dependencyResolver, Config config) : base(@delegate)
 {
     this._txPropagator          = txPropagator;
     this._master                = master;
     this._requestContextFactory = requestContextFactory;
     this._dependencyResolver    = dependencyResolver;
     this._monitor               = monitors.NewMonitor(typeof(MasterTransactionCommitProcess.Monitor));
     this._activeDatabaseName    = config.Get(GraphDatabaseSettings.active_database);
 }
Example #5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void setUp()
        public virtual void SetUp()
        {
            _lastSeenEventIdentifier = new AtomicInteger(-1);
            _master         = mock(typeof(Master));
            _requestContext = new RequestContext(10, 11, 12, 13, 14);
            RequestContextFactory reqFactory = new ConstantRequestContextFactoryAnonymousInnerClass(this, _requestContext);

            _response = new LongResponse(42L);
            _tx       = new PhysicalTransactionRepresentation(Collections.emptyList());
            _tx.setHeader(new sbyte[] {}, 1, 1, 1, 1, 1, 1337);

            _commitProcess = new SlaveTransactionCommitProcess(_master, reqFactory);
        }
Example #6
0
 public PullerFactory(RequestContextFactory requestContextFactory, Master master, LastUpdateTime lastUpdateTime, LogProvider logging, InstanceId serverId, InvalidEpochExceptionHandler invalidEpochHandler, long pullInterval, JobScheduler jobScheduler, DependencyResolver dependencyResolver, AvailabilityGuard availabilityGuard, HighAvailabilityMemberStateMachine memberStateMachine, Monitors monitors, Config config)
 {
     this._requestContextFactory = requestContextFactory;
     this._master              = master;
     this._lastUpdateTime      = lastUpdateTime;
     this._logging             = logging;
     this._serverId            = serverId;
     this._invalidEpochHandler = invalidEpochHandler;
     this._pullInterval        = pullInterval;
     this._jobScheduler        = jobScheduler;
     this._dependencyResolver  = dependencyResolver;
     this._availabilityGuard   = availabilityGuard;
     this._memberStateMachine  = memberStateMachine;
     this._monitors            = monitors;
     this._activeDatabaseName  = config.Get(GraphDatabaseSettings.active_database);
 }
Example #7
0
        /// <summary>
        /// Performs a switch to the master state. Starts communication endpoints, switches components to the master state
        /// and broadcasts the appropriate Master Is Available event. </summary>
        /// <param name="haCommunicationLife"> The LifeSupport instance to register communication endpoints. </param>
        /// <param name="me"> The URI that the communication endpoints should bind to </param>
        /// <returns> The URI at which the master communication was bound. </returns>
//JAVA TO C# CONVERTER NOTE: Members cannot have the same name as their enclosing type:
        public virtual URI SwitchToMasterConflict(LifeSupport haCommunicationLife, URI me)
        {
            _userLog.info("I am %s, moving to master", MyId(_config));

            // Do not wait for currently active transactions to complete before continuing switching.
            // - A master in a cluster is very important, without it the cluster cannot process any write requests
            // - Awaiting open transactions to complete assumes that this instance just now was a slave that is
            //   switching to master, which means the previous master where these active transactions were hosted
            //   is no longer available so these open transactions cannot continue and complete anyway,
            //   so what's the point waiting for them?
            // - Read transactions may still be able to complete, but the correct response to failures in those
            //   is to have them throw transient error exceptions hinting that they should be retried,
            //   at which point they may get redirected to another instance, or to this instance if it has completed
            //   the switch until then.

            _idGeneratorFactory.switchToMaster();
            NeoStoreDataSource dataSource = _dataSourceSupplier.get();

            dataSource.AfterModeSwitch();

            Locks locks = dataSource.DependencyResolver.resolveDependency(typeof(Locks));
            ConversationManager conversationManager = ConversationManagerFactory.apply(locks);
            Master master = MasterFactory.apply(conversationManager, haCommunicationLife);

            MasterServer masterServer = MasterServerFactory.apply(master, conversationManager);

            haCommunicationLife.Add(masterServer);
            _masterDelegateHandler.Delegate = master;

            haCommunicationLife.Start();

            URI masterHaURI = GetMasterUri(me, masterServer, _config);

            _clusterMemberAvailability.memberIsAvailable(MASTER, masterHaURI, dataSource.StoreId);
            _userLog.info("I am %s, successfully moved to master", MyId(_config));

            _slaveFactorySupplier.get().StoreId = dataSource.StoreId;

            return(masterHaURI);
        }
Example #8
0
 protected internal override Response <int> Create(Master master, RequestContext context, string name)
 {
     return(master.CreateRelationshipType(context, name));
 }
Example #9
0
 public SlaveRelationshipTypeCreator(Master master, RequestContextFactory requestContextFactory) : base(master, requestContextFactory)
 {
 }
Example #10
0
 protected internal abstract Response <int> Create(Master master, RequestContext context, string name);
Example #11
0
 protected internal AbstractTokenCreator(Master master, RequestContextFactory requestContextFactory)
 {
     this._master = master;
     this._requestContextFactory = requestContextFactory;
 }
Example #12
0
 public SlaveTransactionCommitProcess(Master master, RequestContextFactory requestContextFactory)
 {
     this._master = master;
     this._requestContextFactory = requestContextFactory;
 }
Example #13
0
 protected internal override Response <int> Create(Master master, RequestContext context, string name)
 {
     return(master.CreatePropertyKey(context, name));
 }
Example #14
0
 public SlavePropertyTokenCreator(Master master, RequestContextFactory requestContextFactory) : base(master, requestContextFactory)
 {
 }
Example #15
0
 public DistributedLockFailureException(string message, Master master, ComException cause) : base(message + " uniquetempvar. The most common causes of this exception are " + "network failures, or master-switches where the failing transaction was started before the last " + "master election.", cause)
 {
 }
Example #16
0
 public SlaveLabelTokenCreator(Master master, RequestContextFactory requestContextFactory) : base(master, requestContextFactory)
 {
 }