diff options
Diffstat (limited to 'src/main/java/com')
4 files changed, 7 insertions, 108 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/remote/BUILD b/src/main/java/com/google/devtools/build/lib/remote/BUILD index 62ff0c9ebd..e73289826c 100644 --- a/src/main/java/com/google/devtools/build/lib/remote/BUILD +++ b/src/main/java/com/google/devtools/build/lib/remote/BUILD @@ -34,7 +34,6 @@ java_library( "//third_party:auth", "//third_party:gson", "//third_party:guava", - "//third_party:hazelcast", "//third_party:jsr305", "//third_party:netty", "//third_party/grpc:grpc-jar", diff --git a/src/main/java/com/google/devtools/build/lib/remote/README.md b/src/main/java/com/google/devtools/build/lib/remote/README.md index e8487ec8b1..988039cf3b 100644 --- a/src/main/java/com/google/devtools/build/lib/remote/README.md +++ b/src/main/java/com/google/devtools/build/lib/remote/README.md @@ -44,12 +44,12 @@ Bazel currently supports the following digest functions with the remote worker: ### Hazelcast with REST interface -[Hazelcast](https://hazelcast.org/) is a distributed in-memory cache which can be used by Bazel as a remote cache. +[Hazelcast](https://hazelcast.org/) is a distributed in-memory cache which can be used by Bazel as a remote cache. You can download the standalone Hazelcast server [here](https://hazelcast.org/download/). -A simple single-machine setup is to run a single Hazelcast server with REST enabled. The REST endpoint will be `http://localhost:5701/hazelcast/rest/maps/cache`. Run with: +A simple single-machine setup is to run a single Hazelcast server with REST enabled. The REST endpoint will be `http://localhost:5701/hazelcast/rest/maps/`. Run the Hazelcast server with REST using this command: ``` -java -cp third_party/hazelcast/hazelcast-3.6.4.jar -Dhazelcast.rest.enabled=true com.hazelcast.core.server.StartServer +java -cp hazelcast-all-3.8.5.jar -Dhazelcast.rest.enabled=true com.hazelcast.core.server.StartServer ``` You can also use Bazel with a Hazelcast cluster - as long as REST is enabled -, and also customize the configuration. Please see the Hazelcast [documentation](http://docs.hazelcast.org/docs/3.6/manual/html-single/index.html) for more details. @@ -127,7 +127,7 @@ build --strategy=Closure=remote ### Running the sample gRPC cache server -Bazel currently provides a sample gRPC CAS implementation with a SimpleBlobStore or Hazelcast as caching backend. To use it you need to clone from [Bazel](https://github.com/bazelbuild/bazel) and then build it with: +Bazel currently provides a sample gRPC CAS implementation with a SimpleBlobStore as caching backend. To use it you need to clone from [Bazel](https://github.com/bazelbuild/bazel) and then build it with: ``` bazel build //src/tools/remote_worker @@ -138,18 +138,3 @@ The following command will then start the cache server listening on port 8080 us ``` bazel-bin/src/tools/remote_worker/remote_worker --listen_port=8080 ``` - -To connect to a running instance of Hazelcast instead, use: - -``` -bazel-bin/src/tools/remote_worker/remote_worker --listen_port=8080 --hazelcast_node=address:port -``` - -If you want to change Hazelcast settings to enable distributed memory cache you can provide your own hazelcast.xml with the following command: - -``` -bazel-bin/src/tools/remote_worker/remote_worker --jvm_flags=-Dhazelcast.config=/path/to/hz.xml --listen_port 8080 -``` - -You can copy and edit the [default](https://github.com/hazelcast/hazelcast/blob/master/hazelcast/src/main/resources/hazelcast-default.xml) Hazelcast configuration. Refer to Hazelcast [manual](http://docs.hazelcast.org/docs/3.6/manual/html-single/index.html#checking-configuration) -for more details. diff --git a/src/main/java/com/google/devtools/build/lib/remote/RemoteOptions.java b/src/main/java/com/google/devtools/build/lib/remote/RemoteOptions.java index fdf4c93d5f..7ad4b05b6f 100644 --- a/src/main/java/com/google/devtools/build/lib/remote/RemoteOptions.java +++ b/src/main/java/com/google/devtools/build/lib/remote/RemoteOptions.java @@ -49,38 +49,6 @@ public final class RemoteOptions extends OptionsBase { public int restCachePoolSize; @Option( - name = "hazelcast_node", - defaultValue = "null", - category = "remote", - documentationCategory = OptionDocumentationCategory.UNCATEGORIZED, - effectTags = {OptionEffectTag.UNKNOWN}, - help = "A comma separated list of hostnames of hazelcast nodes." - ) - public String hazelcastNode; - - @Option( - name = "hazelcast_client_config", - defaultValue = "null", - category = "remote", - documentationCategory = OptionDocumentationCategory.UNCATEGORIZED, - effectTags = {OptionEffectTag.UNKNOWN}, - help = "A file path to a hazelcast client config XML file." - ) - public String hazelcastClientConfig; - - @Option( - name = "hazelcast_standalone_listen_port", - defaultValue = "0", - category = "build_worker", - documentationCategory = OptionDocumentationCategory.UNCATEGORIZED, - effectTags = {OptionEffectTag.UNKNOWN}, - help = - "Runs an embedded hazelcast server that listens to this port. The server does not join" - + " any cluster. This is useful for testing." - ) - public int hazelcastStandaloneListenPort; - - @Option( name = "remote_executor", defaultValue = "null", category = "remote", diff --git a/src/main/java/com/google/devtools/build/lib/remote/SimpleBlobStoreFactory.java b/src/main/java/com/google/devtools/build/lib/remote/SimpleBlobStoreFactory.java index 1f86270a56..e9ffe2aa5a 100644 --- a/src/main/java/com/google/devtools/build/lib/remote/SimpleBlobStoreFactory.java +++ b/src/main/java/com/google/devtools/build/lib/remote/SimpleBlobStoreFactory.java @@ -16,65 +16,21 @@ package com.google.devtools.build.lib.remote; import static com.google.common.base.Preconditions.checkNotNull; -import com.google.devtools.build.lib.remote.blobstore.ConcurrentMapBlobStore; import com.google.devtools.build.lib.remote.blobstore.OnDiskBlobStore; import com.google.devtools.build.lib.remote.blobstore.RestBlobStore; import com.google.devtools.build.lib.remote.blobstore.SimpleBlobStore; import com.google.devtools.build.lib.vfs.Path; -import com.hazelcast.client.HazelcastClient; -import com.hazelcast.client.config.ClientConfig; -import com.hazelcast.client.config.ClientNetworkConfig; -import com.hazelcast.client.config.XmlClientConfigBuilder; -import com.hazelcast.config.Config; -import com.hazelcast.core.Hazelcast; -import com.hazelcast.core.HazelcastInstance; import java.io.IOException; -import java.util.concurrent.ConcurrentMap; import javax.annotation.Nullable; /** * A factory class for providing a {@link SimpleBlobStore} to be used with {@link - * SimpleBlobStoreActionCache}. Currently implemented with Hazelcast, REST or local. + * SimpleBlobStoreActionCache}. Currently implemented with REST or local. */ public final class SimpleBlobStoreFactory { - private static final String HAZELCAST_CACHE_NAME = "hazelcast-build-cache"; - private SimpleBlobStoreFactory() {} - /** Construct a {@link SimpleBlobStore} using Hazelcast's version of {@link ConcurrentMap} */ - public static SimpleBlobStore createHazelcast(RemoteOptions options) { - HazelcastInstance instance; - if (options.hazelcastClientConfig != null) { - try { - ClientConfig config = new XmlClientConfigBuilder(options.hazelcastClientConfig).build(); - instance = HazelcastClient.newHazelcastClient(config); - } catch (IOException e) { - throw new RuntimeException(e); - } - } else if (options.hazelcastNode != null) { - // If --hazelcast_node is specified then create a client instance. - ClientConfig config = new ClientConfig(); - ClientNetworkConfig net = config.getNetworkConfig(); - net.addAddress(options.hazelcastNode.split(",")); - instance = HazelcastClient.newHazelcastClient(config); - } else if (options.hazelcastStandaloneListenPort != 0) { - Config config = new Config(); - config - .getNetworkConfig() - .setPort(options.hazelcastStandaloneListenPort) - .getJoin() - .getMulticastConfig() - .setEnabled(false); - instance = Hazelcast.newHazelcastInstance(config); - } else { - // Otherwise create a default instance. This is going to look at - // -Dhazelcast.config=some-hazelcast.xml for configuration. - instance = Hazelcast.newHazelcastInstance(); - } - return new ConcurrentMapBlobStore(instance.<String, byte[]>getMap(HAZELCAST_CACHE_NAME)); - } - public static SimpleBlobStore createRest(RemoteOptions options) throws IOException { return new RestBlobStore(options.remoteRestCache, options.restCachePoolSize); } @@ -87,9 +43,6 @@ public final class SimpleBlobStoreFactory { public static SimpleBlobStore create(RemoteOptions options, @Nullable Path workingDirectory) throws IOException { - if (isHazelcastOptions(options)) { - return createHazelcast(options); - } if (isRestUrlOptions(options)) { return createRest(options); } @@ -98,23 +51,17 @@ public final class SimpleBlobStoreFactory { } throw new IllegalArgumentException( "Unrecognized concurrent map RemoteOptions: must specify " - + "either Hazelcast, Rest URL, or local cache options."); + + "either Rest URL, or local cache options."); } public static boolean isRemoteCacheOptions(RemoteOptions options) { - return isHazelcastOptions(options) || isRestUrlOptions(options) || isLocalDiskCache(options); + return isRestUrlOptions(options) || isLocalDiskCache(options); } public static boolean isLocalDiskCache(RemoteOptions options) { return options.experimentalLocalDiskCache; } - private static boolean isHazelcastOptions(RemoteOptions options) { - return options.hazelcastNode != null - || options.hazelcastClientConfig != null - || options.hazelcastStandaloneListenPort != 0; - } - private static boolean isRestUrlOptions(RemoteOptions options) { return options.remoteRestCache != null; } |