use of com.hazelcast.instance.NodeExtension in project hazelcast by hazelcast.
the class InterceptorRegistryTest method getPartitionOperationThread.
private PartitionOperationThread getPartitionOperationThread(OperationQueue queue) {
HazelcastThreadGroup threadGroup = new HazelcastThreadGroup("instanceName", LOGGER, getClass().getClassLoader());
NodeExtension nodeExtension = mock(NodeExtension.class);
OperationRunner operationRunner = mock(OperationRunner.class);
OperationRunner[] operationRunners = new OperationRunner[] { operationRunner };
return new PartitionOperationThread("threadName", 0, queue, LOGGER, threadGroup, nodeExtension, operationRunners);
}
use of com.hazelcast.instance.NodeExtension in project hazelcast by hazelcast.
the class ServiceManagerImpl method registerExtensionServices.
private void registerExtensionServices() {
logger.finest("Registering extension services...");
NodeExtension nodeExtension = nodeEngine.getNode().getNodeExtension();
Map<String, Object> services = nodeExtension.createExtensionServices();
for (Map.Entry<String, Object> entry : services.entrySet()) {
registerService(entry.getKey(), entry.getValue());
}
}
use of com.hazelcast.instance.NodeExtension in project hazelcast by hazelcast.
the class ServiceManagerImpl method createService.
private <T> T createService(Class<T> service) {
Node node = nodeEngine.getNode();
NodeExtension nodeExtension = node.getNodeExtension();
return nodeExtension.createService(service);
}
use of com.hazelcast.instance.NodeExtension in project hazelcast by hazelcast.
the class AdvancedClusterStateTest method changeClusterState_shouldFail_whenStartupIsNotCompleted.
@Test
public void changeClusterState_shouldFail_whenStartupIsNotCompleted() throws Exception {
TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory();
final AtomicBoolean startupDone = new AtomicBoolean(false);
HazelcastInstance instance = HazelcastInstanceFactory.newHazelcastInstance(new Config(), randomName(), new MockNodeContext(factory.getRegistry(), new Address("127.0.0.1", 5555)) {
@Override
public NodeExtension createNodeExtension(Node node) {
return new DefaultNodeExtension(node) {
@Override
public boolean isStartCompleted() {
return startupDone.get() && super.isStartCompleted();
}
};
}
});
try {
instance.getCluster().changeClusterState(ClusterState.FROZEN);
fail("Should not be able to change cluster state when startup is not completed yet!");
} catch (IllegalStateException expected) {
}
startupDone.set(true);
instance.getCluster().changeClusterState(ClusterState.FROZEN);
}
use of com.hazelcast.instance.NodeExtension in project hazelcast by hazelcast.
the class ClusterStateManagerTest method setup.
@Before
public void setup() {
NodeExtension nodeExtension = mock(NodeExtension.class);
when(nodeExtension.isStartCompleted()).thenReturn(true);
when(nodeExtension.isNodeVersionCompatibleWith(Matchers.any(Version.class))).thenReturn(true);
when(node.getPartitionService()).thenReturn(partitionService);
when(node.getClusterService()).thenReturn(clusterService);
when(node.getNodeExtension()).thenReturn(nodeExtension);
when(node.getLogger(ClusterStateManager.class)).thenReturn(mock(ILogger.class));
when(node.getVersion()).thenReturn(CURRENT_NODE_VERSION);
clusterStateManager = new ClusterStateManager(node, lock);
}
Aggregations