dspasic commented on issue #24181:
URL: https://github.com/apache/beam/issues/24181#issuecomment-1362250796

   Hi @DhirajSardar,
   
   I already replaced all finalize methods with the Teardown Context. At least 
the ones that could be replaced with the Teardown Context. 
   
   However, as far as I can tell, we still have 7 finalize methods left that I 
don't think can be replaced with the Teardown Context.
   
   ```
    ± grep -isr 'void finalize(' ./sdks/java
   ./sdks/java/core/src/main/java/org/apache/beam/sdk/io/Read.java:      
protected void finalize() throws Throwable {
   
./sdks/java/io/amazon-web-services2/src/test/java/org/apache/beam/sdk/io/aws2/StaticSupplier.java:
  protected void finalize() {
   ./sdks/java/io/jms/src/main/java/org/apache/beam/sdk/io/jms/JmsIO.java:    
protected void finalize() {
   
./sdks/java/io/amazon-web-services/src/test/java/org/apache/beam/sdk/io/aws/dynamodb/StaticAwsClientsProvider.java:
  protected void finalize() {
   
./sdks/java/io/kafka/src/main/java/org/apache/beam/sdk/io/kafka/ReadFromKafkaDoFn.java:
    protected void finalize() {
   
./sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/pubsublite/internal/CloserReference.java:
  protected void finalize() {
   
./sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/pubsublite/internal/MemoryLimiterImpl.java:
    public void finalize() {
   ```
   
   I must admit that it is not entirely clear how to proceed here. As far as I 
can judge after the first look, you can't replace them without further ado. 
[BoundedSourceAsSDFRestrictionTracker](https://github.com/apache/beam/blob/c627e472bd727936ff15da7bbbd60e6d48c13680/sdks/java/core/src/main/java/org/apache/beam/sdk/io/Read.java#L393),
 for example, is returned in 
[BoundedSourceAsSDFWrapperFn(::restrictionTracker)](https://github.com/apache/beam/blob/c627e472bd727936ff15da7bbbd60e6d48c13680/sdks/java/core/src/main/java/org/apache/beam/sdk/io/Read.java#L531),
 and the class is used in 
[Read::expand](https://github.com/apache/beam/blob/c627e472bd727936ff15da7bbbd60e6d48c13680/sdks/java/core/src/main/java/org/apache/beam/sdk/io/Read.java#L143).
 
   
   My suggestion, in this case, would be to add a teardown context to 
BoundedSourceAsSDFWrapperFn. Also, BoundedSourceAsSDFWrapperFn must remember 
all created BoundedSourceAsSDFRestrictionTracker, which will be closed with the 
teardown context.
   
   Maybe @Abacn has some advice on how to proceed with the issue.
   
   To get back to your question. From my point of view, you are welcome to have 
a look at the other classes. If you decide to do so, we should ensure that we 
are not working on the same class in parallel. How does that sound to you?
   Looking forward to your feedback.


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to