use of com.hazelcast.internal.serialization.impl.DefaultSerializationServiceBuilder in project hazelcast by hazelcast.
the class DefaultNodeExtension method createSerializationService.
public InternalSerializationService createSerializationService() {
InternalSerializationService ss;
try {
Config config = node.getConfig();
ClassLoader configClassLoader = node.getConfigClassLoader();
HazelcastInstanceImpl hazelcastInstance = node.hazelcastInstance;
PartitioningStrategy partitioningStrategy = getPartitioningStrategy(configClassLoader);
SerializationServiceBuilder builder = new DefaultSerializationServiceBuilder();
SerializationConfig serializationConfig = config.getSerializationConfig() != null ? config.getSerializationConfig() : new SerializationConfig();
byte version = (byte) node.getProperties().getInteger(GroupProperty.SERIALIZATION_VERSION);
ss = (InternalSerializationService) builder.setClassLoader(configClassLoader).setConfig(serializationConfig).setManagedContext(hazelcastInstance.managedContext).setPartitioningStrategy(partitioningStrategy).setHazelcastInstance(hazelcastInstance).setVersion(version).build();
} catch (Exception e) {
throw ExceptionUtil.rethrow(e);
}
return ss;
}
use of com.hazelcast.internal.serialization.impl.DefaultSerializationServiceBuilder in project hazelcast by hazelcast.
the class TcpIpConnection_AbstractTest method setup.
@Before
public void setup() throws Exception {
addressA = new Address("127.0.0.1", 5701);
addressB = new Address("127.0.0.1", 5702);
addressC = new Address("127.0.0.1", 5703);
loggingService = new LoggingServiceImpl("somegroup", "log4j2", BuildInfoProvider.BUILD_INFO);
logger = loggingService.getLogger(TcpIpConnection_AbstractTest.class);
metricsRegistryA = newMetricsRegistry();
connManagerA = newConnectionManager(addressA.getPort(), metricsRegistryA);
ioServiceA = (MockIOService) connManagerA.getIoService();
metricsRegistryB = newMetricsRegistry();
connManagerB = newConnectionManager(addressB.getPort(), metricsRegistryB);
ioServiceB = (MockIOService) connManagerB.getIoService();
metricsRegistryC = newMetricsRegistry();
connManagerC = newConnectionManager(addressC.getPort(), metricsRegistryC);
ioServiceC = (MockIOService) connManagerB.getIoService();
serializationService = (InternalSerializationService) new DefaultSerializationServiceBuilder().addDataSerializableFactory(TestDataFactory.FACTORY_ID, new TestDataFactory()).build();
}
use of com.hazelcast.internal.serialization.impl.DefaultSerializationServiceBuilder in project hazelcast by hazelcast.
the class LazyEntryViewFromRecordTest method createDefaultEntryView.
/**
* Returns an entry-view instance populated with default values of fields.
*/
private EntryView createDefaultEntryView() {
PartitioningStrategy mockPartitioningStrategy = mock(PartitioningStrategy.class);
MapConfig mapConfig = new MapConfig();
serializationService = new DefaultSerializationServiceBuilder().build();
DataRecordFactory dataRecordFactory = new DataRecordFactory(mapConfig, serializationService, mockPartitioningStrategy);
recordInstance = dataRecordFactory.newRecord(value);
((AbstractRecord) recordInstance).setKey(serializationService.toData(key));
return new LazyEntryViewFromRecord(recordInstance, serializationService);
}
use of com.hazelcast.internal.serialization.impl.DefaultSerializationServiceBuilder in project hazelcast by hazelcast.
the class DefaultClientExtension method createSerializationService.
@Override
public InternalSerializationService createSerializationService(byte version) {
InternalSerializationService ss;
try {
ClientConfig config = client.getClientConfig();
ClassLoader configClassLoader = config.getClassLoader();
HazelcastInstance hazelcastInstance = client;
PartitioningStrategy partitioningStrategy = getPartitioningStrategy(configClassLoader);
SerializationServiceBuilder builder = new DefaultSerializationServiceBuilder();
SerializationConfig serializationConfig = config.getSerializationConfig() != null ? config.getSerializationConfig() : new SerializationConfig();
if (version > 0) {
builder.setVersion(version);
}
ss = builder.setClassLoader(configClassLoader).setConfig(serializationConfig).setManagedContext(new HazelcastClientManagedContext(client, config.getManagedContext())).setPartitioningStrategy(partitioningStrategy).setHazelcastInstance(hazelcastInstance).build();
} catch (Exception e) {
throw ExceptionUtil.rethrow(e);
}
return ss;
}
use of com.hazelcast.internal.serialization.impl.DefaultSerializationServiceBuilder in project hazelcast by hazelcast.
the class WanPublisherConfigTest method testSerialization.
@Test
public void testSerialization() {
Map<String, Comparable> properties = new HashMap<String, Comparable>();
properties.put("key", "value");
config.setGroupName("groupName");
config.setQueueCapacity(500);
config.setQueueFullBehavior(WANQueueFullBehavior.THROW_EXCEPTION);
config.setProperties(properties);
config.setClassName("className");
config.setImplementation("implementation");
SerializationService serializationService = new DefaultSerializationServiceBuilder().build();
Data serialized = serializationService.toData(config);
WanPublisherConfig deserialized = serializationService.toObject(serialized);
assertWanPublisherConfig(config, deserialized);
}
Aggregations