Allow external class to notify the pool that the connection identified by the provided
jmx url is closed/in error
@param url the jmx url
343629
public void notifyConnectionDirty(String url) {
		JMXMonConnection connection = (JMXMonConnection)pool.get(url);
		
		if (connection != null){
			connection.setNewActiveConnection(null, null);
		}
	}
580633
public void removeConnectionPool(URL url) {
        RequestBuilder req = new RequestBuilder();
        req.host = url.getHost();
        req.port = url.getPort() < 0 ? url.getDefaultPort() : url.getPort();
        removePool(req);
    }
46273
private void onConnectionClosed()
   {
      ConnectionEvent evt = new ConnectionEvent(this, ConnectionEvent.CONNECTION_CLOSED);
      for (ConnectionEventListener listener : listeners)
      {
         try
         {
            listener.connectionClosed(evt);
         }
         catch (Exception e1)
         {
            LOG.warn("An error occurs while notifying the listener " + listener, e1);
         }
      }
   }
155868
def close_connection (self):
        
        if self.url_connection is None:
            # no connection is open
            return
        try:
            self.url_connection.close()
        except Exception:
            # ignore close errors
            pass
        self.url_connection = None
411705
@Override
    public void connectionClosed(ConnectionEvent event) {

        final boolean isTracingEnabled = TraceComponent.isAnyTracingEnabled();

        if (isTracingEnabled && tc.isEntryEnabled()) {
            Tr.entry(this, tc, "connectionClosed");
        }

        if (event.getId() == ConnectionEvent.CONNECTION_CLOSED) {
            if (!mcWrapper.isParkedWrapper()) {

                if (isTracingEnabled && tc.isDebugEnabled()) {
                    //Tr.debug(this, tc, "Closing handle for ManagedConnection@" + Integer.toHexString(mc.hashCode()) + " from pool " + mcWrapper.gConfigProps.pmiName + " from mcWrapper " + mcWrapper.toString() + " from mc " + mc);
                    // Omit handle info.
                    //Tr.debug(this, tc, "***Connection Close Request*** Handle Name: " + event.getConnectionHandle().toString() + "  Connection Pool: " + mcWrapper.getPoolManager().toString() + "  Details: : " + mcWrapper.toString() );
                    //          I only removed the connection handle toString, since this is the one getting the null pointer exception.
                    //          The trace component code will check for null first before calling toString on the handle.
                    //          Any new debug should not use the .toString() to prevent null pointer exceptions in trace.
                    //          Changed trace string to only dump pool manager name not entire pool.
                    Tr.debug(this, tc, "***Connection Close Request*** Handle Name: " + event.getConnectionHandle() + "  Connection Pool: "
                                       + mcWrapper.getPoolManager().getGConfigProps().getXpathId() + "  Details: : " + mcWrapper);

                }

                ConnectionManager cm = mcWrapper.getConnectionManagerWithoutStateCheck();

                if (cm != null && cm.handleToThreadMap != null) {
                    cm.handleToThreadMap.clear();
                }
                if (cm != null && cm.handleToCMDMap != null) {
                    cm.handleToCMDMap.clear();
                }

                if (!(mcWrapper.gConfigProps.isSmartHandleSupport() && (cm != null && cm.shareable()))) {

                    Object conHandle = event.getConnectionHandle();
                    if (null == conHandle) {
                        Tr.warning(tc, "CONNECTION_CLOSED_NULL_HANDLE_J2CA0148", event);
                    } else {
                        mcWrapper.removeFromHandleList(conHandle);
                        // TODO - need to implement - Notify the CHM to stop tracking the handle because it has been closed.
                    }
                }

                /*
                 * Decrement the number of open connections for Managed Connection and see if
                 * all the connections are now closed. If they are all closed and the MC is not
                 * associated with a transaction, then return it to the pool. If all the handles
                 * are closed and the MC is associated with a transaction, then do nothing.
                 * The MC will be released back to the pool at the end of the transaction when
                 * afterCompletion is called on one of the transactional wrapper objects.
                 */
                mcWrapper.decrementHandleCount();

                if (mcWrapper.getHandleCount() == 0) {

                    /*
                     * If we are processing a NoTransaction resource, then we are essentially done with
                     * the "transaction" when all of the connection handles are closed. We have to
                     * perform this extra cleanup because of the dual purpose of the involvedInTransaction
                     * method on the MCWrapper.
                     */

                    if (mcWrapper.getTranWrapperId() == MCWrapper.NOTXWRAPPER) {
                        mcWrapper.transactionComplete();
                    }

                    // Deleted calling mcWrapper.transactionComplete() for RRS Local Tran

                    /*
                     * If the ManagedConnection is not associated with a
                     * transaction any more, return it to the pool.
                     */

                    if (!mcWrapper.involvedInTransaction()) {

                        /*
                         * The ManagedConnection is not associated with a transactional
                         * context so return it to the pool. We need to check if the MC was
                         * shareable or not. If it was shareable, then we need to extract the
                         * coordinator from the MCWrapper and send it into releaseToPoolManager.
                         * If it was unshareable, then we just pass null into the
                         * releaseToPoolManager method and it releases it back to the pool.
                         */

                        try {
                            mcWrapper.releaseToPoolManager();
                        } catch (Exception ex) {
                            // Nothing to do here. PoolManager has already logged it.
                            // Since we are in cleanup mode, we will not surface a Runtime exception to the ResourceAdapter
                            FFDCFilter.processException(ex, "com.ibm.ejs.j2c.ConnectionEventListener.connectionClosed", "197", this);
                            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                                Tr.debug(this, tc,
                                         "connectionClosed: Closing connection in pool " + mcWrapper.gConfigProps.getXpathId()
                                                   + " caught exception, but will continue processing: ",
                                         ex);
                            }
                        }
                    }
                }
            }
        } else {
            // Connection Event passed in doesn't match the method called.
            // This should never happen unless there is an error in the ResourceAdapter.
            processBadEvent("connectionClosed", ConnectionEvent.CONNECTION_CLOSED, event);
        }

        if (isTracingEnabled && tc.isEntryEnabled()) {
            Tr.exit(this, tc, "connectionClosed");
        }

        return;

    }
77100
public static void browse(String url) {
    Preconditions.checkNotNull(url);
    // Ask user to open in their browser using copy-paste
    System.out.println("Please open the following address in your browser:");
    System.out.println("  " + url);
    // Attempt to open it in the browser
    try {
      if (Desktop.isDesktopSupported()) {
        Desktop desktop = Desktop.getDesktop();
        if (desktop.isSupported(Action.BROWSE)) {
          System.out.println("Attempting to open that address in the default browser now...");
          desktop.browse(URI.create(url));
        }
      }
    } catch (IOException e) {
      LOGGER.log(Level.WARNING, "Unable to open browser", e);
    } catch (InternalError e) {
      // A bug in a JRE can cause Desktop.isDesktopSupported() to throw an
      // InternalError rather than returning false. The error reads,
      // "Can't connect to X11 window server using ':0.0' as the value of the
      // DISPLAY variable." The exact error message may vary slightly.
      LOGGER.log(Level.WARNING, "Unable to open browser", e);
    }
  }
1336690
public static synchronized void sse(String url) {
        checkStarted();
        instance().endpoints.add(HandlerUtil.sse(url, null));
    }
906447
void checkClosed() throws JMSException {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "checkClosed");

        synchronized (closedLock) {
            if (closed) {
                throw (JMSException) JmsErrorUtils.newThrowable(javax.jms.IllegalStateException.class,
                                                                "CONSUMER_CLOSED_CWSIA0081",
                                                                null,
                                                                tc);
            }
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "checkClosed");
    }
1299758
public static void close(String poolName) {
    if (poolName == null) {
      return;
    }
    synchronized (poolMap) {
      for (Pool pool : poolMap.values()) {
        if (poolName.equals(pool.getUrlParser().getOptions().poolName)) {
          try {
            pool.close();
          } catch (InterruptedException exception) {
            //eat
          }
          poolMap.remove(pool.getUrlParser());
          return;
        }
      }

      if (poolMap.isEmpty()) {
        shutdownExecutor();
      }
    }
  }
293465
private static void launchServer(final String url,
                                     final CloseableHttpClient client) {
        try {
            final JDialog dialog = new JDialog();
            dialog.setSize(new java.awt.Dimension(400, 75));
            dialog.setModalityType(ModalityType.MODELESS);
            dialog.setTitle("DuraCloud Sync");
            dialog.setLocationRelativeTo(null);

            JPanel panel = new JPanel();
            final JLabel label = new JLabel("Loading...");
            final JProgressBar progress = new JProgressBar();
            progress.setStringPainted(true);

            panel.add(label);
            panel.add(progress);
            dialog.add(panel);
            dialog.setVisible(true);

            port = SyncUIConfig.getPort();
            contextPath = SyncUIConfig.getContextPath();
            Server srv = new Server(port);

            // Setup JMX
            MBeanContainer mbContainer = new MBeanContainer(
                    ManagementFactory.getPlatformMBeanServer() );
            srv.addBean( mbContainer );

            ProtectionDomain protectionDomain =
                org.duracloud.syncui.SyncUIDriver.class.getProtectionDomain();
            String warFile =
                protectionDomain.getCodeSource().getLocation().toExternalForm();

            log.debug("warfile: {}", warFile);
            WebAppContext context = new WebAppContext();
            context.setContextPath(contextPath);
            context.setWar(warFile);
            context.setExtractWAR(Boolean.TRUE);

            Configuration.ClassList classlist = Configuration.ClassList
                    .setServerDefault( srv );
            classlist.addBefore(
                    "org.eclipse.jetty.webapp.JettyWebXmlConfiguration",
                    "org.eclipse.jetty.annotations.AnnotationConfiguration" );

            context.setAttribute(
                    "org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern",
                    ".*/[^/]*servlet-api-[^/]*\\.jar$|.*/javax.servlet.jsp.jstl-.*\\.jar$|.*/[^/]*taglibs.*\\.jar$" );

            srv.setHandler(context);

            new Thread(new Runnable() {
                @Override
                public void run() {
                    createSysTray(url, srv);

                    while (true) {
                        if (progress.getValue() < 100) {
                            progress.setValue(progress.getValue() + 3);
                        }

                        sleep(2000);
                        if (isAppRunning(url, client)) {
                            break;
                        }
                    }

                    progress.setValue(100);

                    label.setText("Launching browser...");
                    launchBrowser(url);
                    dialog.setVisible(false);
                }
            }).start();

            srv.start();

            srv.join();
        } catch (Exception e) {
            log.error("Error launching server: " + e.getMessage(), e);
        }
    }
934072
static void openURL(String url) {
    try {
      openURL(new URL(url));
    } catch (MalformedURLException ex) {
      Tools.showError(ex);
    }
  }
691283
public URLConnection openConnection(URL url) throws IOException {
        Proxy proxy = getProxyFor(url);
        URLConnection conn = null;

        if (proxy != null) {
            conn = url.openConnection(proxy.getProxy());
            proxy.authenticate(conn);
        } else {
            conn = url.openConnection();
        }

        return conn;
    }
744138
public void onUrlAvailable(String url) {
        if (callback_ != null) {
            callback_.onLinkCreate(url, null);
        }
        updateShareEventToFabric(url);
    }
618473
public acolyte.jdbc.Connection connect(final String url, 
                                           final Properties info) 
        throws SQLException {

        if (!acceptsURL(url)) {
            return null;
        } // end of if
        
        final String[] parts = url.substring(url.lastIndexOf("?")+1).split("&");
        String h = null;

        for (final String p : parts) {
            if (p.startsWith("handler=")) {
                h = p.substring(8);
                break;
            } // end of if
        } // end of for

        if (h == null || h.length() == 0) {
            throw new IllegalArgumentException("Invalid handler ID: " + h);
        } // end of if

        final String id = h;
        final ConnectionHandler handler = handlers.get(id);

        if (handler == null) {
            throw new IllegalArgumentException("No matching handler: " + id);
        } // end of if

        // ---

        return new acolyte.jdbc.Connection(url, info, handler);
    }
1077656
public void notifyError( URL resource, String message )
    {
        synchronized( m_Monitors )
        {
            for( StreamMonitor monitor : m_Monitors )
            {
                monitor.notifyError( resource, message );
            }
        }
    }
5930
function (url, callback) {
		if (_websocket) {
			_websocket.close();
			_websocket = null;
		}
		var ws = _websocket = new WebSocket(url || DEFAULT_URL);
		ws.onopen = function (event) {
			trigger("open", event);
		};
		ws.onerror = function (event) {
			trigger("error", event);
		};
		ws.onclose = function (event) {
			trigger("close", event);
		};
		var handler = function (event) {
			reset_idle_ping_timer();
			var msg = JSON.parse(event.data);
			console.log("Coinfloor >>", msg);
			if ("tag" in msg) {
				var handler = _result_handlers[msg.tag];
				delete _result_handlers[msg.tag];
				if (handler) {
					handler(msg);
				}
				else if (handler === undefined) {
					console.error("Coinfloor:", msg);
				}
			}
			else if ("notice" in msg) {
				trigger(msg.notice, msg);
			}
		};
		ws.onmessage = function (event) {
			var msg = JSON.parse(event.data);
			_server_nonce = atob(msg.nonce);
			this.onmessage = handler;
			handler(event);
			if (callback) {
				callback(msg);
			}
		};
	}
295138
final void close(final ConnectionPoolConnection conn) {
      if(closeQueue != null) {
         closeQueue.add(conn);
      } else {
         closer.close(conn);
      }
   }