@@ -316,8 +316,7 @@ public DistributedObjectServer(ServerConfigurationManager configSetupManager, TC
316
316
this .serverBuilder = createServerBuilder (configSetupManager .getGroupConfiguration (), logger , server );
317
317
this .serviceRegistry = new TerracottaServiceProviderRegistryImpl ();
318
318
this .topologyManager = new TopologyManager (()->this .configSetupManager .getGroupConfiguration ().getHostPorts (), ()-> {
319
- Configuration config = this .configSetupManager .getConfiguration ();
320
- FailoverBehavior consistent = config .getFailoverPriority ();
319
+ FailoverBehavior consistent = this .configSetupManager .getFailoverPriority ();
321
320
if (this .configSetupManager .isPartialConfiguration () || consistent == null || consistent .isAvailability ()) {
322
321
return -1 ;
323
322
} else {
@@ -484,10 +483,9 @@ public synchronized void bootstrap() throws IOException, LocationNotCreatedExcep
484
483
this .sampledCounterManager = new CounterManagerImpl ();
485
484
486
485
// Set up the ServiceRegistry.
487
- Configuration configuration = this .configSetupManager .getConfiguration ();
488
486
PlatformConfiguration platformConfiguration =
489
- new PlatformConfigurationImpl (configSetupManager . getServerConfiguration (), configuration );
490
- serviceRegistry .initialize (platformConfiguration , configuration );
487
+ new PlatformConfigurationImpl (configSetupManager );
488
+ serviceRegistry .initialize (platformConfiguration , configSetupManager );
491
489
serviceRegistry .registerImplementationProvided (new PlatformServiceProvider (server ));
492
490
493
491
final EntityMessengerProvider messengerProvider = new EntityMessengerProvider ();
@@ -526,7 +524,7 @@ public synchronized void bootstrap() throws IOException, LocationNotCreatedExcep
526
524
}
527
525
}
528
526
529
- if (configuration .isPartialConfiguration () || configuration .isRelaySource ()) {
527
+ if (configSetupManager .isPartialConfiguration () || configSetupManager .isRelaySource ()) {
530
528
// don't persist anything for partial configurations
531
529
persistor = new NullPersistor ();
532
530
} else {
@@ -587,7 +585,7 @@ public synchronized void bootstrap() throws IOException, LocationNotCreatedExcep
587
585
ClientStatePersistor clientStateStore = this .persistor .getClientStatePersistor ();
588
586
this .connectionIdFactory = new ConnectionIDFactoryImpl (infoConnections , clientStateStore , capablities );
589
587
int voteCount =
590
- ConsistencyManager .parseVoteCount (configuration .getFailoverPriority (), configuration . getServerConfigurations ().size ());
588
+ ConsistencyManager .parseVoteCount (configSetupManager .getFailoverPriority (), configSetupManager . getGroupConfiguration (). getNodes ().size ());
591
589
int knownPeers = this .configSetupManager .allCurrentlyKnownServers ().length - 1 ;
592
590
593
591
if (voteCount >= 0 && (voteCount + knownPeers + 1 ) % 2 == 0 ) {
@@ -615,9 +613,9 @@ public synchronized void bootstrap() throws IOException, LocationNotCreatedExcep
615
613
final DSOChannelManager channelManager = new DSOChannelManagerImpl (this .l1Listener .getChannelManager (), pInfo .version ());
616
614
channelManager .addEventListener (this .connectionIdFactory );
617
615
618
- ServerPersistentState serverPersistentState = configuration .isRelaySource () ? new RelayPersistentState () : new ClusterPersistentState (this .persistor .getClusterStatePersistor ());
616
+ ServerPersistentState serverPersistentState = configSetupManager .isRelaySource () ? new RelayPersistentState () : new ClusterPersistentState (this .persistor .getClusterStatePersistor ());
619
617
620
- if (serverPersistentState .getInitialMode () == ServerMode .ACTIVE && configuration .isRelayDestination ()) {
618
+ if (serverPersistentState .getInitialMode () == ServerMode .ACTIVE && configSetupManager .isRelayDestination ()) {
621
619
throw new TCShutdownServerException ("Unable to start as a relay destination. The server was shutdown as active" );
622
620
}
623
621
@@ -641,7 +639,7 @@ public synchronized void bootstrap() throws IOException, LocationNotCreatedExcep
641
639
final InitialStateWeightGenerator initialState = new InitialStateWeightGenerator (serverPersistentState );
642
640
weightGeneratorFactory .add (initialState );
643
641
// 5) Topology weight is the number nodes this stripe believes are in the cluster
644
- final TopologyWeightGenerator topoWeight = new TopologyWeightGenerator (this .configSetupManager . getConfiguration () );
642
+ final TopologyWeightGenerator topoWeight = new TopologyWeightGenerator (this .configSetupManager );
645
643
weightGeneratorFactory .add (topoWeight );
646
644
// 6) SequenceID weight is the number of replication activities handled by this passive server
647
645
final SequenceIDWeightGenerator sequenceWeight = new SequenceIDWeightGenerator ();
@@ -721,7 +719,7 @@ public synchronized void bootstrap() throws IOException, LocationNotCreatedExcep
721
719
HASettingsChecker haChecker = new HASettingsChecker (configSetupManager , tcProperties );
722
720
haChecker .validateHealthCheckSettingsForHighAvailability ();
723
721
724
- StateManager state = new StateManagerImpl (consoleLogger , (n )->!configuration .isRelayDestination (), this .groupCommManager ,
722
+ StateManager state = new StateManagerImpl (consoleLogger , (n )->!configSetupManager .isRelayDestination (), this .groupCommManager ,
725
723
createStageController (processTransactionHandler ), eventCollector , stageManager ,
726
724
configSetupManager .getGroupConfiguration ().getNodes ().size (),
727
725
configSetupManager .getGroupConfiguration ().getElectionTimeInSecs (),
@@ -733,13 +731,13 @@ public synchronized void bootstrap() throws IOException, LocationNotCreatedExcep
733
731
new GenericHandler <>(), 1 );
734
732
// routing for passive to receive replication
735
733
EventHandler <ReplicationMessage > replicationEvents = null ;
736
- if (configSetupManager .getConfiguration (). isRelaySource ()) {
734
+ if (configSetupManager .isRelaySource ()) {
737
735
replicationEvents = createAndRouteRelayTransactionHandler (replicationResponseStage );
738
736
} else {
739
737
ReplicatedTransactionHandler replicatedTransactionHandler = new ReplicatedTransactionHandler (state , replicationResponseStage , this .persistor , entityManager , groupCommManager );
740
738
sequenceWeight .setReplicatedTransactionHandler (replicatedTransactionHandler );
741
739
replicationEvents = replicatedTransactionHandler .getEventHandler ();
742
- routeRelayMessages (state , configSetupManager . getConfiguration () );
740
+ routeRelayMessages (state , configSetupManager );
743
741
}
744
742
745
743
// This requires both the stage for handling the replication/sync messages.
@@ -854,12 +852,11 @@ connectionPolicy, getOperationGuardian(platformServiceRegistry,
854
852
}
855
853
856
854
public synchronized void openNetworkPorts () throws ConfigurationException {
857
- Configuration configuration = this .configSetupManager .getConfiguration ();
858
855
// don't join the group if the configuration is not complete
859
856
if (this .l2Coordinator == null ) {
860
857
throw new IllegalStateException ("server is not bootstrapped" );
861
858
}
862
- if (!configuration .isPartialConfiguration ()) {
859
+ if (!configSetupManager .isPartialConfiguration ()) {
863
860
startGroupManagers ();
864
861
}
865
862
this .l2Coordinator .start ();
@@ -938,7 +935,7 @@ private ConsistencyManager createConsistencyManager(ServerConfigurationManager c
938
935
return new DiagnosticModeConsistencyManager ();
939
936
}
940
937
941
- boolean consistentStartup = knownPeers > 0 && (configSetupManager .getConfiguration (). isConsistentStartup () || voteCount >= 0 );
938
+ boolean consistentStartup = knownPeers > 0 && (configSetupManager .isConsistentStartup () || voteCount >= 0 );
942
939
return new SafeStartupManagerImpl (
943
940
consistentStartup ,
944
941
knownPeers ,
@@ -1179,10 +1176,9 @@ private void startGroupManagers() {
1179
1176
throw new IllegalStateException ("server is not bootstrapped" );
1180
1177
}
1181
1178
NodeID myNodeId ;
1182
- Configuration config = this .configSetupManager .getConfiguration ();
1183
- if (config .isRelayDestination ()) {
1184
- consoleLogger .info ("connectiong to {} for duplication" , config .getRelayPeer ());
1185
- myNodeId = this .groupCommManager .join (this .configSetupManager .getGroupConfiguration ().directConnect (config .getRelayPeer ()));
1179
+ if (configSetupManager .isRelayDestination ()) {
1180
+ consoleLogger .info ("connectiong to {} for duplication" , configSetupManager .getRelayPeer ());
1181
+ myNodeId = this .groupCommManager .join (this .configSetupManager .getGroupConfiguration ().directConnect (configSetupManager .getRelayPeer ()));
1186
1182
} else {
1187
1183
myNodeId = this .groupCommManager .join (this .configSetupManager .getGroupConfiguration ());
1188
1184
}
@@ -1421,7 +1417,7 @@ public void handleEvent(RelayMessage context) throws EventHandlerException {
1421
1417
return handler .getEventHandler ();
1422
1418
}
1423
1419
1424
- private void routeRelayMessages (StateManager stateMgr , Configuration config ) {
1420
+ private void routeRelayMessages (StateManager stateMgr , ServerConfigurationManager config ) {
1425
1421
DuplicationTransactionHandler handler = new DuplicationTransactionHandler (stateMgr , n ->config .isRelayDestination (), groupCommManager );
1426
1422
Stage <RelayMessage > relays = this .seda .getStageManager ().createStage (ServerConfigurationContext .PASSIVE_DUPLICATE_STAGE , RelayMessage .class , handler .getEventHandler (), 1 );
1427
1423
this .groupCommManager .routeMessages (RelayMessage .class , relays .getSink ());
0 commit comments