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


Java DistributedObject类代码示例

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


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

示例1: removeClient

import com.hazelcast.core.DistributedObject; //导入依赖的package包/类
private boolean removeClient(String clientId) {
	String qName = "client:" + clientId;
	boolean removed = false;
	java.util.Collection<DistributedObject> all = hzInstance.getDistributedObjects();
	int sizeBefore = all.size();
	for (DistributedObject obj: all) {
		if (qName.equals(obj.getName()) && QueueService.SERVICE_NAME.equals(obj.getServiceName())) {
			// remove queue
			obj.destroy();
			removed = true;
			break;
		}
	}
	int sizeAfter = hzInstance.getDistributedObjects().size(); 
	logger.debug("removeClient.exit; queue {} {} for client: {}; size before: {}, after: {}", 
			qName, removed ? "destroyed" : "skipped", clientId, sizeBefore, sizeAfter); 
	return removed;
}
 
开发者ID:dsukhoroslov,项目名称:bagri,代码行数:19,代码来源:ClientManagementImpl.java

示例2: tearDown

import com.hazelcast.core.DistributedObject; //导入依赖的package包/类
@After
public void tearDown() {
	for (String mapName : TestConstants.OSCAR_MAP_NAMES) {
		IMap<String, ?> iMap = this.hazelcastInstance.getMap(mapName);
		iMap.clear();
	}
	
	checkMapsEmpty("tearDown");

	Collection<DistributedObject> distributedObjects = this.hazelcastInstance.getDistributedObjects();
	
	for (DistributedObject distributedObject : distributedObjects) {
		assertThat(distributedObject.getName(), distributedObject, instanceOf(IMap.class));
		assertThat(distributedObject.getName(), isIn(TestConstants.OSCAR_MAP_NAMES));
	}

	assertThat("Correct number of distributed objects",
			distributedObjects.size(), equalTo(TestConstants.OSCAR_MAP_NAMES.length));

}
 
开发者ID:hazelcast,项目名称:spring-data-hazelcast,代码行数:21,代码来源:TestDataHelper.java

示例3: verify

import com.hazelcast.core.DistributedObject; //导入依赖的package包/类
@Verify
public void verify() {
    String serviceName = totalCounter.getServiceName();
    String totalName = totalCounter.getName();

    long actual = 0;
    for (DistributedObject distributedObject : targetInstance.getDistributedObjects()) {
        String key = distributedObject.getName();
        if (serviceName.equals(distributedObject.getServiceName())
                && key.startsWith(name)
                && !key.equals(totalName)) {
            actual += targetInstance.getAtomicLong(key).get();
        }
    }

    assertEquals(totalCounter.get(), actual);
}
 
开发者ID:hazelcast,项目名称:hazelcast-simulator,代码行数:18,代码来源:AtomicLongTest.java

示例4: getMapNames

import com.hazelcast.core.DistributedObject; //导入依赖的package包/类
public List<String> getMapNames() {

        return hazelcastInstance
                .getDistributedObjects()
                .stream()
                .filter(e -> e.getServiceName().equals(MapService.SERVICE_NAME))
                .map(DistributedObject::getName)
                .collect(Collectors.toList());
    }
 
开发者ID:francescou,项目名称:hazelcast-shell-spring-boot-starter,代码行数:10,代码来源:HazelcastService.java

示例5: clearAllCaches

import com.hazelcast.core.DistributedObject; //导入依赖的package包/类
public void clearAllCaches(){
    final Collection<DistributedObject> distributedObjects = hazelcastInstance.getDistributedObjects();
    for (DistributedObject distributedObject : distributedObjects) {
        if (distributedObject instanceof IMap) {
            final IMap<?, ?> map = (IMap) distributedObject;
            map.clear();
        }
    }
}
 
开发者ID:sastix,项目名称:cms,代码行数:10,代码来源:HazelcastDistributedCacheManager.java

示例6: clearAllCachesExcept

import com.hazelcast.core.DistributedObject; //导入依赖的package包/类
public void clearAllCachesExcept(List<String> cacheRegions){
    final Collection<DistributedObject> distributedObjects = hazelcastInstance.getDistributedObjects();
    for (DistributedObject distributedObject : distributedObjects) {
        if (distributedObject instanceof IMap) {
            final IMap<?, ?> map = (IMap) distributedObject;
            String region = map.getName();
            boolean exists = cacheRegions.stream().filter(s->region.contains(s)).count()>0;
            if(!exists) {
                map.clear();
            }
        }
    }
}
 
开发者ID:sastix,项目名称:cms,代码行数:14,代码来源:HazelcastDistributedCacheManager.java

示例7: read

import com.hazelcast.core.DistributedObject; //导入依赖的package包/类
@RequestMapping(method = RequestMethod.GET)
public ResponseEntity<?> read(@RequestBody(required = false) String input) {

	StringBuilder sb = new StringBuilder();
	sb.append("{");

	for (HazelcastInstance hazelInst : Hazelcast.getAllHazelcastInstances()) {
		Iterator<Member> iter = hazelInst.getCluster().getMembers().iterator();
		while (iter.hasNext()) {
			sb.append("\"member\": \"");
			sb.append(iter.next().getAddress());
			sb.append("\"");
		}
		sb.append(",\"name\": \"");
		sb.append(hazelInst.getName());
		sb.append("\"");

		// IMap map = hz.getMap( "test" );
		Collection<DistributedObject> objects = hazelInst.getDistributedObjects();
		for (DistributedObject distributedObject : objects) {
			if (distributedObject instanceof IMap) {
				sb.append(",\"mapName\": \"");
				sb.append(distributedObject.getName());
				sb.append("\"");
			}
		}
	}

	sb.append("}");

	return ResponseEntity.ok(sb.toString());
}
 
开发者ID:eetlite,项目名称:eet.osslite.cz,代码行数:33,代码来源:HazelcastAdminRest.java

示例8: sendDashboardNotificationEventIfExists

import com.hazelcast.core.DistributedObject; //导入依赖的package包/类
public static void sendDashboardNotificationEventIfExists(DashboardNotificationEvent dashboardNotificationEvent) {
    Collection<DistributedObject> instances = hazelcastInstance.getDistributedObjects();
    for (DistributedObject instance : instances) {
        if (instance.getServiceName().equals("hz:impl:topicService") && instance.getName().equals(dashboardNotificationEvent.getReceiverName())) {
            sendDashboardNotificationEvent(dashboardNotificationEvent);
        }
    }
}
 
开发者ID:hybridbpm,项目名称:hybridbpm,代码行数:9,代码来源:HazelcastServer.java

示例9: getDistributedObjects

import com.hazelcast.core.DistributedObject; //导入依赖的package包/类
/**
 * Reads an entry from the multi-map
 * invoke: HzClient.readValuesFromMultiMap("my-distributed-map", "sample-key");
 *
 * @return the values of the entry.
 */
public static Collection<DistributedObject> getDistributedObjects() {
    Collection<DistributedObject> distributedObjects = clientInstance.getDistributedObjects();

    for (DistributedObject distributedObject: distributedObjects) {
        logger.info(distributedObject.getName());
    }
    return distributedObjects;
}
 
开发者ID:sharmalab,项目名称:datacafe,代码行数:15,代码来源:HzClient.java

示例10: getCacheNames

import com.hazelcast.core.DistributedObject; //导入依赖的package包/类
@Override
public Iterable<String> getCacheNames() {
    if (this.hcInstance != null) {
        Collection<DistributedObject> distributedObjects = hcInstance.getDistributedObjects();
        ArrayList<String> names = new ArrayList<String>(distributedObjects.size());
        for (DistributedObject distributedObject : distributedObjects) {
            names.add(distributedObject.getName());
        }
        return names;
    } else {
        return new ArrayList<String>(0);
    }
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:14,代码来源:HazelcastMemoryService.java

示例11: resetCachers

import com.hazelcast.core.DistributedObject; //导入依赖的package包/类
@Override
public void resetCachers() {
    if (!getSecurityService().isSuperUser()) {
        throw new SecurityException("Only super admin can reset cachers, current user not super admin");
    }
    if (this.hcInstance != null) {
        Collection<DistributedObject> distributedObjects = hcInstance.getDistributedObjects();
        for (DistributedObject distributedObject : distributedObjects) {
            if (distributedObject instanceof IMap) {
                ((IMap)distributedObject).clear();
            }
        }
    }
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:15,代码来源:HazelcastMemoryService.java

示例12: findDistributedObject

import com.hazelcast.core.DistributedObject; //导入依赖的package包/类
private boolean findDistributedObject(String serviceName, String objectName) {
	HazelcastInstance hzi = ((SchemaRepositoryImpl) xRepo).getHzInstance();
	for (DistributedObject svc: hzi.getDistributedObjects()) {
		if (objectName.equals(svc.getName())) {
			if (serviceName == null) {
				return true;
			} else if (serviceName.equals(svc.getServiceName())) {
				return true;
			}
		}
	}
	return false;
}
 
开发者ID:dsukhoroslov,项目名称:bagri,代码行数:14,代码来源:ResultCursorTest.java

示例13: setUp

import com.hazelcast.core.DistributedObject; //导入依赖的package包/类
@Before
public void setUp() {
	assertThat("Correct Hazelcast instance", this.hazelcastInstance.getName(),
			equalTo(Constants.HAZELCAST_INSTANCE_NAME));

	checkMapsEmpty("setUp");

	this.makeupMap = this.hazelcastInstance.getMap(TestConstants.MAKEUP_MAP_NAME);
	loadMakeup(this.makeupMap);

	this.movieMap = this.hazelcastInstance.getMap(TestConstants.MOVIE_MAP_NAME);
	loadMovie(this.movieMap);
	
	this.personMap = this.hazelcastInstance.getMap(TestConstants.PERSON_MAP_NAME);
	loadPerson(this.personMap);
	
	this.songMap = this.hazelcastInstance.getMap(TestConstants.SONG_MAP_NAME);
	loadSong(this.songMap);
	
	checkMapsNotEmpty("setUp");

	/* As Hazelcast will create objects on demand, check no more are present
	 * than should be.
	 */
	Collection<DistributedObject> distributedObjects = this.hazelcastInstance.getDistributedObjects();
	assertThat("Correct number of distributed objects",
			distributedObjects.size(), equalTo(TestConstants.OSCAR_MAP_NAMES.length));
}
 
开发者ID:hazelcast,项目名称:spring-data-hazelcast,代码行数:29,代码来源:TestDataHelper.java

示例14: verify

import com.hazelcast.core.DistributedObject; //导入依赖的package包/类
@Verify
public void verify() {
    if (isClient(targetInstance)) {
        return;
    }

    final String serviceName = totalCounter.getServiceName();
    final long expected = totalCounter.get();

    // since the operations are asynchronous, we have no idea when they complete
    assertTrueEventually(new AssertTask() {
        @Override
        public void run() throws Exception {
            // hack to prevent overloading the system with get calls, else it is done many times a second
            sleepSeconds(10);

            long actual = 0;
            for (DistributedObject distributedObject : targetInstance.getDistributedObjects()) {
                String key = distributedObject.getName();
                if (serviceName.equals(distributedObject.getServiceName()) && key.startsWith(name)) {
                    actual += targetInstance.getAtomicLong(key).get();
                }
            }

            assertEquals(expected, actual);
        }
    }, assertEventuallySeconds);
}
 
开发者ID:hazelcast,项目名称:hazelcast-simulator,代码行数:29,代码来源:AsyncAtomicLongTest.java

示例15: subscribe

import com.hazelcast.core.DistributedObject; //导入依赖的package包/类
@Override
public void subscribe(final HazelcastInstance hzInstance,final HzEventBusTerminal terminal) {
    m_hzInstance = hzInstance;
    m_terminal   = terminal;

    if(m_terminal != null && m_hzInstance != null) {
        m_hzInstance.addDistributedObjectListener(this);
    }

    for(DistributedObject object : m_hzInstance.getDistributedObjects()) {
        if(object instanceof ITopic) {
            subscribeTopic(object);
        }
    }
}
 
开发者ID:lburgazzoli,项目名称:lb-axon,代码行数:16,代码来源:DynamicSubscriber.java


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