• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java EntryView类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: merge

import com.hazelcast.core.EntryView; //导入依赖的package包/类
@Override
public Object merge(final String mapName, final EntryView mergingEntry, final EntryView existingEntry) {
    final Object existingValue = existingEntry != null ? existingEntry.getValue() : null;
    final Object mergingValue = mergingEntry.getValue();
    if (existingValue != null && existingValue instanceof CacheEntry
            && mergingValue != null && mergingValue instanceof CacheEntry) {

        final CacheEntry existingCacheEntry = (CacheEntry) existingValue;
        final CacheEntry mergingCacheEntry = (CacheEntry) mergingValue;
        final Object mergingVersionObject = mergingCacheEntry.getVersion();
        final Object existingVersionObject = existingCacheEntry.getVersion();
        if (mergingVersionObject != null && existingVersionObject != null
                && mergingVersionObject instanceof Comparable && existingVersionObject instanceof Comparable) {

            final Comparable mergingVersion = (Comparable) mergingVersionObject;
            final Comparable existingVersion = (Comparable) existingVersionObject;

            if (mergingVersion.compareTo(existingVersion) > 0) {
                return mergingValue;
            } else {
                return existingValue;
            }
        }
    }
    return mergingValue;
}
 
开发者ID:hazelcast,项目名称:hazelcast-hibernate5,代码行数:27,代码来源:VersionAwareMapMergePolicy.java


示例2: merge

import com.hazelcast.core.EntryView; //导入依赖的package包/类
public Object merge(String mapName, EntryView mergingEntry, EntryView existingEntry) {
    final Object existingValue = existingEntry != null ? existingEntry.getValue() : null;
    final Object mergingValue = mergingEntry.getValue();
    if (existingValue != null && existingValue instanceof CacheEntry
            && mergingValue != null && mergingValue instanceof CacheEntry) {

        final CacheEntry existingCacheEntry = (CacheEntry) existingValue;
        final CacheEntry mergingCacheEntry = (CacheEntry) mergingValue;
        final Object mergingVersionObject = mergingCacheEntry.getVersion();
        final Object existingVersionObject = existingCacheEntry.getVersion();
        if (mergingVersionObject != null && existingVersionObject != null
                && mergingVersionObject instanceof Comparable && existingVersionObject instanceof Comparable) {

            final Comparable mergingVersion = (Comparable) mergingVersionObject;
            final Comparable existingVersion = (Comparable) existingVersionObject;

            if (mergingVersion.compareTo(existingVersion) > 0) {
                return mergingValue;
            } else {
                return existingValue;
            }
        }
    }
    return mergingValue;
}
 
开发者ID:hazelcast,项目名称:hazelcast-hibernate,代码行数:26,代码来源:VersionAwareMapMergePolicy.java


示例3: getSizeInMemory

import com.hazelcast.core.EntryView; //导入依赖的package包/类
@Override
public long getSizeInMemory() {
    long size = 0;
    for (final Object key : map.keySet()) {
        final EntryView entry = map.getEntryView(key);
        if (entry != null) {
            size += entry.getCost();
        }
    }
    return size;
}
 
开发者ID:hazelcast,项目名称:hazelcast-hibernate5,代码行数:12,代码来源:IMapRegionCache.java


示例4: merge_mergingUptodate

import com.hazelcast.core.EntryView; //导入依赖的package包/类
@Test
public void merge_mergingUptodate() {
    CacheEntry existing = cacheEntryWithVersion(versionOld);
    CacheEntry merging = cacheEntryWithVersion(versionNew);

    EntryView entryExisting = entryWithGivenValue(existing);
    EntryView entryMerging = entryWithGivenValue(merging);

    assertEquals(merging, policy.merge("map", entryMerging, entryExisting));
}
 
开发者ID:hazelcast,项目名称:hazelcast-hibernate5,代码行数:11,代码来源:VersionAwareMapMergePolicyTest.java


示例5: merge_mergingStale

import com.hazelcast.core.EntryView; //导入依赖的package包/类
@Test
public void merge_mergingStale() {
    CacheEntry existing = cacheEntryWithVersion(versionNew);
    CacheEntry merging = cacheEntryWithVersion(versionOld);

    EntryView entryExisting = entryWithGivenValue(existing);
    EntryView entryMerging = entryWithGivenValue(merging);

    assertEquals(existing, policy.merge("map", entryMerging, entryExisting));
}
 
开发者ID:hazelcast,项目名称:hazelcast-hibernate5,代码行数:11,代码来源:VersionAwareMapMergePolicyTest.java


示例6: merge_mergingNull

import com.hazelcast.core.EntryView; //导入依赖的package包/类
@Test
public void merge_mergingNull() {
    CacheEntry existing = null;
    CacheEntry merging = cacheEntryWithVersion(versionNew);

    EntryView entryExisting = entryWithGivenValue(existing);
    EntryView entryMerging = entryWithGivenValue(merging);

    assertEquals(merging, policy.merge("map", entryMerging, entryExisting));
}
 
开发者ID:hazelcast,项目名称:hazelcast-hibernate5,代码行数:11,代码来源:VersionAwareMapMergePolicyTest.java


示例7: entryWithGivenValue

import com.hazelcast.core.EntryView; //导入依赖的package包/类
private EntryView entryWithGivenValue(Object value) {
    EntryView entryView = mock(EntryView.class);
    try {
        when(entryView.getValue()).thenReturn(value);
        return entryView;
    } catch (Exception e) {
        throw new RuntimeException(e);
    }

}
 
开发者ID:hazelcast,项目名称:hazelcast-hibernate5,代码行数:11,代码来源:VersionAwareMapMergePolicyTest.java


示例8: getStatistics

import com.hazelcast.core.EntryView; //导入依赖的package包/类
@RequestMapping(method = RequestMethod.GET, path = "/statistics")
@ResponseBody
private ResponseEntity<?> getStatistics(@RequestParam("key") String mapKey, @RequestParam("view") String viewKey) {
	EntryView<?, ?> entry = inst.getMap(mapKey).getEntryView(viewKey);

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

	sb.append("\"size_in_memory\" : ");
	sb.append(entry.getCost());
	sb.append(",\"creationTime\" : \"");
	sb.append(entry.getCreationTime());
	sb.append("\"");
	sb.append(",\"expirationTime\" : \"");
	sb.append(entry.getExpirationTime());
	sb.append("\"");
	sb.append(",\"number of hits\" : ");
	sb.append(entry.getHits());
	sb.append(",\"lastAccessedTime\" : \"");
	sb.append(entry.getLastAccessTime());
	sb.append("\"");
	sb.append(",\"lastUpdateTime\" : \"");
	sb.append(entry.getLastUpdateTime());
	sb.append("\"");
	sb.append(",\"version\" : \"");
	sb.append(entry.getVersion());
	sb.append("\"");
	sb.append(",\"key\" : \"");
	sb.append(entry.getKey());
	sb.append("\"");
	sb.append(",\"value\" : \"");
	sb.append(entry.getValue());
	sb.append("\"");

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


示例9: getSizeInMemory

import com.hazelcast.core.EntryView; //导入依赖的package包/类
public long getSizeInMemory() {
    long size = 0;
    for (final Object key : map.keySet()) {
        final EntryView entry = map.getEntryView(key);
        if (entry != null) {
            size += entry.getCost();
        }
    }
    return size;
}
 
开发者ID:hazelcast,项目名称:hazelcast-hibernate,代码行数:11,代码来源:IMapRegionCache.java


示例10: cleanup

import com.hazelcast.core.EntryView; //导入依赖的package包/类
/**
 * Cleans up stale job records, execution ids and job resources.
 */
void cleanup(Set<Long> runningJobIds) {
    // clean up completed jobRecords
    Set<Long> completedJobIds = jobResults.keySet();
    completedJobIds.forEach(this::deleteJob);

    Set<Long> validJobIds = new HashSet<>();
    validJobIds.addAll(completedJobIds);
    validJobIds.addAll(runningJobIds);
    validJobIds.addAll(jobRecords.keySet());

    // Job ids are never cleaned up.
    // We also don't clean up job records here because they might be started in parallel while cleanup is running
    // If a job id is not running or is completed it might be suitable to clean up job resources
    randomIds.keySet(new FilterJobIdPredicate())
             .stream()
             .filter(jobId -> !validJobIds.contains(jobId))
             .forEach(jobId -> {
                 IMap<String, Object> resources = getJobResources(jobId);
                 if (resources.isEmpty()) {
                     return;
                 }

                 EntryView<String, Object> marker = resources.getEntryView(RESOURCE_MARKER);
                 // If the marker is absent, then job resources may be still uploaded.
                 // Just put the marker so that the job resources may be cleaned up eventually.
                 // If the job resources are still being uploaded, then the marker will be overwritten, which is ok.
                 if (marker == null) {
                     resources.putIfAbsent(RESOURCE_MARKER, RESOURCE_MARKER);
                 } else if (isJobRecordExpired(marker.getCreationTime())) {
                     cleanupJobResourcesAndSnapshots(jobId, resources);
                 }
             });
}
 
开发者ID:hazelcast,项目名称:hazelcast-jet,代码行数:37,代码来源:JobRepository.java


示例11: getEntryView

import com.hazelcast.core.EntryView; //导入依赖的package包/类
@Override
public EntryView<K, V> getEntryView(K key) {
    return map.getEntryView(key);
}
 
开发者ID:hazelcast,项目名称:hazelcast-jet,代码行数:5,代码来源:MapDecorator.java


示例12: isTxVisible

import com.hazelcast.core.EntryView; //导入依赖的package包/类
public boolean isTxVisible(long txId) throws BagriException {
	if (txId <= TX_INIT) {
		return true;
	}

	long cTx = getCurrentTxId();
	if (txId == cTx) {
		// current tx;
		return true;
	}
	
	Transaction xTx;
	TransactionIsolation txIsolation;
	if (cTx != TX_NO) {
		// can not be null!
		xTx = txCache.get(cTx);
		if (xTx == null) {
			throw new BagriException("Can not find current Transaction with txId " + cTx + "; txId: " + txId, ecTransNotFound);
		}

		// current tx is already finished!
		if (xTx.getTxState() != TransactionState.started) {
			throw new BagriException("Current Transaction is already " + xTx.getTxState(), ecTransWrongState);
		}
			
		txIsolation = xTx.getTxIsolation(); 
		if (txIsolation == TransactionIsolation.dirtyRead) {
			// current tx is dirtyRead, can see not-committed tx results
			return true;
		}
	} else {
		// default isolation level
		txIsolation = TransactionIsolation.readCommited;
	}
	
	//xTx = txCache.get(txId);
	//boolean commited = xTx == null || xTx.getTxState() == TransactionState.commited;
	EntryView<Long, Transaction> eTx = txCache.getEntryView(txId);
	boolean commited = eTx == null || eTx.getValue() == null || 
			eTx.getValue().getTxState() == TransactionState.commited;
	if (txIsolation == TransactionIsolation.readCommited) {
		return commited;
	}

	// txIsolation is repeatableRead or serializable
	if (txId > cTx) {
		// the tx started after current, so it is not visible
		// for current tx
		return false;
	}
	return commited; 
}
 
开发者ID:dsukhoroslov,项目名称:bagri,代码行数:53,代码来源:TransactionManagementImpl.java


示例13: getEntryView

import com.hazelcast.core.EntryView; //导入依赖的package包/类
@Override
public EntryView getEntryView(Object key) {
    return null;
}
 
开发者ID:gurbuzali,项目名称:hazel-local-cache,代码行数:5,代码来源:LocalCacheProxy.java


示例14: getEntryView

import com.hazelcast.core.EntryView; //导入依赖的package包/类
/**
 * {@inheritDoc}
 *
 * @deprecated not implemented yet
 * @throws UnsupportedOperationException not implemented yet
 */
@Deprecated
@Override
public EntryView<K, V> getEntryView(K key) {
    throw new UnsupportedOperationException();
}
 
开发者ID:ravikumaran2015,项目名称:ravikumaran201504,代码行数:12,代码来源:SMap.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java IoActions类代码示例发布时间:2022-05-23
下一篇:
Java Other类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap