private void configureProtocolServerTopology(OperationContext context, HotRodServerConfigurationBuilder builder, ModelNode config) throws OperationFailedException { if (config.hasDefined(ModelKeys.TOPOLOGY_STATE_TRANSFER) && config.get(ModelKeys.TOPOLOGY_STATE_TRANSFER, ModelKeys.TOPOLOGY_STATE_TRANSFER_NAME).isDefined()) { config = config.get(ModelKeys.TOPOLOGY_STATE_TRANSFER, ModelKeys.TOPOLOGY_STATE_TRANSFER_NAME); if (config.hasDefined(ModelKeys.LOCK_TIMEOUT)) { builder.topologyLockTimeout(TopologyStateTransferResource.LOCK_TIMEOUT.resolveModelAttribute(context, config).asLong()); } if (config.hasDefined(ModelKeys.REPLICATION_TIMEOUT)) { builder.topologyReplTimeout(TopologyStateTransferResource.REPLICATION_TIMEOUT.resolveModelAttribute(context, config).asLong()); } if (config.hasDefined(ModelKeys.EXTERNAL_HOST)) { builder.proxyHost(TopologyStateTransferResource.EXTERNAL_HOST.resolveModelAttribute(context, config).asString()); } if (config.hasDefined(ModelKeys.EXTERNAL_PORT)) { builder.proxyPort(TopologyStateTransferResource.EXTERNAL_PORT.resolveModelAttribute(context, config).asInt()); } if (config.hasDefined(ModelKeys.LAZY_RETRIEVAL)) { builder.topologyStateTransfer(!TopologyStateTransferResource.LAZY_RETRIEVAL.resolveModelAttribute(context, config).asBoolean()); } if (config.hasDefined(ModelKeys.AWAIT_INITIAL_RETRIEVAL)) { builder.topologyAwaitInitialTransfer(TopologyStateTransferResource.AWAIT_INITIAL_RETRIEVAL.resolveModelAttribute(context, config).asBoolean()); } } } }
public void testLazyLoadTopology() { HotRodServerConfigurationBuilder builder = new HotRodServerConfigurationBuilder(); builder.topologyStateTransfer(false).topologyReplTimeout(43000); withClusteredServer(builder, (cfg, distSyncTimeout) -> { assertEquals(cfg.clustering().remoteTimeout(), 43000); assertTrue(cfg.clustering().stateTransfer().fetchInMemoryState()); ClusterLoaderConfiguration clcfg = ((ClusterLoaderConfiguration) cfg.persistence().stores().get(0)); assertNotNull(clcfg); assertEquals(clcfg.remoteCallTimeout(), 43000); }); }
public void testUserDefinedTimeouts() { HotRodServerConfigurationBuilder builder = new HotRodServerConfigurationBuilder(); builder.topologyLockTimeout(26000).topologyReplTimeout(31000); withClusteredServer(builder, (cfg, distSyncTimeout) -> { assertEquals(cfg.locking().lockAcquisitionTimeout(), 26000); assertEquals(cfg.clustering().remoteTimeout(), 31000); assertTrue(cfg.clustering().stateTransfer().fetchInMemoryState()); assertEquals(cfg.clustering().stateTransfer().timeout(), 31000 + distSyncTimeout); assertTrue(cfg.persistence().stores().isEmpty()); }); }