當前位置: 首頁>>代碼示例>>Java>>正文


Java Member.equals方法代碼示例

本文整理匯總了Java中com.hazelcast.core.Member.equals方法的典型用法代碼示例。如果您正苦於以下問題:Java Member.equals方法的具體用法?Java Member.equals怎麽用?Java Member.equals使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.hazelcast.core.Member的用法示例。


在下文中一共展示了Member.equals方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: openConnections

import com.hazelcast.core.Member; //導入方法依賴的package包/類
public void openConnections(Set<Member> members) throws Exception {

		globalLock.writeLock().lock();
		try {
			Member self = hazelcastManager.getSelf();
			for (Member m : members) {
				if (!self.equals(m)) {
					internalClient.addMember(m);
				}
			}
		}
		finally {
			globalLock.writeLock().unlock();
		}

	}
 
開發者ID:lumongo,項目名稱:lumongo,代碼行數:17,代碼來源:LumongoIndexManager.java

示例2: getNameForMember

import com.hazelcast.core.Member; //導入方法依賴的package包/類
/**
 * Gets the name for member.
 *
 * @param m
 *            the m
 * @param memberMap
 *            the member map
 * @return the name for member
 */
private String getNameForMember(Member m, IMap<String, Member> memberMap)
{
	for (String name : memberMap.keySet())
	{
		Member tm = memberMap.get(name);
		if (tm.equals(m))
		{
			return name;
		}
	}
	return null;
}
 
開發者ID:synergynet,項目名稱:synergynet3.1,代碼行數:22,代碼來源:ClusteredDeviceManager.java

示例3: getMember

import com.hazelcast.core.Member; //導入方法依賴的package包/類
private MemberImpl getMember(HazelcastInstance h, Member member) {
    for (Member m : h.getCluster().getMembers()) {
        if (m.equals(member)) {
            return (MemberImpl) m;
        }
    }
    return null;
}
 
開發者ID:mdogan,項目名稱:hazelcast-archive,代碼行數:9,代碼來源:RedoNoConnectionTest.java

示例4: updateIndex

import com.hazelcast.core.Member; //導入方法依賴的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: deleteDocument

import com.hazelcast.core.Member; //導入方法依賴的package包/類
public DeleteResponse deleteDocument(DeleteRequest deleteRequest) throws Exception {
	globalLock.readLock().lock();
	try {

		String indexName = deleteRequest.getIndexName();
		String uniqueId = deleteRequest.getUniqueId();

		LumongoIndex i = indexMap.get(indexName);
		if (i == null) {
			throw new IndexDoesNotExist(indexName);
		}

		Member m = i.findMember(uniqueId);

		Member self = hazelcastManager.getSelf();

		if (!self.equals(m)) {
			return internalClient.executeDelete(m, deleteRequest);
		}
		else {
			return internalDeleteDocument(deleteRequest);
		}

	}
	finally {
		globalLock.readLock().unlock();
	}
}
 
開發者ID:lumongo,項目名稱:lumongo,代碼行數:29,代碼來源:LumongoIndexManager.java

示例6: storeDocument

import com.hazelcast.core.Member; //導入方法依賴的package包/類
public StoreResponse storeDocument(StoreRequest storeRequest) throws Exception {
	globalLock.readLock().lock();
	try {

		String uniqueId = storeRequest.getUniqueId();
		String indexName = storeRequest.getIndexName();

		LumongoIndex i = indexMap.get(indexName);
		if (i == null) {
			throw new IndexDoesNotExist(indexName);
		}

		Member m = i.findMember(uniqueId);

		Member self = hazelcastManager.getSelf();

		if (!self.equals(m)) {
			return internalClient.executeStore(m, storeRequest);
		}
		else {
			return storeInternal(storeRequest);
		}

	}
	finally {
		globalLock.readLock().unlock();
	}

}
 
開發者ID:lumongo,項目名稱:lumongo,代碼行數:30,代碼來源:LumongoIndexManager.java

示例7: fetch

import com.hazelcast.core.Member; //導入方法依賴的package包/類
public FetchResponse fetch(FetchRequest request) throws Exception {
	globalLock.readLock().lock();
	try {

		String indexName = request.getIndexName();

		LumongoIndex i = indexMap.get(indexName);
		if (i == null) {
			throw new IndexDoesNotExist(indexName);
		}

		Member m = i.findMember(request.getUniqueId());

		Member self = hazelcastManager.getSelf();

		if (!self.equals(m)) {
			return internalClient.executeFetch(m, request);
		}
		else {
			return internalFetch(request);
		}

	}
	finally {
		globalLock.readLock().unlock();
	}
}
 
開發者ID:lumongo,項目名稱:lumongo,代碼行數:28,代碼來源:LumongoIndexManager.java

示例8: deleteIndex

import com.hazelcast.core.Member; //導入方法依賴的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

示例9: init

import com.hazelcast.core.Member; //導入方法依賴的package包/類
public void init(Set<HazelcastNode> nodes, String hazelcastName) throws Exception {

		// force Hazelcast to use log4j

		int hazelcastPort = localNodeConfig.getHazelcastPort();

		Config cfg = new Config();
		cfg.setProperty(GroupProperty.LOGGING_TYPE.getName(), "log4j");
		// disable Hazelcast shutdown hook to allow LuMongo to handle
		cfg.setProperty(GroupProperty.SHUTDOWNHOOK_ENABLED.getName(), "false");
		cfg.setProperty(GroupProperty.REST_ENABLED.getName(), "false");

		cfg.getGroupConfig().setName(hazelcastName);
		cfg.getGroupConfig().setPassword(hazelcastName);
		cfg.getNetworkConfig().setPortAutoIncrement(false);
		cfg.getNetworkConfig().setPort(hazelcastPort);
		cfg.setInstanceName("" + hazelcastPort);

		cfg.getManagementCenterConfig().setEnabled(false);

		NetworkConfig network = cfg.getNetworkConfig();
		JoinConfig joinConfig = network.getJoin();

		joinConfig.getMulticastConfig().setEnabled(false);
		joinConfig.getTcpIpConfig().setEnabled(true);
		for (HazelcastNode node : nodes) {
			joinConfig.getTcpIpConfig().addMember(node.getAddress() + ":" + node.getHazelcastPort());
		}

		hazelcastInstance = Hazelcast.newHazelcastInstance(cfg);
		self = hazelcastInstance.getCluster().getLocalMember();

		hazelcastInstance.getCluster().addMembershipListener(this);
		hazelcastInstance.getLifecycleService().addLifecycleListener(this);

		log.info("Initialized hazelcast");
		Set<Member> members = hazelcastInstance.getCluster().getMembers();

		Member firstMember = members.iterator().next();

		if (firstMember.equals(self)) {
			log.info("Member is owner of cluster");
			indexManager.loadIndexes();
		}

		log.info("Current cluster members: <" + members + ">");
		indexManager.openConnections(members);

		initLock.writeLock().unlock();

	}
 
開發者ID:lumongo,項目名稱:lumongo,代碼行數:52,代碼來源:HazelcastManager.java


注:本文中的com.hazelcast.core.Member.equals方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。