本文整理汇总了Java中com.hazelcast.instance.HazelcastInstanceImpl类的典型用法代码示例。如果您正苦于以下问题:Java HazelcastInstanceImpl类的具体用法?Java HazelcastInstanceImpl怎么用?Java HazelcastInstanceImpl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
HazelcastInstanceImpl类属于com.hazelcast.instance包,在下文中一共展示了HazelcastInstanceImpl类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import com.hazelcast.instance.HazelcastInstanceImpl; //导入依赖的package包/类
public static void main(String[] args) {
//System.setProperty("hazelcast.http.healthcheck.enabled", "true");
final HazelcastInstance hazelcastInstance = newHazelcastInstance();
HazelcastInstanceImpl hazelcastInstance1 = ((HazelcastInstanceProxy) hazelcastInstance).getOriginal();
final InternalPartitionService partitionService = hazelcastInstance1.node.getPartitionService();
boolean memberStateSafe = partitionService.isMemberStateSafe();
System.out.println("memberStateSafe = " + memberStateSafe);
boolean clusterSafe = memberStateSafe && !partitionService.hasOnGoingMigration();
System.out.println("clusterSafe = " + clusterSafe);
long migrationQueueSize = partitionService.getMigrationQueueSize();
System.out.println("migrationQueueSize = " + migrationQueueSize);
}
示例2: testAutoregistrationOnHibernate5Available
import com.hazelcast.instance.HazelcastInstanceImpl; //导入依赖的package包/类
@Test
public void testAutoregistrationOnHibernate5Available()
throws Exception {
HazelcastInstance hz = Hazelcast.newHazelcastInstance();
HazelcastInstanceImpl impl = (HazelcastInstanceImpl) ORIGINAL.get(hz);
SerializationService ss = impl.getSerializationService();
@SuppressWarnings("unchecked")
ConcurrentMap<Class, ?> typeMap = (ConcurrentMap) TYPE_MAP.get(ss);
boolean cacheEntrySerializerFound = false;
for (Class clazz : typeMap.keySet()) {
if (StandardCacheEntryImpl.class.equals(clazz)
|| "com.hazelcast.hibernate.serialization.CacheEntryImpl".equals(clazz.getName())) {
cacheEntrySerializerFound = true;
}
}
assertTrue("CacheEntry serializer not found", cacheEntrySerializerFound);
}
示例3: testAutoregistrationOnHibernate4Available
import com.hazelcast.instance.HazelcastInstanceImpl; //导入依赖的package包/类
@Test
public void testAutoregistrationOnHibernate4Available()
throws Exception {
HazelcastInstance hz = Hazelcast.newHazelcastInstance();
HazelcastInstanceImpl impl = (HazelcastInstanceImpl) ORIGINAL.get(hz);
SerializationService ss = impl.getSerializationService();
ConcurrentMap<Class, ?> typeMap = (ConcurrentMap<Class, ?>) TYPE_MAP.get(ss);
boolean cacheKeySerializerFound = false;
boolean cacheEntrySerializerFound = false;
for (Class clazz : typeMap.keySet()) {
if (clazz == CacheKey.class) {
cacheKeySerializerFound = true;
} else if (clazz == CacheEntry.class) {
cacheEntrySerializerFound = true;
}
}
assertTrue("CacheKey serializer not found", cacheKeySerializerFound);
assertTrue("CacheEntry serializer not found", cacheEntrySerializerFound);
}
示例4: testAutoregistrationOnHibernate3Available
import com.hazelcast.instance.HazelcastInstanceImpl; //导入依赖的package包/类
@Test
public void testAutoregistrationOnHibernate3Available()
throws Exception {
HazelcastInstance hz = Hazelcast.newHazelcastInstance();
HazelcastInstanceImpl impl = (HazelcastInstanceImpl) ORIGINAL.get(hz);
SerializationService ss = impl.getSerializationService();
ConcurrentMap<Class, ?> typeMap = (ConcurrentMap<Class, ?>) TYPE_MAP.get(ss);
boolean cacheKeySerializerFound = false;
boolean cacheEntrySerializerFound = false;
for (Class clazz : typeMap.keySet()) {
if (clazz == CacheKey.class) {
cacheKeySerializerFound = true;
} else if (clazz == CacheEntry.class) {
cacheEntrySerializerFound = true;
}
}
assertTrue("CacheKey serializer not found", cacheKeySerializerFound);
assertTrue("CacheEntry serializer not found", cacheEntrySerializerFound);
}
示例5: init
import com.hazelcast.instance.HazelcastInstanceImpl; //导入依赖的package包/类
@Override
public void init(@Nonnull Outbox outbox, @Nonnull Context context) {
logger = context.logger();
outbox = new LoggingOutbox(outbox, peekOutput, peekSnapshot);
// Fix issue #595: pass a logger with real class name to processor
// We do this only if context is ProcCtx (that is, not for tests where TestProcessorContext can be used
// and also other objects could be mocked or null, such as jetInstance())
if (context instanceof ProcCtx) {
ProcCtx c = (ProcCtx) context;
NodeEngine nodeEngine = ((HazelcastInstanceImpl) c.jetInstance().getHazelcastInstance()).node.nodeEngine;
ILogger newLogger = nodeEngine.getLogger(
createLoggerName(wrappedProcessor.getClass().getName(), c.vertexName(), c.globalProcessorIndex()));
context = new ProcCtx(c.jetInstance(), c.getSerializationService(), newLogger, c.vertexName(),
c.globalProcessorIndex(), c.processingGuarantee());
}
wrappedProcessor.init(outbox, context);
}
示例6: init
import com.hazelcast.instance.HazelcastInstanceImpl; //导入依赖的package包/类
private void init(List<Object> inputData) {
nodeEngine = ((HazelcastInstanceImpl) instance.getHazelcastInstance()).node.nodeEngine;
ssContext = new SnapshotContext(nodeEngine.getLogger(SnapshotContext.class), 1, 1, 1,
ProcessingGuarantee.EXACTLY_ONCE);
ssContext.initTaskletCount(1, 0);
inputData = new ArrayList<>(inputData);
// serialize input data
for (int i = 0; i < inputData.size(); i++) {
if (inputData.get(i) instanceof Entry) {
Entry<?, ?> en = (Entry<?, ?>) inputData.get(i);
inputData.set(i, entry(serialize(en.getKey()), serialize(en.getValue())));
}
}
input = new MockInboundStream(0, inputData, 1);
sst = new StoreSnapshotTasklet(ssContext, 1, input, nodeEngine, "myVertex", false);
}
示例7: setupSerialization
import com.hazelcast.instance.HazelcastInstanceImpl; //导入依赖的package包/类
protected void setupSerialization() {
// set up the serializer for the storage record if not already configured
SerializationService serializationService;
if (this.hazelcastInstance instanceof HazelcastInstanceImpl) {
serializationService = ((HazelcastInstanceImpl) this.hazelcastInstance).getSerializationService();
} else if (this.hazelcastInstance instanceof SerializationServiceSupport) {
serializationService = ((SerializationServiceSupport) this.hazelcastInstance).getSerializationService();
} else {
serializationService = null;
}
if (serializationService != null) {
try {
((AbstractSerializationService) serializationService).register(MutableStorageRecord.class, new MutableStorageRecordSerializer());
} catch (IllegalStateException e) {
logger.warn("Problem registering storage record serializer", e);
}
}
}
开发者ID:UniconLabs,项目名称:shibboleth-hazelcast-storage-service,代码行数:19,代码来源:AbstractHazelcastMapBackedStorageService.java
示例8: newJetInstance
import com.hazelcast.instance.HazelcastInstanceImpl; //导入依赖的package包/类
/**
* Creates a member of the Jet cluster with the given configuration.
*/
public static JetInstance newJetInstance(JetConfig config) {
configureJetService(config);
HazelcastInstanceImpl hazelcastInstance = ((HazelcastInstanceProxy)
Hazelcast.newHazelcastInstance(config.getHazelcastConfig())).getOriginal();
return new JetInstanceImpl(hazelcastInstance, config);
}
示例9: init
import com.hazelcast.instance.HazelcastInstanceImpl; //导入依赖的package包/类
@Override
public void init(NodeEngine engine, Properties properties) {
if (config == null) {
throw new IllegalStateException("JetConfig is not initialized");
}
jetInstance = new JetInstanceImpl((HazelcastInstanceImpl) engine.getHazelcastInstance(), config);
taskletExecutionService = new TaskletExecutionService(nodeEngine.getHazelcastInstance(),
config.getInstanceConfig().getCooperativeThreadCount());
snapshotRepository = new SnapshotRepository(jetInstance);
jobRepository = new JobRepository(jetInstance, snapshotRepository);
jobExecutionService = new JobExecutionService(nodeEngine, taskletExecutionService);
jobCoordinationService = new JobCoordinationService(nodeEngine, config, jobRepository,
jobExecutionService, snapshotRepository);
networking = new Networking(engine, jobExecutionService, config.getInstanceConfig().getFlowControlPeriodMs());
ClientEngineImpl clientEngine = engine.getService(ClientEngineImpl.SERVICE_NAME);
ExceptionUtil.registerJetExceptions(clientEngine.getClientExceptionFactory());
jobCoordinationService.init();
JetBuildInfo jetBuildInfo = BuildInfoProvider.getBuildInfo().getJetBuildInfo();
logger.info(String.format("Starting Jet %s (%s - %s)",
jetBuildInfo.getVersion(), jetBuildInfo.getBuild(), jetBuildInfo.getRevision()));
logger.info("Setting number of cooperative threads and default parallelism to "
+ config.getInstanceConfig().getCooperativeThreadCount());
logger.info('\n' +
"\to o o o---o o---o o o---o o o---o o-o-o o o---o o-o-o\n" +
"\t| | / \\ / | | | / \\ | | | | | \n" +
"\to---o o---o o o-o | o o---o o---o | | o-o | \n" +
"\t| | | | / | | | | | | | \\ | | | \n" +
"\to o o o o---o o---o o---o o---o o o o---o o o--o o---o o ");
logger.info("Copyright (c) 2008-2017, Hazelcast, Inc. All Rights Reserved.");
}
示例10: newMember
import com.hazelcast.instance.HazelcastInstanceImpl; //导入依赖的package包/类
public JetInstance newMember(JetConfig config, Address[] blockedAddresses) {
Jet.configureJetService(config);
HazelcastInstanceImpl hazelcastInstance =
((HazelcastInstanceProxy) (factory.newHazelcastInstance(config.getHazelcastConfig(), blockedAddresses)))
.getOriginal();
return new JetInstanceImpl(hazelcastInstance, config);
}
示例11: isInstanceActive
import com.hazelcast.instance.HazelcastInstanceImpl; //导入依赖的package包/类
private static boolean isInstanceActive(JetInstance instance) {
if (instance.getHazelcastInstance() instanceof HazelcastInstanceProxy) {
try {
((HazelcastInstanceProxy) instance.getHazelcastInstance()).getOriginal();
return true;
} catch (HazelcastInstanceNotActiveException exception) {
return false;
}
} else if (instance.getHazelcastInstance() instanceof HazelcastInstanceImpl) {
return getNode(instance.getHazelcastInstance()).getState() == NodeState.ACTIVE;
} else {
throw new AssertionError("Unsupported HazelcastInstance type");
}
}
示例12: getNodeEngine
import com.hazelcast.instance.HazelcastInstanceImpl; //导入依赖的package包/类
@Nonnull
private NodeEngine getNodeEngine(@Nonnull HazelcastInstance hazelcastInstance) {
return ExceptionUtils.execute(() -> {
// Ugly hack due to lack in SPI
//ACCESSIBILITY_HACK
Field originalField = HazelcastInstanceProxy.class.getDeclaredField("original");
originalField.setAccessible(true);
HazelcastInstanceImpl impl = (HazelcastInstanceImpl) originalField.get(hazelcastInstance);
return impl.node.getNodeEngine();
}, RETRIEVE_NODE_ENGINE_FAILED);
}
示例13: JetInstanceImpl
import com.hazelcast.instance.HazelcastInstanceImpl; //导入依赖的package包/类
public JetInstanceImpl(HazelcastInstanceImpl hazelcastInstance, JetConfig config) {
super(hazelcastInstance);
this.nodeEngine = hazelcastInstance.node.getNodeEngine();
this.config = config;
}
示例14: getManagedContext
import com.hazelcast.instance.HazelcastInstanceImpl; //导入依赖的package包/类
private ManagedContext getManagedContext() {
HazelcastInstanceImpl hazelcastInstance = (HazelcastInstanceImpl) getNodeEngine().getHazelcastInstance();
SerializationServiceImpl serializationService =
(SerializationServiceImpl) hazelcastInstance.getSerializationService();
return serializationService.getManagedContext();
}
示例15: getNode
import com.hazelcast.instance.HazelcastInstanceImpl; //导入依赖的package包/类
public static Node getNode(HazelcastInstance hz) {
HazelcastInstanceImpl impl = getHazelcastInstanceImpl(hz);
return impl != null ? impl.node : null;
}