public static PartitionDRGateway getInstance ( int partitionId , ProducerDRGateway producerGateway , StartAction startAction ) { // if this is a primary cluster in a DR-enabled scenario // try to load the real version of this class PartitionDRGateway pdrg = null ; if ( producerGateway != null ) { pdrg = tryToLoadProVersion ( ) ; } if ( pdrg == null ) { pdrg = new PartitionDRGateway ( ) ; } // init the instance and return try { pdrg . init ( partitionId , producerGateway , startAction ) ; } catch ( Exception e ) { VoltDB . crashLocalVoltDB ( e . getMessage ( ) , true , e ) ; } // Regarding apparent lack of thread safety: this is called serially // while looping over the SPIs during database initialization assert ! m_partitionDRGateways . containsKey ( partitionId ) ; ImmutableMap . Builder < Integer , PartitionDRGateway > builder = ImmutableMap . builder ( ) ; builder . putAll ( m_partitionDRGateways ) ; builder . put ( partitionId , pdrg ) ; m_partitionDRGateways = builder . build ( ) ; return pdrg ; }
Load the full subclass if it should otherwise load the noop stub .