Message8778

Author zyasoft
Recipients zyasoft
Date 2014-06-20.20:51:25
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1403297486.04.0.319686024958.issue2135@psf.upfronthosting.co.za>
In-reply-to
Content
More thoughts:

1. Use org.python.core.ContextManager support to help with inlining of code, vs just the simple approach of adding __enter__ and __exit__ in PyJavaType.

2. Should also support resources that are not AutoCloseable, but could be if there wasn't an issue with checked exceptions, especially InterruptibleException. So in particular, there's this requirement for AutoCloseable:

> Implementers of this interface are also strongly advised to not have the close method throw InterruptedException. This exception interacts with a thread's interrupted status, and runtime misbehavior is likely to occur if an InterruptedException is suppressed. More generally, if it would cause problems for an exception to be suppressed, the AutoCloseable.close method should not throw it.

However, this is not an issue for Jython - we don't need to suppress such exceptions. In particular, this means that we can also support java.util.concurrent.lock.Lock such that __enter__ calls lockInterruptibly;__exit__ calls release. During the Java 7 PEP cycle on try-with-resource it was realized this could not be done with Java, but no issues again with Jython.
History
Date User Action Args
2014-06-20 20:51:26zyasoftsetmessageid: <1403297486.04.0.319686024958.issue2135@psf.upfronthosting.co.za>
2014-06-20 20:51:26zyasoftsetrecipients: + zyasoft
2014-06-20 20:51:26zyasoftlinkissue2135 messages
2014-06-20 20:51:25zyasoftcreate