Register a connection
@param cm The connection manager
@param cl The connection listener
@param c The connection
359181
void registerConnection(ConnectionManager cm, ConnectionListener cl, Object c)
   {
      if (cmToCl == null)
         cmToCl = new HashMap<ConnectionManager, List<ConnectionListener>>();

      List<ConnectionListener> l = cmToCl.get(cm);

      if (l == null)
         l = new ArrayList<ConnectionListener>(1);

      l.add(cl);
      cmToCl.put(cm, l);

      if (clToC == null)
         clToC = new HashMap<ConnectionListener, List<Object>>();

      List<Object> connections = clToC.get(cl);

      if (connections == null)
         connections = new ArrayList<Object>(1);

      connections.add(c);
      clToC.put(cl, connections);
   }
185033
@Override
	public void init(final Configuration c)
	{
		// check if we have a current model which emits change notifications
		if (model instanceof ChangeNotifier) {
			final ChangeNotifier notifier = (ChangeNotifier) model;
			notifier.removeChangeListener(cl);
		}
		final DatapointModel<?> m = c.getDatapointModel();
		if (m instanceof ChangeNotifier) {
			model = m;
			final ChangeNotifier notifier = (ChangeNotifier) m;
			notifier.addChangeListener(cl);
		}
		if (m != null)
			createReferences(m);
	}
764248
def __manage_connections(self, ccallbacks=None):
        """"""

        _logger.info("Running client.")

        # Create message-handler.

        if self.__message_handler_cls is not None:
# TODO(dustin): Move this to another thread if we can mix multithreading with coroutines. 
            self.__message_handler = self.__message_handler_cls(
                                        self.__election, 
                                        ccallbacks)

        # Spawn the initial connections to all of the servers.

        for (context, node) in self.__node_couplets_s:
            self.__start_connection(context, node, ccallbacks)

        # Wait for at least one connection to the server.
        self.__wait_for_one_server_connection()

        # Indicate that the client is okay to pass control back to the caller.
        self.__is_alive = True
        self.__ready_ev.set()

        # Loop, and maintain all connections. This exits when the quit event 
        # is set.
        self.__audit_connections(ccallbacks)

        # Wait for all of the connections to close. They will respond to the 
        # same quit event that terminate the audit loop just above.
        self.__join_connections()

        _logger.info("Connection management has stopped.")

        self.__is_alive = False
824884
@Override
    protected void setCommsConnection(CommsConnection cc) {
        if (tc.isEntryEnabled())
            SibTr.entry(this, tc, "setCommsConnection");

        // Retrieve Client Conversation State if necessary
        validateConversationState();

        sConState.setCommsConnection(cc);

        if (tc.isEntryEnabled())
            SibTr.exit(this, tc, "setCommsConnection");
    }
911635
private void addOcc(final int lit, final CLClause c) {
        assert this.dense;
        occs(lit).add(c);
        touch(lit);
    }
1240944
public void connect(Connection c) {

        schemaFilter = null;

        if (c == null) {
            return;
        }

        if (cConn != null) {
            try {
                cConn.close();
            } catch (SQLException e) {

                //  Added: (weconsultants@users)
                CommonSwing.errorMessage(e);
            }
        }

        cConn = c;

        // Added: (weconsultants@users) Need to barrow to get the table rowcounts
        rowConn = c;

        try {
            dMeta      = cConn.getMetaData();
            isOracle = (dMeta.getDatabaseProductName().indexOf("Oracle") >= 0);
            sStatement = cConn.createStatement();

            updateAutoCommitBox();

            // Workaround for EXTREME SLOWNESS getting this info from O.
            showIndexDetails = !isOracle;

            Driver driver = DriverManager.getDriver(dMeta.getURL());
            ConnectionSetting newSetting = new ConnectionSetting(
                dMeta.getDatabaseProductName(), driver.getClass().getName(),
                dMeta.getURL(),
                dMeta.getUserName().replaceAll("@localhost", ""), "");
            Hashtable settings =
                ConnectionDialogCommon.loadRecentConnectionSettings();

            ConnectionDialogCommon.addToRecentConnectionSettings(settings,
                    newSetting);
            ConnectionDialogSwing.setConnectionSetting(newSetting);
            refreshTree();
            clearResultPanel();

            if (fMain instanceof JApplet) {
                getAppletContext().showStatus(
                    "JDBC Connection established to a "
                    + dMeta.getDatabaseProductName() + " v. "
                    + dMeta.getDatabaseProductVersion() + " database as '"
                    + dMeta.getUserName() + "'.");
            }
        } catch (SQLException e) {

            //  Added: (weconsultants@users)
            CommonSwing.errorMessage(e);
        } catch (IOException e) {

            //  Added: (weconsultants@users)
            CommonSwing.errorMessage(e);
        } catch (Exception e) {
            CommonSwing.errorMessage(e);
        }
    }
353280
public void addConnection (Connection connection) {
		if (connection == null) throw new IllegalArgumentException("connection cannot be null.");

		synchronized (connectionsLock) {
			Connection[] newConnections = new Connection[connections.length + 1];
			newConnections[0] = connection;
			System.arraycopy(connections, 0, newConnections, 1, connections.length);
			connections = newConnections;
		}

		connection.addListener(invokeListener);

		if (TRACE) trace("kryonet", "Added connection to ObjectSpace: " + connection);
	}
1181630
private Connection getConnection(final ICommandLine cl) throws SQLException, InstantiationException, IllegalAccessException,
            ClassNotFoundException {
        DriverManager.registerDriver((Driver) Class.forName("oracle.jdbc.driver.OracleDriver").newInstance());

        LOG.debug(getContext(), "Connecting to " + cl.getOptionValue("db") + "@" + cl.getOptionValue("server"));

        return DriverManager.getConnection("jdbc:oracle:thin:@" + cl.getOptionValue("server") + ":" + cl.getOptionValue("port", "1521")
                + ":" + cl.getOptionValue("db"), cl.getOptionValue("username"), cl.getOptionValue("password"));
    }
483282
protected ConnectionListener findConnectionListener(ManagedConnection mc, Object c,
                                                       Collection<ConnectionListener> listeners)
   {
      for (ConnectionListener cl : listeners)
      {
         if (cl.getManagedConnection().equals(mc) && (c == null || cl.getConnections().contains(c)))
            return cl;
      }

      return null;
   }
725847
@Override
  public void register(final Identifier id, final InetSocketAddress addr) throws Exception {

    // needed to keep threads from reading the wrong response
    // TODO: better fix matches replies to threads with a map after REEF-198
    synchronized (this) {

      LOG.log(Level.FINE, "Register {0} : {1}", new Object[]{id, addr});

      final Link<NamingMessage> link = this.transport.open(
          this.serverSocketAddr, this.codec, new LoggingLinkListener<NamingMessage>());

      link.write(new NamingRegisterRequest(new NameAssignmentTuple(id, addr)));

      for (;;) {
        try {
          this.replyQueue.poll(this.timeout, TimeUnit.MILLISECONDS);
          break;
        } catch (final InterruptedException e) {
          LOG.log(Level.INFO, "Interrupted", e);
          throw new NamingException(e);
        }
      }
    }
  }
728290
@Override
    public void connect(ICredentials credentials, ConnectorClusterConfig config) throws ConnectionException {
        logger.info("Conecting connector [" + this.getClass().getSimpleName() + "]");
        connectionHandler.createConnection(credentials, config);

    }
388074
public void register(K key, T connection) {
        connections.put(key, new Sync<>(key, connection));
    }
384534
@Override
    public void registerTable(EntityMetadata m, SparkClient sparkClient)
    {
        String conn = getConnectionString(m);

        Map<String, String> options = new HashMap<String, String>();
        options.put("url", conn);
        options.put("dbtable", m.getTableName());

        sparkClient.sqlContext.load("jdbc", options).registerTempTable(m.getTableName());
    }
550038
protected void registerEventListener() {

        OpenCms.addCmsEventListener(
            this,
            new int[] {
                I_CmsEventListener.EVENT_RESOURCE_AND_PROPERTIES_MODIFIED,
                I_CmsEventListener.EVENT_RESOURCES_AND_PROPERTIES_MODIFIED,
                I_CmsEventListener.EVENT_RESOURCE_MODIFIED,
                I_CmsEventListener.EVENT_RESOURCES_MODIFIED,
                I_CmsEventListener.EVENT_RESOURCE_MOVED,
                I_CmsEventListener.EVENT_RESOURCE_DELETED,
                I_CmsEventListener.EVENT_PUBLISH_PROJECT,
                I_CmsEventListener.EVENT_CLEAR_CACHES,
                I_CmsEventListener.EVENT_CLEAR_ONLINE_CACHES,
                I_CmsEventListener.EVENT_CLEAR_OFFLINE_CACHES});
    }
376904
public static synchronized void getConnection(String poolName, Object mcp, Object cl, Object connection)
   {
      log.tracef("%s", new TraceEvent(poolName,
                                      Integer.toHexString(System.identityHashCode(mcp)),
                                      TraceEvent.GET_CONNECTION,
                                      Integer.toHexString(System.identityHashCode(cl)),
                                      Integer.toHexString(System.identityHashCode(connection))));
   }
257162
protected void connectionErrorOccurred() {
        if (tc.isEntryEnabled()) {
            Tr.entry(this, tc, "connectionErrorOccurred");
        }
        connectionErrorOccurred(null);
        if (tc.isEntryEnabled()) {
            Tr.exit(this, tc, "connectionErrorOccurred");
        }
    }
798052
void switchConnectionListener(Object c, ConnectionListener from, ConnectionListener to)
   {
      if (clToC != null && clToC.get(from) != null && clToC.get(to) != null)
      {
         clToC.get(from).remove(c);
         clToC.get(to).add(c);
      }
   }