Source:
public synchronized WorkManager createWorkManager(String id, String name) { if (id == null || id.trim().equals("")) throw new IllegalArgumentException("The id of WorkManager is invalid: " + id); if (activeWorkmanagers.keySet().contains(id)) { if (trace) log.tracef("RefCounting WorkManager: %s", id); Integer i = refCountWorkmanagers.get(id); refCountWorkmanagers.put(id, Integer.valueOf(i.intValue() + 1)); WorkManager wm = activeWorkmanagers.get(id); if (wm instanceof DistributedWorkManager) { DistributedWorkManager dwm = (DistributedWorkManager)wm; if (dwm.getTransport() != null) dwm.getTransport().register(new Address(wm.getId(), wm.getName(), dwm.getTransport().getId())); } return wm; } try { WorkManager template = null; if (name != null) { template = workmanagers.get(name); } else { template = defaultWorkManager; } if (template == null) throw new IllegalArgumentException("The WorkManager wasn't found: " + name); WorkManager wm = template.clone(); wm.setId(id); if (wm instanceof DistributedWorkManager) { DistributedWorkManager dwm = (DistributedWorkManager)wm; dwm.initialize(); if (dwm.getTransport() != null) { dwm.getTransport().register(new Address(wm.getId(), wm.getName(), dwm.getTransport().getId())); try { ((DistributedWorkManager) wm).getTransport().startup(); } catch (Throwable t) { t.printStackTrace(); } } else { log.debugf("DistributedWorkManager '%s' doesn't have a transport associated", dwm.getName()); } } activeWorkmanagers.put(id, wm); refCountWorkmanagers.put(id, Integer.valueOf(1)); if (trace) log.tracef("Created WorkManager: %s", wm); return wm; } catch (Throwable t) { throw new IllegalStateException("The WorkManager couldn't be created: " + name, t); } }

Target:
public synchronized WorkManager createWorkManager(String id, String name) { if (id == null || id.trim().equals("")) throw new IllegalArgumentException("The id of WorkManager is invalid: " + id); if (activeWorkmanagers.keySet().contains(id)) { if (trace) log.tracef("RefCounting WorkManager: %s", id); Integer i = refCountWorkmanagers.get(id); refCountWorkmanagers.put(id, Integer.valueOf(i.intValue() + 1)); WorkManager wm = activeWorkmanagers.get(id); if (wm instanceof DistributedWorkManager) { DistributedWorkManager dwm = (DistributedWorkManager)wm; if (dwm.getTransport() != null) dwm.getTransport().register(new Address(wm.getId(), wm.getName(), dwm.getTransport().getId())); } return wm; } try { WorkManager template = null; if (name != null) { template = workmanagers.get(name); } else { template = defaultWorkManager; } if (template == null) throw new IllegalArgumentException("The WorkManager wasn't found: " + name); WorkManager wm = template.clone(); wm.setId(id); if (wm instanceof DistributedWorkManager) { DistributedWorkManager dwm = (DistributedWorkManager)wm; dwm.initialize(); if (dwm.getTransport() != null) { dwm.getTransport().register(new Address(wm.getId(), wm.getName(), dwm.getTransport().getId())); try { ((DistributedWorkManager) wm).getTransport().startup(); } catch (Throwable t) { throw new ApplicationServerInternalException("Unable to start the DWM Transport ID:" + ((DistributedWorkManager) wm).getTransport().getId(), t); } } else { throw new ApplicationServerInternalException("DistributedWorkManager " + dwm.getName() + " doesn't have a transport associated"); } } activeWorkmanagers.put(id, wm); refCountWorkmanagers.put(id, Integer.valueOf(1)); if (trace) log.tracef("Created WorkManager: %s", wm); return wm; } catch (Throwable t) { throw new IllegalStateException("The WorkManager couldn't be created: " + name, t); } }