Skip to content

Commit

Permalink
Fixes unncessary client context creation per proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
sancar committed Mar 21, 2017
1 parent dca70e2 commit 5d67792
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Expand Up @@ -236,7 +236,6 @@ public HazelcastClientInstanceImpl(ClientConfig config,
userContext = new ConcurrentHashMap<String, Object>();
diagnostics = initDiagnostics(config);

proxyManager.init(config);
hazelcastCacheManager = new ClientICacheManager(this);

lockReferenceIdGenerator = new ClientLockReferenceIdGenerator();
Expand Down Expand Up @@ -391,7 +390,6 @@ public void start() {
lifecycleService.setStarted();
invocationService.start();
connectionManager.start();

diagnostics.start();
diagnostics.register(
new ConfigPropertiesPlugin(loggingService.getLogger(ConfigPropertiesPlugin.class), properties));
Expand All @@ -410,6 +408,7 @@ public void start() {
lifecycleService.shutdown();
throw ExceptionUtil.rethrow(e);
}
proxyManager.init(config);
listenerService.start();
loadBalancer.init(getCluster(), config);
partitionService.start();
Expand Down
Expand Up @@ -118,6 +118,7 @@ public final class ProxyManager {
private final ConcurrentMap<String, ClientProxyFactory> proxyFactories = new ConcurrentHashMap<String, ClientProxyFactory>();
private final ConcurrentMap<ObjectNamespace, ClientProxyFuture> proxies
= new ConcurrentHashMap<ObjectNamespace, ClientProxyFuture>();
private ClientContext context;

private final ListenerMessageCodec distributedObjectListenerCodec = new ListenerMessageCodec() {
@Override
Expand Down Expand Up @@ -154,6 +155,7 @@ public ProxyManager(HazelcastClientInstanceImpl client) {
}

public void init(ClientConfig config) {
context = new ClientContext(client, this);
// register defaults
register(MapService.SERVICE_NAME, createServiceProxyFactory(MapService.class));
if (JCacheDetector.isJCacheAvailable(config.getClassLoader())) {
Expand Down Expand Up @@ -345,7 +347,6 @@ private void initialize(ClientProxy clientProxy) throws Exception {
final Connection connection = getTargetOrOwnerConnection(initializationTarget);
final ClientMessage clientMessage = ClientCreateProxyCodec.encodeRequest(clientProxy.getDistributedObjectName(),
clientProxy.getServiceName(), initializationTarget);
final ClientContext context = new ClientContext(client, this);
new ClientInvocation(client, clientMessage, connection).invoke().get();
clientProxy.setContext(context);
clientProxy.onInitialize();
Expand Down

0 comments on commit 5d67792

Please sign in to comment.