On 13 May 2014, at 19:53, Seán Coffey <sean.cof...@oracle.com> wrote:
> That's some nice code reduction Paul. Thanks. > > http://cr.openjdk.java.net/~coffeys/webrev.8042906.v3/webrev/ > > I'll push these changes later unless I hear to the contrary. Push it quick! -Chris. > > regards, > Sean. > > On 13/05/2014 11:22, Paul Sandoz wrote: >> On May 13, 2014, at 11:34 AM, Seán Coffey <sean.cof...@oracle.com> wrote: >> >>> thanks for the comments. I hit a build issue when introducing some lambda >>> syntax to the corba repo : https://bugs.openjdk.java.net/browse/JDK-8042932 >>> >>> That's fixed now and I can continue with the corba push. I've cleaned up >>> the ORB class to make better use of generics and the diamond operator. >>> Removed some unused package imports also. Taken Daniel's suggestion to use >>> ConcurrentHashMap on board (and removed the sync block) >>> >>> http://cr.openjdk.java.net/~coffeys/webrev.8042906.v2/webrev/ >>> >> There are also some compute-if-absent patterns that might be applicable: >> >> 503 public LogWrapperBase getLogWrapper(String logDomain, >> 504 String exceptionGroup, LogWrapperFactory factory) >> 505 { >> 506 StringPair key = new StringPair(logDomain, exceptionGroup); >> 507 >> 508 LogWrapperBase logWrapper = wrapperMap.get(key); >> 509 if (logWrapper == null) { >> 510 logWrapper = factory.create(getLogger(logDomain)); >> 511 wrapperMap.put(key, logWrapper); >> 512 } >> 513 >> 514 return logWrapper; >> 515 } >> 516 >> 517 /** get the log wrapper class (its type is dependent on the >> exceptionGroup) for the >> 518 * given log domain and exception group in this ORB instance. >> 519 */ >> 520 public static LogWrapperBase staticGetLogWrapper(String logDomain, >> 521 String exceptionGroup, LogWrapperFactory factory) >> 522 { >> 523 StringPair key = new StringPair(logDomain, exceptionGroup); >> 524 >> 525 LogWrapperBase logWrapper = staticWrapperMap.get(key); >> 526 if (logWrapper == null) { >> 527 logWrapper = factory.create( staticGetLogger(logDomain)); >> 528 staticWrapperMap.put(key, logWrapper); >> 529 } >> 530 >> 531 return logWrapper; >> 532 } >> >> return wrapperMap.computeIfAbsent(new StringPair(...), >> x -> factory.create(....)); >> >> Paul. >