use of com.hazelcast.internal.serialization.SerializationServiceBuilder 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.SerializationServiceBuilder 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.SerializationServiceBuilder in project hazelcast by hazelcast.
the class CacheSerializationTest method setup.
@Before
public void setup() {
SerializationServiceBuilder builder = new DefaultSerializationServiceBuilder();
service = builder.build();
}
use of com.hazelcast.internal.serialization.SerializationServiceBuilder in project hazelcast by hazelcast.
the class DefaultClientExtension method createSerializationService.
@Override
public InternalSerializationService createSerializationService(byte version) {
try {
ClientConfig config = client.getClientConfig();
ClassLoader configClassLoader = config.getClassLoader();
HazelcastInstance hazelcastInstance = client;
PartitioningStrategy partitioningStrategy = getPartitioningStrategy(configClassLoader);
SerializationConfig serializationConfig = config.getSerializationConfig() != null ? config.getSerializationConfig() : new SerializationConfig();
SerializationServiceBuilder builder = new DefaultSerializationServiceBuilder();
if (version > 0) {
builder.setVersion(version);
}
return builder.setClassLoader(configClassLoader).setConfig(serializationConfig).setManagedContext(new HazelcastClientManagedContext(client, config.getManagedContext())).setPartitioningStrategy(partitioningStrategy).setHazelcastInstance(hazelcastInstance).setNotActiveExceptionSupplier(HazelcastClientNotActiveException::new).setSchemaService(client.getSchemaService()).build();
} catch (Exception e) {
throw rethrow(e);
}
}
use of com.hazelcast.internal.serialization.SerializationServiceBuilder in project hazelcast by hazelcast.
the class DefaultNodeExtension method createSerializationService.
/**
* Creates a serialization service. The {@code isCompatibility} parameter defines
* whether the serialization format used by the service will conform to the
* 3.x or the 4.x format.
*
* @param isCompatibility {@code true} if the serialized format should conform to the
* 3.x serialization format, {@code false} otherwise
* @return the serialization service
*/
private InternalSerializationService createSerializationService(boolean isCompatibility) {
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(ClusterProperty.SERIALIZATION_VERSION);
ss = builder.setClassLoader(configClassLoader).setConfig(serializationConfig).setManagedContext(hazelcastInstance.managedContext).setPartitioningStrategy(partitioningStrategy).setHazelcastInstance(hazelcastInstance).setVersion(version).setSchemaService(node.memberSchemaService).setNotActiveExceptionSupplier(new Supplier<RuntimeException>() {
@Override
public RuntimeException get() {
return new HazelcastInstanceNotActiveException();
}
}).isCompatibility(isCompatibility).build();
} catch (Exception e) {
throw rethrow(e);
}
return ss;
}
Aggregations