本文整理了Java中com.hazelcast.core.IMap.isEmpty()
方法的一些代码示例,展示了IMap.isEmpty()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。IMap.isEmpty()
方法的具体详情如下:
包路径:com.hazelcast.core.IMap
类名称:IMap
方法名:isEmpty
暂无
代码示例来源:origin: hazelcast/hazelcast-jet
@Override
public boolean isEmpty() {
return map.isEmpty();
}
代码示例来源:origin: apache/marmotta
@Override
public boolean isEmpty() {
return delegate.isEmpty();
}
代码示例来源:origin: org.apache.marmotta/kiwi-caching-hazelcast
@Override
public boolean isEmpty() {
return delegate.isEmpty();
}
代码示例来源:origin: org.wso2.siddhi/siddhi-extension-event-table
@Override
public boolean isEmpty() {
return candidateDataMap.isEmpty();
}
代码示例来源:origin: hazelcast/hazelcast-code-samples
public void run() {
IMap map = hazelcast.getMap("myMap");
map.isEmpty();
}
}, 3);
代码示例来源:origin: mokies/ratelimitj
@Override
public boolean resetLimit(String key) {
IMap<Object, Object> map = hz.getMap(key);
if (map == null || map.isEmpty()) {
return false;
}
map.clear();
map.destroy();
return true;
}
代码示例来源:origin: hazelcast/hazelcast-code-samples
@Override
public void run(String... arg0) throws Exception {
IMap<String, String> helloMap = this.hazelcastInstance.getMap("hello");
if (!helloMap.isEmpty()) {
LOGGER.info("Skip loading '{}', not empty", helloMap.getName());
} else {
Arrays.stream(GREETINGS).forEach(pair -> {
helloMap.set(pair[0], pair[1]);
});
LOGGER.info("Loaded {} into '{}'", GREETINGS.length, helloMap.getName());
}
}
代码示例来源:origin: hazelcast/hazelcast-code-samples
/**
* <p>Spring will inject the {@code @Bean} objects in to the
* constructor. Use this as a convenient point to initialise
* maps rather than let this occur on first use.
* </p>
*
* @param hazelcastInstance Spring {@code @Bean}
* @param jetInstance Spring {@code @Bean}
*/
public ApplicationCLI(HazelcastInstance hazelcastInstance, JetInstance jetInstance) {
this.hazelcastInstance = hazelcastInstance;
this.jetInstance = jetInstance;
// Initialise all maps
for (String iMapName : Constants.IMAP_NAMES) {
this.hazelcastInstance.getMap(iMapName);
}
// Populate maps if needed, first member in cluster
IMap<String, Integer> stockMap = this.hazelcastInstance.getMap(Constants.IMAP_NAME_STOCK);
if (stockMap.isEmpty()) {
for (Object[] item : Constants.TESTDATA) {
String key = item[0].toString();
Integer value = Integer.valueOf(item[1].toString());
stockMap.set(key, value);
}
log.info("Loaded {} into IMap '{}'", Constants.TESTDATA.length, stockMap.getName());
}
}
代码示例来源:origin: hazelcast/hazelcast-code-samples
/**
* <P>
* List the contents of the maps.
* </P>
*/
@CliCommand(value = "list", help = "List the contents of the maps")
public void list() {
IMap<PersonKey, PersonValue> personMap = this.hazelcastInstance.getMap("person");
IMap<String, LifeValue> lifeMap = this.hazelcastInstance.getMap("life");
if (personMap.isEmpty()) {
System.out.println("Map 'person' is empty, run 'load' first");
}
if (lifeMap.isEmpty()) {
System.out.println("Map 'life' is empty, run 'join' first");
}
String[] mapNames = { "person", "deaths", "life" };
for (String mapName : mapNames) {
IMap<?, ?> map = this.hazelcastInstance.getMap(mapName);
System.out.printf("MAP : '%s'%n", mapName);
for (Object key : map.keySet()) {
System.out.printf(" => '%s' : '%s'%n", key, map.get(key));
}
System.out.printf("[%d row%s]%n", map.size(), (map.size() == 1 ? "" : "s"));
}
}
代码示例来源:origin: hazelcast/hazelcast-code-samples
/**
* <P>
* Search <U>keys</U> but return <U>values</U> from the <I>key-value</I> store.
* </P>
* <P>
* The only way this differs from a normal query is the key field is prefixed by
* "{@code __key}" to indicate it is a field in the key not the value.
* </P>
* <P>
* "{@code __key}" refers to the whole key.
* </P>
* <P>
* "{@code __key.lastName}" refers to one field in the key.
* </P>
*/
@CliCommand(value = "howard", help = "Find all people with last name 'Howard'")
@SuppressWarnings("unchecked")
public String howard() {
IMap<PersonKey, PersonValue> personMap = this.hazelcastInstance.getMap("person");
if (personMap.isEmpty()) {
return "Map is empty, run 'load' first";
}
Predicate<PersonKey, PersonValue> predicate = new SqlPredicate("__key.lastName = 'Howard'");
System.out.printf("PREDICATE : '%s'%n", predicate);
Collection<PersonValue> personValues = personMap.values(predicate);
personValues.forEach(personValue -> System.out.printf("PERSON : '%s'%n", personValue));
return String.format("[%d row%s]", personValues.size(), (personValues.size() == 1 ? "" : "s"));
}
代码示例来源:origin: hazelcast/hazelcast-code-samples
/**
* <P>
* For each entry in the <I>key-value</I> store, display which partition it is
* in, and which server JVM is currently hosting this partition.
* </P>
* <P>
* Try varying the number of JVMs in the cluster and rerunning. Entries stay in
* the same partition as they were, but this partition may move.
* </P>
*/
@CliCommand(value = "location", help = "Display the location of each entry")
public String location() {
IMap<PersonKey, PersonValue> personMap = this.hazelcastInstance.getMap("person");
if (personMap.isEmpty()) {
return "Map is empty, run 'load' first";
}
Set<PersonKey> keySet = personMap.keySet();
keySet.forEach(personKey -> {
System.out.printf("PERSON : '%s' : PARTITION '%s'%n", personKey,
this.hazelcastInstance.getPartitionService().getPartition(personKey));
});
return String.format("[%d row%s]", keySet.size(), (keySet.size() == 1 ? "" : "s"));
}
代码示例来源:origin: hazelcast/hazelcast-code-samples
if (personMap.isEmpty()) {
return "Map is empty, run 'load' first";
代码示例来源:origin: hazelcast/hazelcast-code-samples
/**
* Load the airport data into the airport map, once per cluster.
*/
private void loadAirports() {
IMap<String, Airport> airportsMap = hazelcastInstance.getMap(MyConstants.MAP_NAME_AIRPORTS);
if (!airportsMap.isEmpty()) {
log.info("Skip loading '{}', not empty", airportsMap.getName());
} else {
for (int i = 0; i < TestData.AIRPORTS.length; i++) {
Object[] airportData = TestData.AIRPORTS[i];
Airport airport = new Airport();
airport.setCode(airportData[0].toString());
airport.setDescription(airportData[1].toString());
airport.setLatitude(Double.parseDouble(airportData[2].toString()));
airport.setLongitude(Double.parseDouble(airportData[3].toString()));
airportsMap.put(airport.getCode(), airport);
}
log.info("Loaded {} into '{}'", TestData.AIRPORTS.length, airportsMap.getName());
}
}
}
代码示例来源:origin: hazelcast/hazelcast-code-samples
if (lifeMap.isEmpty()) {
return "Map is empty, run 'join' first";
代码示例来源:origin: hazelcast/hazelcast-code-samples
/**
* <P>
* Use a Jet pipeline to join two maps into a third. Essentially, materialising
* a view.
* </P>
*/
@CliCommand(value = "join", help = "Join birth with death to produce life")
public String join() {
IMap<PersonKey, PersonValue> personMap = this.hazelcastInstance.getMap("person");
IMap<String, LifeValue> lifeMap = this.hazelcastInstance.getMap("life");
if (personMap.isEmpty()) {
return "Map is empty, run 'load' first";
}
// Remove old results
lifeMap.clear();
// Prepare the execution plan
Pipeline pipeline = MyJoinPipeline.build();
// Run the join
System.out.println("Running : " + pipeline);
this.jetInstance.newJob(pipeline).join();
return "Done";
}
代码示例来源:origin: com.hazelcast.simulator/tests-common
@Verify
public void verify() {
if (removeOnStop) {
assertEquals("Map should be empty, but has size: ", 0, map.size());
assertTrue("Map should be empty, but has size: ", map.isEmpty());
}
}
代码示例来源:origin: com.hazelcast.stabilizer/stabilizer
@Verify
public void verify() throws Exception {
if(removeOnStop){
assertEquals("Map should be empty, but has size:", 0, map.size());
assertTrue("Map should be empty, but has size:", map.isEmpty());
}
}
代码示例来源:origin: datasalt/splout-db
/**
* Return true if one or more of the DNodes reported an error.
*/
private boolean checkForFailure() {
IMap<String, String> deployErrorPanel = context.getCoordinationStructures().getDeployErrorPanel(
version);
if (!isReplicaBalancingEnabled) {
return !deployErrorPanel.isEmpty();
}
// If replica balancing is enabled we check whether we could survive after the failed DNodes
Set<String> failedDNodes = new HashSet<String>(deployErrorPanel.keySet());
// Check if deploy needs to be canceled or if the system could auto-rebalance itself afterwards
for (DeployRequest deployRequest : deployRequests) {
for (ReplicationEntry repEntry : deployRequest.getReplicationMap()) {
if (failedDNodes.containsAll(repEntry.getNodes())) {
// There is AT LEAST one partition that depends on the failed DNodes so the deploy must fail!
return true;
}
}
}
return false;
}
} /* End ManageDeploy */
代码示例来源:origin: org.apache.karaf.cellar/org.apache.karaf.cellar.hazelcast
if (hazelcastGroupsConfig.isEmpty()) {
代码示例来源:origin: apache/karaf-cellar
if (hazelcastGroupsConfig.isEmpty()) {
内容来源于网络,如有侵权,请联系作者删除!