java: implement optimisation in UnoRuntime#setCurrentContext

which is now available since we started requiring Java 1.5

Change-Id: I9847b89af7f487be7812a5717716900e9a517381
This commit is contained in:
Noel Grandin
2014-08-04 14:02:40 +02:00
parent 0781dad870
commit 884e1460b9

View File

@@ -382,8 +382,11 @@ public class UnoRuntime {
* previously set context will be removed
*/
public static void setCurrentContext(XCurrentContext context) {
// optimize this by using Java 1.5 ThreadLocal.remove if context == null
currentContext.set(context);
if (context == null) {
currentContext.remove();
} else {
currentContext.set(context);
}
}
/**