当前位置: 首页>>代码示例>>Java>>正文


Java ClientConfig类代码示例

本文整理汇总了Java中com.hazelcast.client.config.ClientConfig的典型用法代码示例。如果您正苦于以下问题:Java ClientConfig类的具体用法?Java ClientConfig怎么用?Java ClientConfig使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ClientConfig类属于com.hazelcast.client.config包,在下文中一共展示了ClientConfig类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: init

import com.hazelcast.client.config.ClientConfig; //导入依赖的package包/类
private void init() throws IOException {
    final ClientConfig config = new ClientConfig();
    client = HazelcastClient.newHazelcastClient(config);

    final SparkConf conf = new SparkConf()
            .set("hazelcast.server.addresses", "127.0.0.1:5701")
            .set("hazelcast.server.groupName", "dev")
            .set("hazelcast.server.groupPass", "dev-pass")
            .set("hazelcast.spark.valueBatchingEnabled", "true")
            .set("hazelcast.spark.readBatchSize", "5000")
            .set("hazelcast.spark.writeBatchSize", "5000");

    sc = new JavaSparkContext("local", "appname", conf);

    loadHistoricalRaces();
    createRandomUsers();
    createFutureEvent();
}
 
开发者ID:hazelcast,项目名称:betleopard,代码行数:19,代码来源:LiveBetMain.java

示例2: givenClientHasClassLoaderConfigured_whenObjectIsFetched_thenClassLoaderWillBeUsed

import com.hazelcast.client.config.ClientConfig; //导入依赖的package包/类
@Test
public void givenClientHasClassLoaderConfigured_whenObjectIsFetched_thenClassLoaderWillBeUsed() throws Exception {
    Config memberConfig = new Config();
    SubZero.useAsGlobalSerializer(memberConfig);
    hazelcastFactory.newHazelcastInstance(memberConfig);

    ClientConfig clientConfig = new ClientConfig();
    ClassLoader clientClassLoader = createSpyingClassLoader();
    clientConfig.setClassLoader(clientClassLoader);
    SubZero.useAsGlobalSerializer(clientConfig);
    HazelcastInstance client = hazelcastFactory.newHazelcastClient(clientConfig);
    IMap<Integer, Object> myMap = client.getMap(randomMapName());
    myMap.put(0, new MyClass());

    myMap.get(0);

    verify(clientClassLoader).loadClass("info.jerrinot.subzero.ClassLoadingTest$MyClass");
}
 
开发者ID:jerrinot,项目名称:subzero,代码行数:19,代码来源:ClassLoadingTest.java

示例3: testGlobalCustomSerializationConfiguredProgrammaticallyForClientConfig

import com.hazelcast.client.config.ClientConfig; //导入依赖的package包/类
@Test
public void testGlobalCustomSerializationConfiguredProgrammaticallyForClientConfig() {
    Config memberConfig = new Config();
    SubZero.useAsGlobalSerializer(memberConfig);
    hazelcastFactory.newHazelcastInstance(memberConfig);

    String mapName = randomMapName();
    ClientConfig config = new ClientConfig();

    SubZero.useAsGlobalSerializer(config, MyGlobalUserSerlizationConfig.class);

    HazelcastInstance member = hazelcastFactory.newHazelcastClient(config);
    IMap<Integer, AnotherNonSerializableObject> myMap = member.getMap(mapName);
    myMap.put(0, new AnotherNonSerializableObject());
    AnotherNonSerializableObject fromCache = myMap.get(0);

    assertEquals("deserialized", fromCache.name);
}
 
开发者ID:jerrinot,项目名称:subzero,代码行数:19,代码来源:TestCustomerSerializers.java

示例4: testGlobalCustomDelegateSerializationConfiguredProgrammaticallyForClientConfig

import com.hazelcast.client.config.ClientConfig; //导入依赖的package包/类
@Test
public void testGlobalCustomDelegateSerializationConfiguredProgrammaticallyForClientConfig() {
    Config memberConfig = new Config();
    SubZero.useAsGlobalSerializer(memberConfig);
    hazelcastFactory.newHazelcastInstance(memberConfig);

    String mapName = randomMapName();
    ClientConfig config = new ClientConfig();

    SubZero.useAsGlobalSerializer(config, MyGlobalDelegateSerlizationConfig.class);

    HazelcastInstance member = hazelcastFactory.newHazelcastClient(config);
    IMap<Integer, AnotherNonSerializableObject> myMap = member.getMap(mapName);
    myMap.put(0, new AnotherNonSerializableObject());
    AnotherNonSerializableObject fromCache = myMap.get(0);

    assertEquals("deserialized", fromCache.name);
}
 
开发者ID:jerrinot,项目名称:subzero,代码行数:19,代码来源:TestCustomerSerializers.java

示例5: perform

import com.hazelcast.client.config.ClientConfig; //导入依赖的package包/类
/**
 * Wait till master node prepare configuration for sending, then create it's own sender and starts document insertion.
 */
@Override
public void perform(DefaultProperties properties) throws IOException {
	ClientConfig config = new XmlClientConfigBuilder("hazelcast/hazelcast-slave.xml").build();
	String[] masterAddresses = properties.getProperty(ClusterConstants.CLUSTER_MASTER_PROP).split(",");
	config.getNetworkConfig().addAddress(masterAddresses);

	HazelcastInstance client = HazelcastClient.newHazelcastClient(config);
	try {
		init(client, properties);
	} catch (InterruptedException ex) {
		LOGGER.error("Thread interrupted: ", ex);
	} finally {
		client.shutdown();
	}
}
 
开发者ID:kucera-jan-cz,项目名称:esBench,代码行数:19,代码来源:SlaveNodeInsertAction.java

示例6: mergeMapP

import com.hazelcast.client.config.ClientConfig; //导入依赖的package包/类
@Nonnull
@SuppressWarnings("unchecked")
public static <T, K, V> ProcessorMetaSupplier mergeMapP(
        @Nonnull String name,
        @Nullable ClientConfig clientConfig,
        @Nonnull DistributedFunction<T, K> toKeyFn,
        @Nonnull DistributedFunction<T, V> toValueFn,
        @Nonnull DistributedBinaryOperator<V> mergeFn
) {
    return updateMapP(name, clientConfig, toKeyFn, (V oldValue, T item) -> {
        V newValue = toValueFn.apply(item);
        if (oldValue == null) {
            return newValue;
        }
        return mergeFn.apply(oldValue, newValue);
    });
}
 
开发者ID:hazelcast,项目名称:hazelcast-jet,代码行数:18,代码来源:HazelcastWriters.java

示例7: updateMapP

import com.hazelcast.client.config.ClientConfig; //导入依赖的package包/类
@Nonnull
@SuppressWarnings("unchecked")
public static <T, K, V> ProcessorMetaSupplier updateMapP(
        @Nonnull String name,
        @Nullable ClientConfig clientConfig,
        @Nonnull DistributedFunction<T, K> toKeyFn,
        @Nonnull DistributedFunction<T, EntryProcessor<K, V>> toEntryProcessorFn
) {
    boolean isLocal = clientConfig == null;
    return dontParallelize(new EntryProcessorWriterSupplier<>(
                    name,
                    serializableConfig(clientConfig),
                    toKeyFn,
                    toEntryProcessorFn,
                    isLocal
            )
    );
}
 
开发者ID:hazelcast,项目名称:hazelcast-jet,代码行数:19,代码来源:HazelcastWriters.java

示例8: writeMapP

import com.hazelcast.client.config.ClientConfig; //导入依赖的package包/类
@Nonnull
@SuppressWarnings("unchecked")
public static ProcessorMetaSupplier writeMapP(@Nonnull String name, @Nullable ClientConfig clientConfig) {
    boolean isLocal = clientConfig == null;
    return dontParallelize(new HazelcastWriterSupplier<>(
            serializableConfig(clientConfig),
            index -> new ArrayMap(),
            ArrayMap::add,
            instance -> {
                IMap map = instance.getMap(name);
                return buffer -> {
                    try {
                        map.putAll(buffer);
                    } catch (HazelcastInstanceNotActiveException e) {
                        handleInstanceNotActive(instance, e, isLocal);
                    }
                    buffer.clear();
                };
            },
            noopConsumer()
    ));
}
 
开发者ID:hazelcast,项目名称:hazelcast-jet,代码行数:23,代码来源:HazelcastWriters.java

示例9: writeListP

import com.hazelcast.client.config.ClientConfig; //导入依赖的package包/类
@Nonnull
public static ProcessorMetaSupplier writeListP(@Nonnull String name, @Nullable ClientConfig clientConfig) {
    boolean isLocal = clientConfig == null;
    return dontParallelize(new HazelcastWriterSupplier<>(
            serializableConfig(clientConfig),
            index -> new ArrayList<>(),
            ArrayList::add,
            instance -> {
                IList<Object> list = instance.getList(name);
                return buffer -> {
                    try {
                        list.addAll(buffer);
                    } catch (HazelcastInstanceNotActiveException e) {
                        handleInstanceNotActive(instance, e, isLocal);
                    }
                    buffer.clear();
                };
            },
            noopConsumer()
    ));
}
 
开发者ID:hazelcast,项目名称:hazelcast-jet,代码行数:22,代码来源:HazelcastWriters.java

示例10: init

import com.hazelcast.client.config.ClientConfig; //导入依赖的package包/类
/**
 * Service INIT
 */
public void init() {
    String clientServers = serverConfigurationService.getString("memory.hc.server", null);
    boolean clientConfigured = StringUtils.isNotBlank(clientServers);
    if (clientConfigured) {
        ClientConfig clientConfig = new ClientConfig();
        ClientNetworkConfig clientNetworkConfig = new ClientNetworkConfig();
        clientNetworkConfig.addAddress(StringUtils.split(clientServers, ','));
        clientConfig.setNetworkConfig(clientNetworkConfig);
        hcInstance = HazelcastClient.newHazelcastClient(clientConfig);
    } else {
        // start up a local server instead
        Config localConfig = new Config();
        localConfig.setInstanceName(serverConfigurationService.getServerIdInstance());
        hcInstance = Hazelcast.newHazelcastInstance(localConfig);
    }
    if (hcInstance == null) {
        throw new IllegalStateException("init(): HazelcastInstance is null!");
    }
    log.info("INIT: " + hcInstance.getName() + " ("+(clientConfigured?"client:"+hcInstance.getClientService():"localServer")+"), cache maps: " + hcInstance.getDistributedObjects());
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:24,代码来源:HazelcastMemoryService.java

示例11: connect

import com.hazelcast.client.config.ClientConfig; //导入依赖的package包/类
public void connect(final String clientId, HazelcastClientProxy hzProxy) {
  	ClientContainer cc = null;
  	String cKey = getConnectKey(hzProxy);
synchronized (clients) {
	cc = clients.get(cKey);
 			if (cc == null) {
 				cc = new ClientContainer(cKey, hzProxy);
 				clients.put(cKey, cc);
		logger.info("connect; new container created for clientId: {}", clientId);
 			} else {
 				// check password -> authenticate(); ??
 			}
}
Properties props = new Properties();
  	ClientConfig config = hzProxy.getClientConfig(); 
props.setProperty(pn_schema_name, config.getGroupConfig().getName());
props.setProperty(pn_schema_address, config.getNetworkConfig().getAddresses().toString());
props.setProperty(pn_schema_user, config.getCredentials().getPrincipal());
props.setProperty(pn_client_smart, String.valueOf(config.getNetworkConfig().isSmartRouting()));
props.setProperty(pn_client_bufferSize, String.valueOf(config.getNetworkConfig().getSocketOptions().getBufferSize()));
addClient(cc, clientId, props);
  }
 
开发者ID:dsukhoroslov,项目名称:bagri,代码行数:23,代码来源:ClientManagementImpl.java

示例12: init

import com.hazelcast.client.config.ClientConfig; //导入依赖的package包/类
@Override
public boolean init( StepMetaInterface smi, StepDataInterface sdi ) {
  if ( super.init( smi, sdi ) ) {
    try {
      // Create client and connect to Hazelcast server(s)
      Set<InetSocketAddress> servers = ( (HazelcastOutputMeta) smi ).getServers();
      ClientConfig clientConfig = new ClientConfig();
      ClientNetworkConfig clientNetConfig = new ClientNetworkConfig();
      if ( servers != null ) {

        for ( InetSocketAddress server : servers ) {
          clientNetConfig.addAddress( server.getHostName() + ":" + server.getPort() );
        }
        clientConfig.setNetworkConfig( clientNetConfig );
        client = HazelcastClient.newHazelcastClient( clientConfig );
      }
      return true;
    } catch ( Exception e ) {
      logError( BaseMessages.getString( PKG, "HazelcastOutput.Error.ConnectError" ), e );
      return false;
    }
  } else {
    return false;
  }
}
 
开发者ID:mattyb149,项目名称:pdi-hazelcast-plugin,代码行数:26,代码来源:HazelcastOutput.java

示例13: init

import com.hazelcast.client.config.ClientConfig; //导入依赖的package包/类
@Override
public boolean init( StepMetaInterface smi, StepDataInterface sdi ) {
  if ( super.init( smi, sdi ) ) {
    try {
      // Create client and connect to Hazelcast server(s)
      Set<InetSocketAddress> servers = ( (HazelcastInputMeta) smi ).getServers();
      ClientConfig clientConfig = new ClientConfig();
      ClientNetworkConfig clientNetConfig = new ClientNetworkConfig();
      if ( servers != null ) {

        for ( InetSocketAddress server : servers ) {
          clientNetConfig.addAddress( server.getHostName() + ":" + server.getPort() );
        }
        clientConfig.setNetworkConfig( clientNetConfig );
        client = HazelcastClient.newHazelcastClient( clientConfig );
      }
      return true;
    } catch ( Exception e ) {
      logError( BaseMessages.getString( PKG, "HazelcastInput.Error.ConnectError" ), e );
      return false;
    }
  } else {
    return false;
  }
}
 
开发者ID:mattyb149,项目名称:pdi-hazelcast-plugin,代码行数:26,代码来源:HazelcastInput.java

示例14: HazelcastClusterClient

import com.hazelcast.client.config.ClientConfig; //导入依赖的package包/类
public HazelcastClusterClient(String ... connectAddress) {
  ClientConfig config = new ClientConfig();
  
  if(connectAddress != null && connectAddress.length > 0) {
    config.getNetworkConfig().addAddress(connectAddress);
  }
  config.getGroupConfig().setName("neverwinterdp");
  config.getGroupConfig().setPassword("neverwinterdp");
  hzclient = HazelcastClient.newHazelcastClient(config);
  
  IMap<String, ServerRegistration> registrationMap = hzclient.getMap(ClusterService.CLUSTER_REGISTRATON) ;
  clusterRegistration = new ClusterRegistrationImpl(registrationMap) ;
  
  clusterEventTopic = hzclient.getTopic(ClusterService.CLUSTER_EVENT_TOPIC);
  clusterEventTopicListenerId = clusterEventTopic.addMessageListener(this) ;
}
 
开发者ID:DemandCube,项目名称:NeverwinterDP-Commons,代码行数:17,代码来源:HazelcastClusterClient.java

示例15: main

import com.hazelcast.client.config.ClientConfig; //导入依赖的package包/类
public static void main(String[] args) {
    ClientConfig clientConfig = new ClientConfig();
    clientConfig.addAddress("127.0.0.1:5701");
    HazelcastInstance client = HazelcastClient.newHazelcastClient(clientConfig);
    IMap map = client.getMap("customers");
    System.out.println("Map Size:" + map.size());

    client.getDurableExecutorService("hello").submit(new HazelcastJob(() -> System.out.println("Hello")));

}
 
开发者ID:datathings,项目名称:greycat,代码行数:11,代码来源:HazelcastTest.java


注:本文中的com.hazelcast.client.config.ClientConfig类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。