Search in sources :

Example 61 with NodeEngine

use of com.hazelcast.spi.impl.NodeEngine in project hazelcast by hazelcast.

the class QueueProxyImpl method peek.

@Override
public E peek() {
    final NodeEngine nodeEngine = getNodeEngine();
    final Object data = peekInternal();
    return nodeEngine.toObject(data);
}
Also used : NodeEngine(com.hazelcast.spi.impl.NodeEngine) InitializingObject(com.hazelcast.spi.impl.InitializingObject)

Example 62 with NodeEngine

use of com.hazelcast.spi.impl.NodeEngine in project hazelcast by hazelcast.

the class OnJoinOp method beforeRun.

@Override
public void beforeRun() throws Exception {
    if (!operations.isEmpty()) {
        NodeEngine nodeEngine = getNodeEngine();
        OperationResponseHandler responseHandler = createErrorLoggingResponseHandler(getLogger());
        for (Operation op : operations) {
            op.setNodeEngine(nodeEngine);
            op.setOperationResponseHandler(responseHandler);
            OperationAccessor.setCallerAddress(op, getCallerAddress());
            OperationAccessor.setConnection(op, getConnection());
        }
    }
}
Also used : NodeEngine(com.hazelcast.spi.impl.NodeEngine) Operation(com.hazelcast.spi.impl.operationservice.Operation) UpdatePermissionConfigOperation(com.hazelcast.internal.management.operation.UpdatePermissionConfigOperation) UrgentSystemOperation(com.hazelcast.spi.impl.operationservice.UrgentSystemOperation) OperationResponseHandler(com.hazelcast.spi.impl.operationservice.OperationResponseHandler)

Example 63 with NodeEngine

use of com.hazelcast.spi.impl.NodeEngine in project hazelcast by hazelcast.

the class SqlCompactTest method randomEntryFrom.

@SuppressWarnings({ "OptionalGetWithoutIsPresent", "unchecked", "rawtypes" })
private static Entry<Data, Data> randomEntryFrom(String mapName) {
    NodeEngine engine = getNodeEngine(instance());
    MapService service = engine.getService(MapService.SERVICE_NAME);
    MapServiceContext context = service.getMapServiceContext();
    return Arrays.stream(context.getPartitionContainers()).map(partitionContainer -> partitionContainer.getExistingRecordStore(mapName)).filter(Objects::nonNull).flatMap(store -> {
        Iterator<Entry<Data, Record>> iterator = store.iterator();
        return stream(spliteratorUnknownSize(iterator, ORDERED), false);
    }).map(entry -> entry(entry.getKey(), (Data) entry.getValue().getValue())).findFirst().get();
}
Also used : NodeEngine(com.hazelcast.spi.impl.NodeEngine) Util.getNodeEngine(com.hazelcast.jet.impl.util.Util.getNodeEngine) Spliterators.spliteratorUnknownSize(java.util.Spliterators.spliteratorUnknownSize) Arrays(java.util.Arrays) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) ORDERED(java.util.Spliterator.ORDERED) Collections.singletonList(java.util.Collections.singletonList) BigDecimal(java.math.BigDecimal) Arrays.asList(java.util.Arrays.asList) LocalTime(java.time.LocalTime) CompactSerializer(com.hazelcast.nio.serialization.compact.CompactSerializer) OPTION_KEY_CLASS(com.hazelcast.jet.sql.impl.connector.SqlConnector.OPTION_KEY_CLASS) OPTION_KEY_FORMAT(com.hazelcast.jet.sql.impl.connector.SqlConnector.OPTION_KEY_FORMAT) SqlRow(com.hazelcast.sql.SqlRow) HazelcastSqlException(com.hazelcast.sql.HazelcastSqlException) GenericRecord(com.hazelcast.nio.serialization.GenericRecord) Objects(java.util.Objects) OPTION_VALUE_FORMAT(com.hazelcast.jet.sql.impl.connector.SqlConnector.OPTION_VALUE_FORMAT) Util(com.hazelcast.jet.impl.util.Util) OPTION_VALUE_COMPACT_TYPE_NAME(com.hazelcast.jet.sql.impl.connector.SqlConnector.OPTION_VALUE_COMPACT_TYPE_NAME) OffsetDateTime(java.time.OffsetDateTime) StreamSupport.stream(java.util.stream.StreamSupport.stream) TestAllTypesSqlConnector(com.hazelcast.jet.sql.impl.connector.test.TestAllTypesSqlConnector) Assert.assertFalse(org.junit.Assert.assertFalse) LocalDate(java.time.LocalDate) Entry(java.util.Map.Entry) UTC(java.time.ZoneOffset.UTC) BeforeClass(org.junit.BeforeClass) LocalDateTime(java.time.LocalDateTime) CompactWriter(com.hazelcast.nio.serialization.compact.CompactWriter) Assertions.assertThatThrownBy(org.assertj.core.api.Assertions.assertThatThrownBy) InternalSerializationService(com.hazelcast.internal.serialization.InternalSerializationService) Util.entry(com.hazelcast.jet.Util.entry) COMPACT_FORMAT(com.hazelcast.jet.sql.impl.connector.SqlConnector.COMPACT_FORMAT) ClientConfig(com.hazelcast.client.config.ClientConfig) Nonnull(javax.annotation.Nonnull) InternalGenericRecord(com.hazelcast.internal.serialization.impl.InternalGenericRecord) Config(com.hazelcast.config.Config) SqlService(com.hazelcast.sql.SqlService) CompactReader(com.hazelcast.nio.serialization.compact.CompactReader) NodeEngine(com.hazelcast.spi.impl.NodeEngine) Iterator(java.util.Iterator) Record(com.hazelcast.map.impl.record.Record) Data(com.hazelcast.internal.serialization.Data) SqlTestSupport(com.hazelcast.jet.sql.SqlTestSupport) Test(org.junit.Test) IOException(java.io.IOException) MapService(com.hazelcast.map.impl.MapService) MapServiceContext(com.hazelcast.map.impl.MapServiceContext) OPTION_KEY_COMPACT_TYPE_NAME(com.hazelcast.jet.sql.impl.connector.SqlConnector.OPTION_KEY_COMPACT_TYPE_NAME) Util.getNodeEngine(com.hazelcast.jet.impl.util.Util.getNodeEngine) JAVA_FORMAT(com.hazelcast.jet.sql.impl.connector.SqlConnector.JAVA_FORMAT) CompactSerializationConfig(com.hazelcast.config.CompactSerializationConfig) GenericRecordBuilder(com.hazelcast.nio.serialization.GenericRecordBuilder) Assert.assertEquals(org.junit.Assert.assertEquals) IMap(com.hazelcast.map.IMap) Objects(java.util.Objects) Iterator(java.util.Iterator) Data(com.hazelcast.internal.serialization.Data) GenericRecord(com.hazelcast.nio.serialization.GenericRecord) InternalGenericRecord(com.hazelcast.internal.serialization.impl.InternalGenericRecord) Record(com.hazelcast.map.impl.record.Record) MapService(com.hazelcast.map.impl.MapService) MapServiceContext(com.hazelcast.map.impl.MapServiceContext)

Example 64 with NodeEngine

use of com.hazelcast.spi.impl.NodeEngine in project hazelcast by hazelcast.

the class SqlPortableTest method randomEntryFrom.

@SuppressWarnings({ "OptionalGetWithoutIsPresent", "unchecked", "rawtypes" })
private static Entry<Data, Data> randomEntryFrom(String mapName) {
    NodeEngine engine = getNodeEngine(instance());
    MapService service = engine.getService(MapService.SERVICE_NAME);
    MapServiceContext context = service.getMapServiceContext();
    return Arrays.stream(context.getPartitionContainers()).map(partitionContainer -> partitionContainer.getExistingRecordStore(mapName)).filter(Objects::nonNull).flatMap(store -> {
        Iterator<Entry<Data, Record>> iterator = store.iterator();
        return stream(spliteratorUnknownSize(iterator, ORDERED), false);
    }).map(entry -> entry(entry.getKey(), (Data) entry.getValue().getValue())).findFirst().get();
}
Also used : NodeEngine(com.hazelcast.spi.impl.NodeEngine) Util.getNodeEngine(com.hazelcast.jet.impl.util.Util.getNodeEngine) Spliterators.spliteratorUnknownSize(java.util.Spliterators.spliteratorUnknownSize) Arrays(java.util.Arrays) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) PortableGenericRecordBuilder(com.hazelcast.internal.serialization.impl.portable.PortableGenericRecordBuilder) ORDERED(java.util.Spliterator.ORDERED) ClassDefinition(com.hazelcast.nio.serialization.ClassDefinition) Collections.singletonList(java.util.Collections.singletonList) BigDecimal(java.math.BigDecimal) ClassDefinitionBuilder(com.hazelcast.nio.serialization.ClassDefinitionBuilder) Arrays.asList(java.util.Arrays.asList) LocalTime(java.time.LocalTime) OPTION_KEY_CLASS(com.hazelcast.jet.sql.impl.connector.SqlConnector.OPTION_KEY_CLASS) OPTION_KEY_FORMAT(com.hazelcast.jet.sql.impl.connector.SqlConnector.OPTION_KEY_FORMAT) SqlRow(com.hazelcast.sql.SqlRow) PORTABLE_FORMAT(com.hazelcast.jet.sql.impl.connector.SqlConnector.PORTABLE_FORMAT) HazelcastSqlException(com.hazelcast.sql.HazelcastSqlException) OPTION_KEY_CLASS_ID(com.hazelcast.jet.sql.impl.connector.SqlConnector.OPTION_KEY_CLASS_ID) GenericRecord(com.hazelcast.nio.serialization.GenericRecord) Collections.emptyList(java.util.Collections.emptyList) Objects(java.util.Objects) OPTION_VALUE_FORMAT(com.hazelcast.jet.sql.impl.connector.SqlConnector.OPTION_VALUE_FORMAT) Util(com.hazelcast.jet.impl.util.Util) OffsetDateTime(java.time.OffsetDateTime) StreamSupport.stream(java.util.stream.StreamSupport.stream) TestAllTypesSqlConnector(com.hazelcast.jet.sql.impl.connector.test.TestAllTypesSqlConnector) Assert.assertFalse(org.junit.Assert.assertFalse) LocalDate(java.time.LocalDate) Entry(java.util.Map.Entry) UTC(java.time.ZoneOffset.UTC) OPTION_KEY_FACTORY_ID(com.hazelcast.jet.sql.impl.connector.SqlConnector.OPTION_KEY_FACTORY_ID) OPTION_VALUE_FACTORY_ID(com.hazelcast.jet.sql.impl.connector.SqlConnector.OPTION_VALUE_FACTORY_ID) BeforeClass(org.junit.BeforeClass) LocalDateTime(java.time.LocalDateTime) Assertions.assertThatThrownBy(org.assertj.core.api.Assertions.assertThatThrownBy) InternalSerializationService(com.hazelcast.internal.serialization.InternalSerializationService) Util.entry(com.hazelcast.jet.Util.entry) InternalGenericRecord(com.hazelcast.internal.serialization.impl.InternalGenericRecord) SqlService(com.hazelcast.sql.SqlService) NodeEngine(com.hazelcast.spi.impl.NodeEngine) Iterator(java.util.Iterator) OPTION_KEY_CLASS_VERSION(com.hazelcast.jet.sql.impl.connector.SqlConnector.OPTION_KEY_CLASS_VERSION) Record(com.hazelcast.map.impl.record.Record) Data(com.hazelcast.internal.serialization.Data) SqlTestSupport(com.hazelcast.jet.sql.SqlTestSupport) Test(org.junit.Test) IOException(java.io.IOException) MapService(com.hazelcast.map.impl.MapService) MapServiceContext(com.hazelcast.map.impl.MapServiceContext) OPTION_VALUE_CLASS_VERSION(com.hazelcast.jet.sql.impl.connector.SqlConnector.OPTION_VALUE_CLASS_VERSION) Util.getNodeEngine(com.hazelcast.jet.impl.util.Util.getNodeEngine) OPTION_VALUE_CLASS_ID(com.hazelcast.jet.sql.impl.connector.SqlConnector.OPTION_VALUE_CLASS_ID) JAVA_FORMAT(com.hazelcast.jet.sql.impl.connector.SqlConnector.JAVA_FORMAT) Assert.assertEquals(org.junit.Assert.assertEquals) Objects(java.util.Objects) Iterator(java.util.Iterator) Data(com.hazelcast.internal.serialization.Data) GenericRecord(com.hazelcast.nio.serialization.GenericRecord) InternalGenericRecord(com.hazelcast.internal.serialization.impl.InternalGenericRecord) Record(com.hazelcast.map.impl.record.Record) MapService(com.hazelcast.map.impl.MapService) MapServiceContext(com.hazelcast.map.impl.MapServiceContext)

Example 65 with NodeEngine

use of com.hazelcast.spi.impl.NodeEngine in project hazelcast by hazelcast.

the class DefaultNodeExtension method createMapService.

@SuppressWarnings("unchecked")
private <T> T createMapService() {
    ConstructorFunction<NodeEngine, MapService> constructor = getDefaultMapServiceConstructor();
    NodeEngineImpl nodeEngine = node.getNodeEngine();
    return (T) constructor.createNew(nodeEngine);
}
Also used : NodeEngine(com.hazelcast.spi.impl.NodeEngine) NodeEngineImpl(com.hazelcast.spi.impl.NodeEngineImpl) PRODUCT(com.hazelcast.config.InstanceTrackingConfig.InstanceTrackingProperties.PRODUCT) MapService(com.hazelcast.map.impl.MapService)

Aggregations

NodeEngine (com.hazelcast.spi.impl.NodeEngine)165 Data (com.hazelcast.internal.serialization.Data)48 OperationService (com.hazelcast.spi.impl.operationservice.OperationService)30 Address (com.hazelcast.cluster.Address)22 Test (org.junit.Test)21 ILogger (com.hazelcast.logging.ILogger)20 HazelcastInstance (com.hazelcast.core.HazelcastInstance)18 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)18 QuickTest (com.hazelcast.test.annotation.QuickTest)18 Config (com.hazelcast.config.Config)17 Operation (com.hazelcast.spi.impl.operationservice.Operation)16 MapServiceContext (com.hazelcast.map.impl.MapServiceContext)15 IPartitionService (com.hazelcast.internal.partition.IPartitionService)12 Nonnull (javax.annotation.Nonnull)12 ArrayList (java.util.ArrayList)11 Future (java.util.concurrent.Future)11 Member (com.hazelcast.cluster.Member)10 UUID (java.util.UUID)10 InitializingObject (com.hazelcast.spi.impl.InitializingObject)9 TestHazelcastInstanceFactory (com.hazelcast.test.TestHazelcastInstanceFactory)9