Search in sources :

Example 1 with NodeExtension

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);
}
Also used : PartitionOperationThread(com.hazelcast.spi.impl.operationexecutor.impl.PartitionOperationThread) OperationRunner(com.hazelcast.spi.impl.operationexecutor.OperationRunner) HazelcastThreadGroup(com.hazelcast.instance.HazelcastThreadGroup) NodeExtension(com.hazelcast.instance.NodeExtension)

Example 2 with NodeExtension

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());
    }
}
Also used : NodeExtension(com.hazelcast.instance.NodeExtension) Map(java.util.Map) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) HashMap(java.util.HashMap) ConcurrentMap(java.util.concurrent.ConcurrentMap)

Example 3 with NodeExtension

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);
}
Also used : Node(com.hazelcast.instance.Node) NodeExtension(com.hazelcast.instance.NodeExtension)

Example 4 with NodeExtension

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);
}
Also used : AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) DefaultNodeExtension(com.hazelcast.instance.DefaultNodeExtension) HazelcastInstance(com.hazelcast.core.HazelcastInstance) Address(com.hazelcast.nio.Address) Config(com.hazelcast.config.Config) Node(com.hazelcast.instance.Node) DefaultNodeExtension(com.hazelcast.instance.DefaultNodeExtension) NodeExtension(com.hazelcast.instance.NodeExtension) TestHazelcastInstanceFactory(com.hazelcast.test.TestHazelcastInstanceFactory) MockNodeContext(com.hazelcast.test.mocknetwork.MockNodeContext) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 5 with NodeExtension

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);
}
Also used : Version(com.hazelcast.version.Version) MemberVersion(com.hazelcast.version.MemberVersion) ILogger(com.hazelcast.logging.ILogger) NodeExtension(com.hazelcast.instance.NodeExtension) Before(org.junit.Before)

Aggregations

NodeExtension (com.hazelcast.instance.NodeExtension)5 Node (com.hazelcast.instance.Node)2 Config (com.hazelcast.config.Config)1 HazelcastInstance (com.hazelcast.core.HazelcastInstance)1 DefaultNodeExtension (com.hazelcast.instance.DefaultNodeExtension)1 HazelcastThreadGroup (com.hazelcast.instance.HazelcastThreadGroup)1 ILogger (com.hazelcast.logging.ILogger)1 Address (com.hazelcast.nio.Address)1 OperationRunner (com.hazelcast.spi.impl.operationexecutor.OperationRunner)1 PartitionOperationThread (com.hazelcast.spi.impl.operationexecutor.impl.PartitionOperationThread)1 TestHazelcastInstanceFactory (com.hazelcast.test.TestHazelcastInstanceFactory)1 ParallelTest (com.hazelcast.test.annotation.ParallelTest)1 QuickTest (com.hazelcast.test.annotation.QuickTest)1 MockNodeContext (com.hazelcast.test.mocknetwork.MockNodeContext)1 MemberVersion (com.hazelcast.version.MemberVersion)1 Version (com.hazelcast.version.Version)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 ConcurrentMap (java.util.concurrent.ConcurrentMap)1