Skip to content

Commit 2f7f9dd

Browse files
authored
Removed mac-book identity override (#198)
1 parent dc75d9e commit 2f7f9dd

File tree

2 files changed

+18
-19
lines changed

2 files changed

+18
-19
lines changed

README.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ If this does not work, see instructions for running the Temporal Server at https
2727

2828
## Build a configuration
2929

30+
[Find the latest release](https://search.maven.org/artifact/io.temporal/temporal-sdk) of the Temporal Java SDK at maven central.
31+
3032
Add *temporal-sdk* as a dependency to your *pom.xml*:
3133

3234
<dependency>
@@ -39,14 +41,25 @@ or to *build.gradle*:
3941

4042
compile group: 'io.temporal', name: 'temporal-sdk', version: 'N.N.N'
4143

42-
Until the official release use the version from the temporal-java-samples [build.gradle](https://github.com/temporalio/temporal-java-samples/blob/master/build.gradle)
43-
4444
## Documentation
4545

4646
The documentation on how to use the Temporal Java client is [here](http://docs.temporal.io/docs/java-quick-start).
4747

4848
Javadocs for the client API are located [here](https://www.javadoc.io/doc/io.temporal/temporal-sdk).
4949

50+
### macOS Users
51+
Due to issues with default hostname resolution
52+
(see [this StackOverflow question](https://stackoverflow.com/questions/33289695/inetaddress-getlocalhost-slow-to-run-30-seconds) for more details),
53+
macOS Users may see gRPC `DEADLINE_EXCEEDED` errors and other slowdowns when running the SDK.
54+
55+
To solve the problem add the following entries to your `/etc/hosts` file (where my-macbook is your hostname):
56+
57+
```conf
58+
127.0.0.1 my-macbook
59+
::1 my-macbook
60+
```
61+
62+
5063
## Contributing
5164
We'd love your help in making the Temporal Java SDKL great. Please review our [contribution guidelines](CONTRIBUTING.md).
5265

src/main/java/io/temporal/client/WorkflowClientOptions.java

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,8 @@ public Builder setInterceptors(WorkflowClientInterceptor... interceptors) {
103103
* Override human readable identity of the worker. Identity is used to identify a worker and is
104104
* recorded in the workflow history events. For example when a worker gets an activity task the
105105
* correspondent ActivityTaskStarted event contains the worker identity as a field. Default is
106-
* "unknown-mac" string on Mac or whatever <code>(ManagementFactory.getRuntimeMXBean().getName()
107-
* </code> returns on any other platform. The reason for treating Mac differently is a very slow
108-
* local host name resolution in a default configuration.
106+
* whatever <code>(ManagementFactory.getRuntimeMXBean().getName()
107+
* </code> returns.
109108
*/
110109
public Builder setIdentity(String identity) {
111110
this.identity = identity;
@@ -139,20 +138,7 @@ public WorkflowClientOptions build() {
139138
}
140139

141140
public WorkflowClientOptions validateAndBuildWithDefaults() {
142-
String name;
143-
if (identity == null) {
144-
String osName = System.getProperty("os.name");
145-
// On mac by default getLocalHost (which getRuntimeMXBean().getName() calls) takes long
146-
// time. So we don't set identity on mac by default to avoid the bad user experience.
147-
// https://stackoverflow.com/questions/33289695/inetaddress-getlocalhost-slow-to-run-30-seconds
148-
if (osName.toLowerCase().contains("mac")) {
149-
name = "unknown-mac";
150-
} else {
151-
name = ManagementFactory.getRuntimeMXBean().getName();
152-
}
153-
} else {
154-
name = identity;
155-
}
141+
String name = identity == null ? ManagementFactory.getRuntimeMXBean().getName() : identity;
156142
return new WorkflowClientOptions(
157143
namespace == null ? DEFAULT_NAMESPACE : namespace,
158144
dataConverter == null ? DataConverter.getDefaultInstance() : dataConverter,

0 commit comments

Comments
 (0)