You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@pekko.apache.org by "He-Pin (via GitHub)" <gi...@apache.org> on 2024/01/25 18:10:31 UTC

[I] Feature request: AutoCloseable shortcuts [incubator-pekko]

He-Pin opened a new issue, #1044:
URL: https://github.com/apache/incubator-pekko/issues/1044

   Motivation:
   Pekko has mapwithResource now, would be better to support AutoCloseable in Java/Scala dsl too.
   refs: https://github.com/reactor/reactor-core/issues/3333


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


Re: [I] Feature request: AutoCloseable shortcuts [incubator-pekko]

Posted by "pjfanning (via GitHub)" <gi...@apache.org>.
pjfanning commented on issue #1044:
URL: https://github.com/apache/incubator-pekko/issues/1044#issuecomment-1911799742

   this is not under consideration for 1.1.0-M1 and therefore PRs for this feature should be merged yet
   
   if we decide to bring this into consideration for 1.1.0-M1, it will delay it


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


Re: [I] Feature request: AutoCloseable shortcuts [incubator-pekko]

Posted by "He-Pin (via GitHub)" <gi...@apache.org>.
He-Pin commented on issue #1044:
URL: https://github.com/apache/incubator-pekko/issues/1044#issuecomment-1911760529

   @injae-kim the `using` is something like `mapWithResource` in pekko or `unfoldResource`, both method need a user to close the resource explicitly. If think if we support this, then there will be an overload method where the `close: () => Unit` is not needed.


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


Re: [I] Feature request: AutoCloseable shortcuts [incubator-pekko]

Posted by "He-Pin (via GitHub)" <gi...@apache.org>.
He-Pin closed issue #1044: Feature request: AutoCloseable shortcuts
URL: https://github.com/apache/incubator-pekko/issues/1044


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


Re: [I] Feature request: AutoCloseable shortcuts [incubator-pekko]

Posted by "He-Pin (via GitHub)" <gi...@apache.org>.
He-Pin commented on issue #1044:
URL: https://github.com/apache/incubator-pekko/issues/1044#issuecomment-1910800766

   > Can you assign this issue to me? I'll create PR tomorrow~! 🙇
   
   Thank you, I love it because I use Java everyday 


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


Re: [I] Feature request: AutoCloseable shortcuts [incubator-pekko]

Posted by "He-Pin (via GitHub)" <gi...@apache.org>.
He-Pin commented on issue #1044:
URL: https://github.com/apache/incubator-pekko/issues/1044#issuecomment-1911779320

   Nice contribution, but pekko-stream and Reactor-core work in a different way, and I'm using both simultaneously in one app, there is some test code, you can read from the java dsl tests, and thank you for your interest.


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


Re: [I] Feature request: AutoCloseable shortcuts [incubator-pekko]

Posted by "injae-kim (via GitHub)" <gi...@apache.org>.
injae-kim commented on issue #1044:
URL: https://github.com/apache/incubator-pekko/issues/1044#issuecomment-1911752848

   > https://github.com/reactor/reactor-core/pull/3704 Add AutoCloseable shourtcut on Flux#using, Mono#using
   
   ```java
   	public static <T, D extends AutoCloseable> Flux<T> using(Callable<D> resourceSupplier,
   			Function<? super D, ? extends Publisher<? extends T>> sourceSupplier) {
   		return using(resourceSupplier, sourceSupplier, AUTO_CLOSE, true);
   	}
   
   	static final Consumer<? super AutoCloseable> AUTO_CLOSE = resource -> {
   		try {
   			resource.close(); //👈 simply close the autocloseable
   		} catch (Exception e) {
   			throw new RuntimeException(e);
   		}
   	};
   ```
    Hi @mdedetrich ! On above PR on reactor, I use `<D extends AutoCloseable>` to support only `AutoCloseable` shortcut.
   and simply close it cause we usually think that it's okay to close `AutoCloseable`.
   
   WDYT? you mean we should handle or provide a way to user when `autoCloseable.close()` throw exception?


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


Re: [I] Feature request: AutoCloseable shortcuts [incubator-pekko]

Posted by "injae-kim (via GitHub)" <gi...@apache.org>.
injae-kim commented on issue #1044:
URL: https://github.com/apache/incubator-pekko/issues/1044#issuecomment-1911769702

   > then there will be an `overload method` where the close: () => Unit is not needed.
   
   aha~ then I'll create PR in this way. let's discuss more details about `cancellation of resources` on PR~! thanks!


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


Re: [I] Feature request: AutoCloseable shortcuts [incubator-pekko]

Posted by "He-Pin (via GitHub)" <gi...@apache.org>.
He-Pin commented on issue #1044:
URL: https://github.com/apache/incubator-pekko/issues/1044#issuecomment-1911838821

   It's not in 1.1.0-m1  depends on the status, may be in 1.2.x


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


Re: [I] Feature request: AutoCloseable shortcuts [incubator-pekko]

Posted by "mdedetrich (via GitHub)" <gi...@apache.org>.
mdedetrich commented on issue #1044:
URL: https://github.com/apache/incubator-pekko/issues/1044#issuecomment-1911728721

   We should discuss this properly because supporting cancellation of resources properly is very difficult to get right


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


Re: [I] Feature request: AutoCloseable shortcuts [incubator-pekko]

Posted by "injae-kim (via GitHub)" <gi...@apache.org>.
injae-kim commented on issue #1044:
URL: https://github.com/apache/incubator-pekko/issues/1044#issuecomment-1910789450

   Can you assign this issue to me? I'll create PR tomorrow~! 🙇


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org