Source:
<code><START> synchronized void createWires() { END> logger.debug(message.creatingWires()); final List<WireConfiguration> cloned = CollectionUtil.newArrayList(); for (final WireConfiguration wc : this.wireConfigs) { cloned.add(new WireConfiguration(wc.getEmitterPid(), wc.getReceiverPid(), wc.getFilter())); } for (final WireConfiguration conf : cloned) { final String emitterPid = conf.getEmitterPid(); final String receiverPid = conf.getReceiverPid(); final boolean emitterFound = this.wireComponentTrackerCustomizer.getWireEmitters().contains(emitterPid); final boolean receiverFound = this.wireComponentTrackerCustomizer.getWireReceivers().contains(receiverPid); if (emitterFound && receiverFound) { logger.info(message.creatingWire(emitterPid, receiverPid)); final String emitterServicePid = this.wireHelperService.getServicePid(emitterPid); final String receiverServicePid = this.wireHelperService.getServicePid(receiverPid); if (emitterServicePid != null && receiverServicePid != null) { if (conf.getWire() == null) { try { final Wire[] wires = this.wireAdmin.getWires(null); boolean found = false; if (wires != null) { for (final Wire w : wires) { if (w.getProperties().get(WIREADMIN_PRODUCER_PID).equals(emitterServicePid) && w .getProperties().get(WIREADMIN_CONSUMER_PID).equals(receiverServicePid)) { found = true; break; } } } if (!found) { final Wire wire = this.wireAdmin.createWire(emitterServicePid, receiverServicePid, null); conf.setWire(wire); } } catch (final InvalidSyntaxException e) { logger.error(message.errorCreatingWires(), e); } } } } } logger.debug(message.creatingWiresDone()); }</code><technical_language>If want refactor, do this PR</technical_language>

Target:
synchronized void createWires() { logger.debug(message.creatingWires()); final List<WireConfiguration> cloned = CollectionUtil.newArrayList(); for (final WireConfiguration wc : this.wireConfigs) { cloned.add(new WireConfiguration(wc.getEmitterPid(), wc.getReceiverPid(), wc.getFilter())); } for (final WireConfiguration conf : cloned) { final String emitterPid = conf.getEmitterPid(); final String receiverPid = conf.getReceiverPid(); final boolean emitterFound = this.wireComponentTrackerCustomizer.getWireEmitters().contains(emitterPid); final boolean receiverFound = this.wireComponentTrackerCustomizer.getWireReceivers().contains(receiverPid); if (emitterFound && receiverFound) { logger.info(message.creatingWire(emitterPid, receiverPid)); final String emitterServicePid = this.wireHelperService.getServicePid(emitterPid); final String receiverServicePid = this.wireHelperService.getServicePid(receiverPid); if (emitterServicePid != null && receiverServicePid != null) { if (conf.getWire() == null) { try { final Wire[] wires = this.wireAdmin.getWires(conf.getFilter()); boolean found = false; if (wires != null) { for (final Wire w : wires) { if (w.getProperties().get(WIREADMIN_PRODUCER_PID).equals(emitterServicePid) && w .getProperties().get(WIREADMIN_CONSUMER_PID).equals(receiverServicePid)) { found = true; break; } } } if (!found) { final Wire wire = this.wireAdmin.createWire(emitterServicePid, receiverServicePid, null); conf.setWire(wire); } } catch (final InvalidSyntaxException e) { logger.error(message.errorCreatingWires(), e); } } } } } logger.debug(message.creatingWiresDone()); }