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


Java IExecutorService.submitToMember方法代码示例

本文整理汇总了Java中com.hazelcast.core.IExecutorService.submitToMember方法的典型用法代码示例。如果您正苦于以下问题:Java IExecutorService.submitToMember方法的具体用法?Java IExecutorService.submitToMember怎么用?Java IExecutorService.submitToMember使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.hazelcast.core.IExecutorService的用法示例。


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

示例1: submit

import com.hazelcast.core.IExecutorService; //导入方法依赖的package包/类
static <T> ServiceCommandResult<T> submit(HazelcastInstance instance, ServiceCommand<T> command, ClusterMember member) {
  IExecutorService exService = instance.getExecutorService(HAZELCAST_EXECUTOR_NAME) ;
  HazelcastMemberSelector selector = new HazelcastMemberSelector(instance) ;
  Member hzmember = selector.selectMember(member) ;
  ServiceCommandWrapper<T> wrapper = new ServiceCommandWrapper<T>(command) ;
  Future<T> future = exService.submitToMember(wrapper, hzmember) ;
  ServiceCommandResult<T> result = new ServiceCommandResult<T>() ;
  result.setFromMember(member);
  try {
    T ret = future.get(command.getTimeout(), TimeUnit.MILLISECONDS) ;
    result.setResult(ret);
    return result ;
  } catch (InterruptedException | ExecutionException | TimeoutException error) {
    result.setError(error) ;
    return result ;
  }
}
 
开发者ID:DemandCube,项目名称:NeverwinterDP-Commons,代码行数:18,代码来源:Util.java

示例2: initSchema

import com.hazelcast.core.IExecutorService; //导入方法依赖的package包/类
private static boolean initSchema(HazelcastInstance hzInstance, Member member, Schema schema) {
   	
	logger.trace("initSchema.enter; schema: {}", schema);
	SchemaInitiator init = new SchemaInitiator(schema);
	IExecutorService execService = hzInstance.getExecutorService(PN_XDM_SYSTEM_POOL);
      	Future<Boolean> result = execService.submitToMember(init, member);
      	Boolean ok = false;
      	try {
		ok = result.get();
	} catch (InterruptedException | ExecutionException ex) {
		logger.error("initSchema.error; ", ex);
       }
	logger.info("initSchema.exit; schema {} {}initialized", schema.getName(), ok ? "" : "NOT ");
	return ok;
}
 
开发者ID:dsukhoroslov,项目名称:bagri,代码行数:16,代码来源:BagriCacheServer.java

示例3: call

import com.hazelcast.core.IExecutorService; //导入方法依赖的package包/类
@Override
public Boolean call() throws Exception {
   	logger.trace("call.enter; schema: {}; init: {}", schemaName, init);
   	//logger.trace("call.enter; HZ: {}; SM: {}", hzInstance, schemaService);
	boolean result = false;
	for (Member member: hzInstance.getCluster().getMembers()) {
		if (uuid.equals(member.getUuid())) {
	    	if (init) {
	    		Schema schema = schemaService.getSchema(schemaName);
	    		SchemaInitiator initTask = new SchemaInitiator(schema);
	    		IExecutorService execService = hzInstance.getExecutorService(PN_XDM_SYSTEM_POOL);
	    		Future<Boolean> initiated = execService.submitToMember(initTask, member);
	    		Boolean ok = false;
	    		try {
	    			ok = initiated.get();
	    		} catch (InterruptedException | ExecutionException ex) {
	    			logger.error("initSchema.error; ", ex);
	    		}
	    	}
			schemaService.initMember(member);
			result = true;
			break;
		}
	}
   	logger.trace("call.exit; returning: {} for member: {}", result, uuid);
	return result;
}
 
开发者ID:dsukhoroslov,项目名称:bagri,代码行数:28,代码来源:SchemaAdministrator.java

示例4: updateIndex

import com.hazelcast.core.IExecutorService; //导入方法依赖的package包/类
public IndexSettingsResponse updateIndex(String indexName, org.lumongo.cluster.message.LumongoIndex.IndexSettings request)
		throws InvalidIndexConfig, MongoException, IOException {
	globalLock.readLock().lock();
	try {
		log.info("Updating index settings for <" + indexName + ">:\n" + JsonFormat.printer().print(request));
		LumongoIndex i = indexMap.get(indexName);
		if (i == null) {
			throw new IndexDoesNotExist(indexName);
		}

		i.updateIndexSettings(request);

		Set<Member> currentMembers = hazelcastManager.getMembers();
		IExecutorService executorService = hazelcastManager.getExecutorService();

		Member self = hazelcastManager.getSelf();

		for (Member m : currentMembers) {
			try {
				ReloadIndexSettingsTask rist = new ReloadIndexSettingsTask(m.getSocketAddress().getPort(), indexName);
				if (!self.equals(m)) {
					Future<Void> dt = executorService.submitToMember(rist, m);
					dt.get();
				}
				else {
					rist.call();
				}
			}
			catch (Exception e) {
				log.error(e.getClass().getSimpleName() + ": ", e);
			}

		}

		return IndexSettingsResponse.newBuilder().build();
	}
	finally {
		globalLock.readLock().unlock();
	}
}
 
开发者ID:lumongo,项目名称:lumongo,代码行数:41,代码来源:LumongoIndexManager.java

示例5: deleteIndex

import com.hazelcast.core.IExecutorService; //导入方法依赖的package包/类
public IndexDeleteResponse deleteIndex(IndexDeleteRequest request) throws Exception {
	globalLock.writeLock().lock();
	try {
		String indexName = request.getIndexName();

		LumongoIndex i = indexMap.get(indexName);
		if (i == null) {
			if (getIndexNames().contains(indexName)) {
				//TODO delete index from database
				return IndexDeleteResponse.newBuilder().build();
			}
			else {
				throw new IndexDoesNotExist(indexName);
			}
		}

		Set<Member> currentMembers = hazelcastManager.getMembers();
		IExecutorService executorService = hazelcastManager.getExecutorService();

		Member self = hazelcastManager.getSelf();

		log.info("Unload index <" + indexName + "> for delete");
		for (Member m : currentMembers) {
			try {
				UnloadIndexTask uit = new UnloadIndexTask(m.getSocketAddress().getPort(), indexName, true);
				if (!self.equals(m)) {
					Future<Void> dt = executorService.submitToMember(uit, m);
					dt.get();
				}
				else {
					uit.call();
				}
			}
			catch (Exception e) {
				log.error(e.getClass().getSimpleName() + ": ", e);
			}

		}

		log.info("Deleting index <" + indexName + ">");
		i.deleteIndex();
		indexMap.remove(indexName);

		return IndexDeleteResponse.newBuilder().build();
	}
	finally {
		globalLock.writeLock().unlock();
	}
}
 
开发者ID:lumongo,项目名称:lumongo,代码行数:50,代码来源:LumongoIndexManager.java


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