You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by GitBox <gi...@apache.org> on 2020/08/18 10:20:53 UTC
[GitHub] [httpcomponents-core] michael-o opened a new pull request #219: Use decimal numbers for endpoint/execution IDs
michael-o opened a new pull request #219:
URL: https://github.com/apache/httpcomponents-core/pull/219
As discussed some time ago on the dev mailing list.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org
[GitHub] [httpcomponents-core] michael-o commented on a change in pull request #219: Use decimal numbers for endpoint/execution IDs
Posted by GitBox <gi...@apache.org>.
michael-o commented on a change in pull request #219:
URL: https://github.com/apache/httpcomponents-core/pull/219#discussion_r472141247
##########
File path: httpcore5/src/main/java/org/apache/hc/core5/reactor/IOSessionImpl.java
##########
@@ -71,7 +71,7 @@ public IOSessionImpl(final String type, final SelectionKey key, final SocketChan
this.commandQueue = new ConcurrentLinkedDeque<>();
this.lock = new ReentrantLock();
this.socketTimeout = Timeout.DISABLED;
- this.id = String.format(type + "-%08X", COUNT.getAndIncrement());
+ this.id = String.format(type + "-%08d", COUNT.getAndIncrement());
Review comment:
@carterkozak While you are right, it should not read as an array. That's the whole point.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org
[GitHub] [httpcomponents-core] asfgit merged pull request #219: Use decimal numbers for endpoint/execution IDs
Posted by GitBox <gi...@apache.org>.
asfgit merged pull request #219:
URL: https://github.com/apache/httpcomponents-core/pull/219
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org
[GitHub] [httpcomponents-core] ok2c commented on a change in pull request #219: Use decimal numbers for endpoint/execution IDs
Posted by GitBox <gi...@apache.org>.
ok2c commented on a change in pull request #219:
URL: https://github.com/apache/httpcomponents-core/pull/219#discussion_r472131921
##########
File path: httpcore5/src/main/java/org/apache/hc/core5/reactor/IOSessionImpl.java
##########
@@ -71,7 +71,7 @@ public IOSessionImpl(final String type, final SelectionKey key, final SocketChan
this.commandQueue = new ConcurrentLinkedDeque<>();
this.lock = new ReentrantLock();
this.socketTimeout = Timeout.DISABLED;
- this.id = String.format(type + "-%08X", COUNT.getAndIncrement());
+ this.id = String.format(type + "-%08d", COUNT.getAndIncrement());
Review comment:
@michael-o Fair enough.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org
[GitHub] [httpcomponents-core] carterkozak commented on a change in pull request #219: Use decimal numbers for endpoint/execution IDs
Posted by GitBox <gi...@apache.org>.
carterkozak commented on a change in pull request #219:
URL: https://github.com/apache/httpcomponents-core/pull/219#discussion_r472113524
##########
File path: httpcore5/src/main/java/org/apache/hc/core5/reactor/IOSessionImpl.java
##########
@@ -71,7 +71,7 @@ public IOSessionImpl(final String type, final SelectionKey key, final SocketChan
this.commandQueue = new ConcurrentLinkedDeque<>();
this.lock = new ReentrantLock();
this.socketTimeout = Timeout.DISABLED;
- this.id = String.format(type + "-%08X", COUNT.getAndIncrement());
+ this.id = String.format(type + "-%08d", COUNT.getAndIncrement());
Review comment:
If the padding isn't important and we're okay with ambiguous substring matches, it could be worth considering simple concatenation to avoid poor String.format performance until we get something like [jep-348](https://openjdk.java.net/jeps/348).
```suggestion
this.id = type + "-" + COUNT.getAndIncrement();
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org
[GitHub] [httpcomponents-core] ok2c commented on a change in pull request #219: Use decimal numbers for endpoint/execution IDs
Posted by GitBox <gi...@apache.org>.
ok2c commented on a change in pull request #219:
URL: https://github.com/apache/httpcomponents-core/pull/219#discussion_r472106709
##########
File path: httpcore5/src/main/java/org/apache/hc/core5/reactor/IOSessionImpl.java
##########
@@ -71,7 +71,7 @@ public IOSessionImpl(final String type, final SelectionKey key, final SocketChan
this.commandQueue = new ConcurrentLinkedDeque<>();
this.lock = new ReentrantLock();
this.socketTimeout = Timeout.DISABLED;
- this.id = String.format(type + "-%08X", COUNT.getAndIncrement());
+ this.id = String.format(type + "-%08d", COUNT.getAndIncrement());
Review comment:
@michael-o `08d` would not be enough for a LONG value, would it? Should not it be 20?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org
[GitHub] [httpcomponents-core] michael-o commented on pull request #219: Use decimal numbers for endpoint/execution IDs
Posted by GitBox <gi...@apache.org>.
michael-o commented on pull request #219:
URL: https://github.com/apache/httpcomponents-core/pull/219#issuecomment-675451204
My counter proposal is to follow @ok2c and increase to 10. This makes by default possible to fit multiples of `Integer.MAX_VALUE` and still retain a not too long string. Everything else will need to scale. Having no padding as @carterkozak proposed requires less operations in the JVM, but the will leave logging like a flush left text, hard to follow with the eye.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org
[GitHub] [httpcomponents-core] ok2c commented on a change in pull request #219: Use decimal numbers for endpoint/execution IDs
Posted by GitBox <gi...@apache.org>.
ok2c commented on a change in pull request #219:
URL: https://github.com/apache/httpcomponents-core/pull/219#discussion_r472128154
##########
File path: httpcore5/src/main/java/org/apache/hc/core5/reactor/IOSessionImpl.java
##########
@@ -71,7 +71,7 @@ public IOSessionImpl(final String type, final SelectionKey key, final SocketChan
this.commandQueue = new ConcurrentLinkedDeque<>();
this.lock = new ReentrantLock();
this.socketTimeout = Timeout.DISABLED;
- this.id = String.format(type + "-%08X", COUNT.getAndIncrement());
+ this.id = String.format(type + "-%08d", COUNT.getAndIncrement());
Review comment:
> @ok2c I agree in general. I think we need to add 60%, why 16 (base)/10 (base) = 1,6. So 13 or 14. I am also OK with 20 which, though, seems quite long to me.
@michael-o Is not `9,223,372,036,854,775,807`longest possible LONG?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org
[GitHub] [httpcomponents-core] michael-o commented on a change in pull request #219: Use decimal numbers for endpoint/execution IDs
Posted by GitBox <gi...@apache.org>.
michael-o commented on a change in pull request #219:
URL: https://github.com/apache/httpcomponents-core/pull/219#discussion_r472130234
##########
File path: httpcore5/src/main/java/org/apache/hc/core5/reactor/IOSessionImpl.java
##########
@@ -71,7 +71,7 @@ public IOSessionImpl(final String type, final SelectionKey key, final SocketChan
this.commandQueue = new ConcurrentLinkedDeque<>();
this.lock = new ReentrantLock();
this.socketTimeout = Timeout.DISABLED;
- this.id = String.format(type + "-%08X", COUNT.getAndIncrement());
+ this.id = String.format(type + "-%08d", COUNT.getAndIncrement());
Review comment:
>
>
> > @ok2c I agree in general. I think we need to add 60%, why 16 (base)/10 (base) = 1,6. So 13 or 14. I am also OK with 20 which, though, seems quite long to me.
>
> @michael-o Is not `9,223,372,036,854,775,807`longest possible LONG?
That's correct. I wanted to make a compromise. Having `ex-00000000000000000001` looks awkward.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org
[GitHub] [httpcomponents-core] carterkozak commented on a change in pull request #219: Use decimal numbers for endpoint/execution IDs
Posted by GitBox <gi...@apache.org>.
carterkozak commented on a change in pull request #219:
URL: https://github.com/apache/httpcomponents-core/pull/219#discussion_r472132723
##########
File path: httpcore5/src/main/java/org/apache/hc/core5/reactor/IOSessionImpl.java
##########
@@ -71,7 +71,7 @@ public IOSessionImpl(final String type, final SelectionKey key, final SocketChan
this.commandQueue = new ConcurrentLinkedDeque<>();
this.lock = new ReentrantLock();
this.socketTimeout = Timeout.DISABLED;
- this.id = String.format(type + "-%08X", COUNT.getAndIncrement());
+ this.id = String.format(type + "-%08d", COUNT.getAndIncrement());
Review comment:
Another option is to exclude padding in favor of a trailing separator for concise identifiers that cannot be ambiguous:
```java
this.id = type + "[" + COUNT.getAndIncrement() + "]";
```
This solves the problem grepping between `ex-1` and `ex-10` by producing values `ex[1]` and `ex[10]`, and in my opinion is easier for humans to quickly parse without N leading zero characters. What do you think?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org
[GitHub] [httpcomponents-core] michael-o commented on a change in pull request #219: Use decimal numbers for endpoint/execution IDs
Posted by GitBox <gi...@apache.org>.
michael-o commented on a change in pull request #219:
URL: https://github.com/apache/httpcomponents-core/pull/219#discussion_r472126151
##########
File path: httpcore5/src/main/java/org/apache/hc/core5/reactor/IOSessionImpl.java
##########
@@ -71,7 +71,7 @@ public IOSessionImpl(final String type, final SelectionKey key, final SocketChan
this.commandQueue = new ConcurrentLinkedDeque<>();
this.lock = new ReentrantLock();
this.socketTimeout = Timeout.DISABLED;
- this.id = String.format(type + "-%08X", COUNT.getAndIncrement());
+ this.id = String.format(type + "-%08d", COUNT.getAndIncrement());
Review comment:
@ok2c I agree in general. I think we need to add 60%, why 16 (base)/10 (base) = 1,6. So 13 or 14. I am also OK with 20 which, though, seems quite long to me.
@carterkozak I can live with both. Whatever the community seems better readable/greppable.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org
[GitHub] [httpcomponents-core] michael-o commented on a change in pull request #219: Use decimal numbers for endpoint/execution IDs
Posted by GitBox <gi...@apache.org>.
michael-o commented on a change in pull request #219:
URL: https://github.com/apache/httpcomponents-core/pull/219#discussion_r472141247
##########
File path: httpcore5/src/main/java/org/apache/hc/core5/reactor/IOSessionImpl.java
##########
@@ -71,7 +71,7 @@ public IOSessionImpl(final String type, final SelectionKey key, final SocketChan
this.commandQueue = new ConcurrentLinkedDeque<>();
this.lock = new ReentrantLock();
this.socketTimeout = Timeout.DISABLED;
- this.id = String.format(type + "-%08X", COUNT.getAndIncrement());
+ this.id = String.format(type + "-%08d", COUNT.getAndIncrement());
Review comment:
@carterkozak While you are right, it should read as an array. That's the whole point.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org