本文整理汇总了Java中com.hazelcast.core.HazelcastException类的典型用法代码示例。如果您正苦于以下问题:Java HazelcastException类的具体用法?Java HazelcastException怎么用?Java HazelcastException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
HazelcastException类属于com.hazelcast.core包,在下文中一共展示了HazelcastException类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: discoverNodes
import com.hazelcast.core.HazelcastException; //导入依赖的package包/类
@Override
public Iterable<DiscoveryNode> discoverNodes() {
List<DiscoveryNode> discoveryNodes = new ArrayList<DiscoveryNode>();
try {
Iterable<? extends NodeMetadata> nodes = computeServiceBuilder.getFilteredNodes();
for (NodeMetadata metadata : nodes) {
if (metadata.getStatus() != NodeMetadata.Status.RUNNING) {
continue;
}
discoveryNodes.add(buildDiscoveredNode(metadata));
}
if (discoveryNodes.isEmpty()) {
LOGGER.warning("No running nodes discovered in configured cloud provider.");
} else {
StringBuilder sb = new StringBuilder("Discovered the following nodes with public IPS:\n");
for (DiscoveryNode node : discoveryNodes) {
sb.append(" ").append(node.getPublicAddress().toString()).append("\n");
}
LOGGER.finest(sb.toString());
}
} catch (Exception e) {
throw new HazelcastException("Failed to get registered addresses", e);
}
return discoveryNodes;
}
开发者ID:hazelcast,项目名称:hazelcast-jclouds,代码行数:26,代码来源:JCloudsDiscoveryStrategy.java
示例2: whenInvalidAddress_thenHazelcastException
import com.hazelcast.core.HazelcastException; //导入依赖的package包/类
@Test(expected = HazelcastException.class)
public void whenInvalidAddress_thenHazelcastException() {
HashSet<String> privateAddresses = new HashSet<String>();
// invalid address
privateAddresses.add("257.0.0.1");
Set<NodeMetadata> nodes = new HashSet<NodeMetadata>();
nodes.add(new NodeMetadataImpl("", "", "dummyId",
null,
null,
new HashMap<String, String>(),
new HashSet<String>(),
null, null, null, null,
NodeMetadata.Status.RUNNING, "",
STARTING_PORT, privateAddresses, privateAddresses, null, "dummyHostName"));
ComputeServiceBuilder mockComputeServiceBuilder = mock(ComputeServiceBuilder.class);
doReturn(nodes).when(mockComputeServiceBuilder).getFilteredNodes();
JCloudsDiscoveryStrategy jCloudsDiscoveryStrategy = new JCloudsDiscoveryStrategy(mockComputeServiceBuilder);
jCloudsDiscoveryStrategy.discoverNodes();
}
开发者ID:hazelcast,项目名称:hazelcast-jclouds,代码行数:21,代码来源:JCloudsDiscoveryStrategyTest.java
示例3: urlEncode
import com.hazelcast.core.HazelcastException; //导入依赖的package包/类
public static String urlEncode(String string) {
String encoded;
try {
encoded = URLEncoder.encode(string, "UTF-8").replace("+", "%20");
} catch (UnsupportedEncodingException e) {
throw new HazelcastException(e);
}
return encoded;
}
开发者ID:hazelcast,项目名称:hazelcast-aws,代码行数:10,代码来源:AwsURLEncoder.java
示例4: afterInsert
import com.hazelcast.core.HazelcastException; //导入依赖的package包/类
@Override
public boolean afterInsert(final Object key, final Object value, final Object version) throws CacheException {
try {
return cache.insert(key, value, version);
} catch (HazelcastException e) {
if (log.isFinestEnabled()) {
log.finest("Could not insert into Cache[" + hazelcastRegion.getName() + "]: " + e.getMessage());
}
return false;
}
}
开发者ID:hazelcast,项目名称:hazelcast-hibernate5,代码行数:12,代码来源:ReadWriteAccessDelegate.java
示例5: afterUpdate
import com.hazelcast.core.HazelcastException; //导入依赖的package包/类
/**
* {@inheritDoc}
* <p/>
* Called after <code>com.hazelcast.ReadWriteAccessDelegate.lockItem()</code>
*/
@Override
public boolean afterUpdate(final Object key, final Object value, final Object currentVersion,
final Object previousVersion, final SoftLock lock) throws CacheException {
try {
return cache.update(key, value, currentVersion, lock);
} catch (HazelcastException e) {
if (log.isFinestEnabled()) {
log.finest("Could not update Cache[" + hazelcastRegion.getName() + "]: " + e.getMessage());
}
return false;
}
}
开发者ID:hazelcast,项目名称:hazelcast-hibernate5,代码行数:18,代码来源:ReadWriteAccessDelegate.java
示例6: remove
import com.hazelcast.core.HazelcastException; //导入依赖的package包/类
@Override
public void remove(final Object key) throws CacheException {
try {
cache.remove(key);
} catch (HazelcastException e) {
throw new CacheException("Operation timeout during remove operation from cache!", e);
}
}
开发者ID:hazelcast,项目名称:hazelcast-hibernate5,代码行数:9,代码来源:NonStrictReadWriteAccessDelegate.java
示例7: get
import com.hazelcast.core.HazelcastException; //导入依赖的package包/类
@Override
public Object get(final Object key, final long txTimestamp) throws CacheException {
try {
return cache.get(key, txTimestamp);
} catch (HazelcastException e) {
if (log.isFinestEnabled()) {
log.finest("Could not read from Cache[" + hazelcastRegion.getName() + "]: " + e.getMessage());
}
return null;
}
}
开发者ID:hazelcast,项目名称:hazelcast-hibernate5,代码行数:12,代码来源:AbstractAccessDelegate.java
示例8: putFromLoad
import com.hazelcast.core.HazelcastException; //导入依赖的package包/类
@Override
public boolean putFromLoad(final Object key, final Object value, final long txTimestamp,
final Object version) throws CacheException {
try {
return cache.put(key, value, txTimestamp, version);
} catch (HazelcastException e) {
if (log.isFinestEnabled()) {
log.finest("Could not put into Cache[" + hazelcastRegion.getName() + "]: " + e.getMessage());
}
return false;
}
}
开发者ID:hazelcast,项目名称:hazelcast-hibernate5,代码行数:13,代码来源:AbstractAccessDelegate.java
示例9: afterUpdate
import com.hazelcast.core.HazelcastException; //导入依赖的package包/类
/**
* {@inheritDoc}
* <p>
* Called after <code>com.hazelcast.ReadWriteAccessDelegate.lockItem()</code>
* </p>
*/
@Override
public boolean afterUpdate(final Object key, final Object value, final Object currentVersion, final Object previousVersion,
final SoftLock lock) throws CacheException {
try {
return cache.update(key, value, currentVersion, lock);
} catch (HazelcastException e) {
if (log.isFinestEnabled()) {
log.finest("Could not update Cache[" + hazelcastRegion.getName() + "]: " + e.getMessage());
}
return false;
}
}
开发者ID:hazelcast,项目名称:hazelcast-hibernate,代码行数:19,代码来源:ReadWriteAccessDelegate.java
示例10: put
import com.hazelcast.core.HazelcastException; //导入依赖的package包/类
protected boolean put(final Object key, final Object value, final Object currentVersion) {
try {
return cache.put(key, value, currentVersion);
} catch (HazelcastException e) {
LOG.log(Level.FINEST, "Could not put into Cache[" + hazelcastRegion.getName() + "]: " + e.getMessage());
return false;
}
}
开发者ID:health-and-care-developer-network,项目名称:health-and-care-developer-network,代码行数:9,代码来源:AbstractAccessDelegate.java
示例11: update
import com.hazelcast.core.HazelcastException; //导入依赖的package包/类
protected boolean update(final Object key, final Object value,
final Object currentVersion, final Object previousVersion, final SoftLock lock) {
try {
return cache.update(key, value, currentVersion, previousVersion, lock);
} catch (HazelcastException e) {
LOG.log(Level.FINEST, "Could not update Cache[" + hazelcastRegion.getName() + "]: " + e.getMessage());
return false;
}
}
开发者ID:health-and-care-developer-network,项目名称:health-and-care-developer-network,代码行数:10,代码来源:AbstractAccessDelegate.java
示例12: get
import com.hazelcast.core.HazelcastException; //导入依赖的package包/类
public Object get(final Object key, final long txTimestamp) throws CacheException {
try {
return cache.get(key);
} catch (HazelcastException e) {
LOG.log(Level.FINEST, "Could not read from Cache[" + hazelcastRegion.getName() + "]: " + e.getMessage());
return null;
}
}
开发者ID:health-and-care-developer-network,项目名称:health-and-care-developer-network,代码行数:9,代码来源:AbstractAccessDelegate.java
示例13: remove
import com.hazelcast.core.HazelcastException; //导入依赖的package包/类
public void remove(final Object key) throws CacheException {
try {
cache.remove(key);
} catch (HazelcastException e) {
throw new CacheException("Operation timeout during remove operation from cache!", e);
}
}
开发者ID:health-and-care-developer-network,项目名称:health-and-care-developer-network,代码行数:8,代码来源:AbstractAccessDelegate.java
示例14: throwUncheckedException
import com.hazelcast.core.HazelcastException; //导入依赖的package包/类
public static void throwUncheckedException(Throwable t) {
if (t instanceof Error) {
if (t instanceof OutOfMemoryError) {
OutOfMemoryErrorDispatcher.onOutOfMemory((OutOfMemoryError) t);
}
throw (Error) t;
} else if (t instanceof RuntimeException) {
throw (RuntimeException) t;
} else {
throw new HazelcastException(t);
}
}
开发者ID:health-and-care-developer-network,项目名称:health-and-care-developer-network,代码行数:13,代码来源:Util.java
示例15: testAfterInsert
import com.hazelcast.core.HazelcastException; //导入依赖的package包/类
@Test
public void testAfterInsert() {
when(cache.insert(any(), any(), any())).thenThrow(new HazelcastException("expected exception"));
assertFalse(delegate.afterInsert(null, null, null));
}
开发者ID:hazelcast,项目名称:hazelcast-hibernate5,代码行数:6,代码来源:ReadWriteAccessDelegateTest.java
示例16: testAfterUpdate
import com.hazelcast.core.HazelcastException; //导入依赖的package包/类
@Test
public void testAfterUpdate() {
when(cache.update(any(), any(), any(), any(SoftLock.class))).thenThrow(new HazelcastException("expected exception"));
assertFalse(delegate.afterUpdate(null, null, null, null, null));
}
开发者ID:hazelcast,项目名称:hazelcast-hibernate5,代码行数:6,代码来源:ReadWriteAccessDelegateTest.java
注:本文中的com.hazelcast.core.HazelcastException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论