/** * Returns a connection with name {@code pipeName}. If a connection with this * name does not exist prior to the call, it is created. * * @param pipeName * The name of the pipe. * * @return The acquired pipe. * * @throws IllegalArgumentException * If the pipe name is null or empty. */ public Pipe acquirePipe(final String pipeName) throws IllegalArgumentException { synchronized (this) { if ((pipeName == null) || (pipeName.length() == 0)) { // LOG.error(errorMsg); no need to log if thrown throw new IllegalArgumentException("pipeName must not be null or empty! (Found: " + pipeName + ")"); } final Pipe newPipe = new Pipe(pipeName); final Pipe conn = this.pipeMap.putIfAbsent(pipeName, newPipe); if (conn == null) { return newPipe; } else { return conn; } } } }
/** * Returns a connection with name {@code pipeName}. If a connection with this * name does not exist prior to the call, it is created. * * @param pipeName * The name of the pipe. * * @return The acquired pipe. * * @throws IllegalArgumentException * If the pipe name is null or empty. */ public Pipe acquirePipe(final String pipeName) throws IllegalArgumentException { Pipe conn; synchronized (this) { if ((pipeName == null) || (pipeName.length() == 0)) { // LOG.error(errorMsg); no need to log if thrown throw new IllegalArgumentException("pipeName must not be null or empty! (Found: " + pipeName + ")"); } final Pipe newPipe = new Pipe(pipeName); conn = this.pipeMap.putIfAbsent(pipeName, newPipe); if (conn == null) { return newPipe; } else { return conn; } } } }