Skip to content

Commit

Permalink
Fixed properties API by restoring public classes from Hazelcast 3.6 a…
Browse files Browse the repository at this point in the history
…nd deprecating them properly. Moved changed implementations from Hazelcast 3.7 to internal packages.
  • Loading branch information
Donnerbart committed Mar 21, 2016
1 parent 1f042b8 commit 2f1d23d
Show file tree
Hide file tree
Showing 203 changed files with 1,364 additions and 913 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ public String getProperty(String name) {
* @param name property name
* @param value value of the property
* @return configured {@link com.hazelcast.client.config.ClientConfig} for chaining
* @see {@link com.hazelcast.client.config.ClientProperties} for properties that is used to configure client
*/
public ClientConfig setProperty(String name, String value) {
properties.put(name, value);
Expand All @@ -143,21 +142,28 @@ public ClientConfig setProperty(String name, String value) {
/**
* Gets a {@link HazelcastProperty} already set or from system properties if not exists.
*
* Deprecated since Hazelcast 3.7, use {@link #getProperty(String)} instead.
*
* @param property {@link HazelcastProperty} to get
* @return value of the property
* @deprecated since Hazelcast 3.7
*/
@Deprecated
public String getProperty(HazelcastProperty property) {
return getProperty(property.getName());
}

/**
* Sets the value of a {@link HazelcastProperty}.
*
* Deprecated since Hazelcast 3.7, use {@link #setProperty(String, String)} instead.
*
* @param property {@link HazelcastProperty} to set
* @param value value of the property
* @return configured {@link com.hazelcast.client.config.ClientConfig} for chaining
* @see {@link com.hazelcast.client.config.ClientProperties} for properties that is used to configure client
* @deprecated since Hazelcast 3.7
*/
@Deprecated
public ClientConfig setProperty(HazelcastProperty property, String value) {
return setProperty(property.getName(), value);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,24 @@

package com.hazelcast.client.config;

import com.hazelcast.config.Config;
import com.hazelcast.client.internal.properties.ClientProperty;
import com.hazelcast.instance.HazelcastProperties;

import static com.hazelcast.client.config.ClientProperty.EVENT_QUEUE_CAPACITY;
import static com.hazelcast.client.config.ClientProperty.EVENT_THREAD_COUNT;
import static com.hazelcast.client.config.ClientProperty.HEARTBEAT_INTERVAL;
import static com.hazelcast.client.config.ClientProperty.HEARTBEAT_TIMEOUT;
import static com.hazelcast.client.config.ClientProperty.INVOCATION_TIMEOUT_SECONDS;
import static com.hazelcast.client.config.ClientProperty.SHUFFLE_MEMBER_LIST;
import static com.hazelcast.client.internal.properties.ClientProperty.EVENT_QUEUE_CAPACITY;
import static com.hazelcast.client.internal.properties.ClientProperty.EVENT_THREAD_COUNT;
import static com.hazelcast.client.internal.properties.ClientProperty.HEARTBEAT_INTERVAL;
import static com.hazelcast.client.internal.properties.ClientProperty.HEARTBEAT_TIMEOUT;
import static com.hazelcast.client.internal.properties.ClientProperty.INVOCATION_TIMEOUT_SECONDS;
import static com.hazelcast.client.internal.properties.ClientProperty.SHUFFLE_MEMBER_LIST;

/**
* Container for configured Hazelcast Client properties ({@see ClientProperty}).
* <p/>
* A {@link ClientProperty} can be set as:
* <p><ul>
* <li>an environmental variable using {@link System#setProperty(String, String)}</li>
* <li>the programmatic configuration using {@link Config#setProperty(String, String)}</li>
* <li>the XML configuration
* {@see http://docs.hazelcast.org/docs/latest-dev/manual/html-single/hazelcast-documentation.html#system-properties}</li>
* </ul></p>
* The old property definitions are deprecated since Hazelcast 3.6. Please use the new {@link ClientProperty} definitions instead.
* The old property definitions are deprecated since Hazelcast 3.6.
* The whole class is deprecated since Hazelcast 3.7.
* This is private API, don't use it.
*/
@Deprecated
@SuppressWarnings("unused")
public class ClientProperties extends HazelcastProperties {

Expand Down Expand Up @@ -119,8 +115,9 @@ public class ClientProperties extends HazelcastProperties {
* Uses the environmental value if no value is defined in the configuration.
* Uses the default value if no environmental value is defined.
*
* @param config {@link Config} used to configure the {@link ClientProperty} values.
* @param config {@link ClientConfig} used to configure the {@link ClientProperty} values.
*/
@Deprecated
public ClientProperties(ClientConfig config) {
super(config.getProperties());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import com.hazelcast.client.connection.ClientConnectionManager;
import com.hazelcast.client.impl.HazelcastClientInstanceImpl;
import com.hazelcast.core.LifecycleService;
import com.hazelcast.instance.GroupProperty;
import com.hazelcast.internal.properties.GroupProperty;
import com.hazelcast.logging.ILogger;
import com.hazelcast.logging.LoggingService;
import com.hazelcast.nio.Address;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import com.hazelcast.client.ClientTypes;
import com.hazelcast.client.config.ClientConfig;
import com.hazelcast.client.config.ClientNetworkConfig;
import com.hazelcast.client.config.ClientProperties;
import com.hazelcast.client.config.SocketOptions;
import com.hazelcast.client.connection.AddressTranslator;
import com.hazelcast.client.connection.ClientConnectionManager;
Expand All @@ -32,6 +31,7 @@
import com.hazelcast.client.impl.protocol.codec.ClientAuthenticationCodec;
import com.hazelcast.client.impl.protocol.codec.ClientAuthenticationCustomCodec;
import com.hazelcast.client.impl.protocol.codec.ClientPingCodec;
import com.hazelcast.client.internal.properties.ClientProperties;
import com.hazelcast.client.spi.ClientInvocationService;
import com.hazelcast.client.spi.impl.ClientClusterServiceImpl;
import com.hazelcast.client.spi.impl.ClientExecutionServiceImpl;
Expand Down Expand Up @@ -72,10 +72,10 @@
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;

import static com.hazelcast.client.config.ClientProperty.HEARTBEAT_INTERVAL;
import static com.hazelcast.client.config.ClientProperty.HEARTBEAT_TIMEOUT;
import static com.hazelcast.client.config.SocketOptions.DEFAULT_BUFFER_SIZE_BYTE;
import static com.hazelcast.client.config.SocketOptions.KILO_BYTE;
import static com.hazelcast.client.internal.properties.ClientProperty.HEARTBEAT_INTERVAL;
import static com.hazelcast.client.internal.properties.ClientProperty.HEARTBEAT_TIMEOUT;

public class ClientConnectionManagerImpl implements ClientConnectionManager {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import com.hazelcast.config.SerializationConfig;
import com.hazelcast.core.HazelcastInstance;
import com.hazelcast.core.PartitioningStrategy;
import com.hazelcast.instance.GroupProperty;
import com.hazelcast.internal.properties.GroupProperty;
import com.hazelcast.internal.serialization.InternalSerializationService;
import com.hazelcast.internal.serialization.SerializationServiceBuilder;
import com.hazelcast.internal.serialization.impl.DefaultSerializationServiceBuilder;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
import com.hazelcast.client.config.ClientAwsConfig;
import com.hazelcast.client.config.ClientConfig;
import com.hazelcast.client.config.ClientNetworkConfig;
import com.hazelcast.client.config.ClientProperties;
import com.hazelcast.client.config.ClientProperty;
import com.hazelcast.client.config.ClientSecurityConfig;
import com.hazelcast.client.connection.AddressProvider;
import com.hazelcast.client.connection.ClientConnectionManager;
import com.hazelcast.client.impl.client.DistributedObjectInfo;
import com.hazelcast.client.impl.protocol.ClientMessage;
import com.hazelcast.client.impl.protocol.codec.ClientGetDistributedObjectsCodec;
import com.hazelcast.client.internal.properties.ClientProperties;
import com.hazelcast.client.internal.properties.ClientProperty;
import com.hazelcast.client.proxy.ClientClusterProxy;
import com.hazelcast.client.proxy.PartitionServiceProxy;
import com.hazelcast.client.spi.ClientClusterService;
Expand Down Expand Up @@ -74,7 +74,7 @@
import com.hazelcast.core.ReplicatedMap;
import com.hazelcast.executor.impl.DistributedExecutorService;
import com.hazelcast.instance.BuildInfoProvider;
import com.hazelcast.instance.GroupProperty;
import com.hazelcast.internal.properties.GroupProperty;
import com.hazelcast.internal.serialization.InternalSerializationService;
import com.hazelcast.logging.ILogger;
import com.hazelcast.logging.LoggingService;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Copyright (c) 2008-2016, Hazelcast, Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/**
* Contains the internal packages of the Hazelcast client.
*
* Don't make use of these packages; we won't provide any backwards compatibility on them. They are purely meant to be
* used by the Hazelcast team.
*/
package com.hazelcast.client.internal;
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* Copyright (c) 2008-2016, Hazelcast, Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.hazelcast.client.internal.properties;

import com.hazelcast.client.config.ClientConfig;
import com.hazelcast.config.Config;
import com.hazelcast.internal.properties.HazelcastProperties;

/**
* Container for configured Hazelcast Client properties ({@see ClientProperty}).
* <p/>
* A {@link ClientProperty} can be set as:
* <p><ul>
* <li>an environmental variable using {@link System#setProperty(String, String)}</li>
* <li>the programmatic configuration using {@link Config#setProperty(String, String)}</li>
* <li>the XML configuration
* {@see http://docs.hazelcast.org/docs/latest-dev/manual/html-single/hazelcast-documentation.html#system-properties}</li>
* </ul></p>
*/
public class ClientProperties extends HazelcastProperties {

/**
* Creates a container with configured Hazelcast properties.
* <p/>
* Uses the environmental value if no value is defined in the configuration.
* Uses the default value if no environmental value is defined.
*
* @param config {@link Config} used to configure the {@link ClientProperty} values.
*/
public ClientProperties(ClientConfig config) {
super(config.getProperties());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
* limitations under the License.
*/

package com.hazelcast.client.config;
package com.hazelcast.client.internal.properties;

import com.hazelcast.instance.HazelcastProperty;
import com.hazelcast.internal.properties.HazelcastProperty;
import com.hazelcast.spi.annotation.PrivateApi;

import static java.util.concurrent.TimeUnit.MILLISECONDS;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* Copyright (c) 2008-2016, Hazelcast, Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/**
* Contains the private Hazelcast client properties implementation.
*/
package com.hazelcast.client.internal.properties;
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@
import com.hazelcast.client.LoadBalancer;
import com.hazelcast.client.cache.impl.ClientCacheDistributedObject;
import com.hazelcast.client.config.ClientConfig;
import com.hazelcast.client.config.ClientProperties;
import com.hazelcast.client.config.ProxyFactoryConfig;
import com.hazelcast.client.connection.ClientConnectionManager;
import com.hazelcast.client.impl.HazelcastClientInstanceImpl;
import com.hazelcast.client.impl.protocol.ClientMessage;
import com.hazelcast.client.impl.protocol.codec.ClientAddDistributedObjectListenerCodec;
import com.hazelcast.client.impl.protocol.codec.ClientCreateProxyCodec;
import com.hazelcast.client.impl.protocol.codec.ClientRemoveDistributedObjectListenerCodec;
import com.hazelcast.client.internal.properties.ClientProperties;
import com.hazelcast.client.proxy.ClientAtomicLongProxy;
import com.hazelcast.client.proxy.ClientAtomicReferenceProxy;
import com.hazelcast.client.proxy.ClientCountDownLatchProxy;
Expand Down Expand Up @@ -95,7 +95,7 @@
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;

import static com.hazelcast.client.config.ClientProperty.INVOCATION_TIMEOUT_SECONDS;
import static com.hazelcast.client.internal.properties.ClientProperty.INVOCATION_TIMEOUT_SECONDS;

/**
* The ProxyManager handles client proxy instantiation and retrieval at start- and runtime by registering
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@

import com.hazelcast.client.AuthenticationException;
import com.hazelcast.client.HazelcastClientNotActiveException;
import com.hazelcast.client.config.ClientProperties;
import com.hazelcast.client.connection.nio.ClientConnection;
import com.hazelcast.client.impl.HazelcastClientInstanceImpl;
import com.hazelcast.client.impl.protocol.ClientMessage;
import com.hazelcast.client.internal.properties.ClientProperties;
import com.hazelcast.client.spi.ClientExecutionService;
import com.hazelcast.client.spi.ClientInvocationService;
import com.hazelcast.client.spi.EventHandler;
Expand All @@ -37,8 +37,8 @@
import java.util.concurrent.RejectedExecutionException;
import java.util.concurrent.TimeUnit;

import static com.hazelcast.client.config.ClientProperty.HEARTBEAT_INTERVAL;
import static com.hazelcast.client.config.ClientProperty.INVOCATION_TIMEOUT_SECONDS;
import static com.hazelcast.client.internal.properties.ClientProperty.HEARTBEAT_INTERVAL;
import static com.hazelcast.client.internal.properties.ClientProperty.INVOCATION_TIMEOUT_SECONDS;

/**
* ClientInvocation handles routing of a request from client
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.TimeUnit;

import static com.hazelcast.client.config.ClientProperty.MAX_CONCURRENT_INVOCATIONS;
import static com.hazelcast.client.internal.properties.ClientProperty.MAX_CONCURRENT_INVOCATIONS;
import static com.hazelcast.instance.OutOfMemoryErrorDispatcher.onOutOfMemory;


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
import java.util.concurrent.Executors;
import java.util.logging.Level;

import static com.hazelcast.client.config.ClientProperty.SHUFFLE_MEMBER_LIST;
import static com.hazelcast.client.internal.properties.ClientProperty.SHUFFLE_MEMBER_LIST;

public abstract class ClusterListenerSupport implements ConnectionListener, ConnectionHeartbeatListener, ClientClusterService {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
package com.hazelcast.client;

import com.hazelcast.client.config.ClientConfig;
import com.hazelcast.client.config.ClientProperty;
import com.hazelcast.client.connection.ClientConnectionManager;
import com.hazelcast.client.impl.ClientTestUtil;
import com.hazelcast.client.impl.HazelcastClientInstanceImpl;
import com.hazelcast.client.internal.properties.ClientProperty;
import com.hazelcast.client.test.TestHazelcastFactory;
import com.hazelcast.core.Client;
import com.hazelcast.core.HazelcastInstance;
Expand Down Expand Up @@ -83,7 +83,7 @@ public void testWithLegalAndIllegalAddressTogether() {

HazelcastInstance server = hazelcastFactory.newHazelcastInstance();
ClientConfig config = new ClientConfig();
config.setProperty(ClientProperty.SHUFFLE_MEMBER_LIST, "false");
config.setProperty(ClientProperty.SHUFFLE_MEMBER_LIST.getName(), "false");
config.getNetworkConfig().addAddress(illegalAddress).addAddress("localhost");
HazelcastInstance client = hazelcastFactory.newHazelcastClient(config);

Expand All @@ -100,7 +100,7 @@ public void testMemberConnectionOrder() {
HazelcastInstance server2 = hazelcastFactory.newHazelcastInstance();

ClientConfig config = new ClientConfig();
config.setProperty(ClientProperty.SHUFFLE_MEMBER_LIST, "false");
config.setProperty(ClientProperty.SHUFFLE_MEMBER_LIST.getName(), "false");
config.getNetworkConfig().setSmartRouting(false);

InetSocketAddress socketAddress1 = server1.getCluster().getLocalMember().getSocketAddress();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
package com.hazelcast.client;

import com.hazelcast.client.config.ClientConfig;
import com.hazelcast.client.config.ClientProperty;
import com.hazelcast.client.internal.properties.ClientProperty;
import com.hazelcast.client.test.TestHazelcastFactory;
import com.hazelcast.core.HazelcastInstance;
import com.hazelcast.core.HazelcastOverloadException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
package com.hazelcast.client;

import com.hazelcast.client.config.ClientConfig;
import com.hazelcast.client.config.ClientProperty;
import com.hazelcast.client.config.ClientSecurityConfig;
import com.hazelcast.client.internal.properties.ClientProperty;
import com.hazelcast.client.test.TestHazelcastFactory;
import com.hazelcast.config.Config;
import com.hazelcast.config.ListenerConfig;
Expand Down Expand Up @@ -723,7 +723,7 @@ public void run() {
//retry to connect to cluster forever(never shutdown the client)
clientConfig.getNetworkConfig().setConnectionAttemptLimit(Integer.MAX_VALUE);
//Retry all requests forever(until client is shutdown)
clientConfig.setProperty(ClientProperty.INVOCATION_TIMEOUT_SECONDS, String.valueOf(Integer.MAX_VALUE));
clientConfig.setProperty(ClientProperty.INVOCATION_TIMEOUT_SECONDS.getName(), String.valueOf(Integer.MAX_VALUE));
HazelcastInstance client = hazelcastFactory.newHazelcastClient(clientConfig);

IMap<Object, Object> map = client.getMap(randomMapName());
Expand All @@ -749,7 +749,7 @@ public void testClusterShutdown_thenCheckOperationsNotHanging() throws Exception
//Retry all requests
clientConfig.getNetworkConfig().setRedoOperation(true);
//Retry all requests forever(until client is shutdown)
clientConfig.setProperty(ClientProperty.INVOCATION_TIMEOUT_SECONDS, String.valueOf(Integer.MAX_VALUE));
clientConfig.setProperty(ClientProperty.INVOCATION_TIMEOUT_SECONDS.getName(), String.valueOf(Integer.MAX_VALUE));
HazelcastInstance client = hazelcastFactory.newHazelcastClient(clientConfig);

final IMap<Object, Object> map = client.getMap(randomMapName());
Expand Down
Loading

0 comments on commit 2f1d23d

Please sign in to comment.