Raises the global and transaction start events.
@protected
@param {Object} connection The transaction object.
426752
function (connection) {
            if (connection) {
                // raise global custom event -- startEvent
                ariaCoreIO.$raiseEvent({
                    name : "startEvent",
                    o : connection
                });

                if (connection.startEvent) {
                    // raise transaction custom event -- startEvent
                    ariaCoreIO.$raiseEvent({
                        name : connection.startEvent,
                        o : connection
                    });
                }
            }
        }
167912
protected void rollbackLocalConnection(Connection connection) {
    try {
      if (connection != null) {
        connection.rollback();
      }
    } catch (Exception e) {
      if (logger.isTraceEnabled()) {
        logger.trace(e.getMessage());
      }
    }
  }
198740
function( connection ) {
    this._users = []; // Collect high-level information about users
    this._channels = {}; // Collect high-level information about channels
    this.sessions = {}; // Sessions to user map

    // TODO: We are storing the users twice to avoid some looping. Is this the
    // best approach?

    /**
     * @summary Defines whether the connection has been succesffully handshaken.
     *
     * @description
     * The connection is considered `ready` when the server handshake has been
     * processed and the initial ping has been received.
     *
     * @name MumbleClient#ready
     * @type Boolean
     */
    this.ready = false;

    /**
     * @summary The internal {@link MumbleConnection} object.
     *
     * @description
     * The connection object is used for the low level access to the Mumble
     * protocol. Most developers should find a higher level APIs for the
     * functionality on the {@link MumbleClient} class instead.
     *
     * @name MumbleClient#connection
     * @type MumbleConnection
     */
    this.connection = connection;

    /**
     * @summary The server root channel.
     *
     * @name MumbleClient#rootChannel
     * @type Channel
     */
    this.rootChannel = undefined;

    /**
     * @summary The current user.
     *
     * @name MumbleClient#user
     * @type User
     */
    this.user = undefined;

    this._gotServerSync = false;
    this._gotInitialPing = false;

    // Generate list of free whisper target IDs.
    this.freeTargets = [];
    for( var i = 1; i <= 30; i++ ) {
        this.freeTargets.push( i );
    }

    /*
     * Forward all events from the connection
     */
    this.on( 'newListener', function( event, listener ) {
        connection.on( event, listener );
    } );

    connection.once( 'ping', this._initialPing.bind( this ) );
    connection.on( 'channelRemove', this._channelRemove.bind( this ) );
    connection.on( 'userRemove', this._userRemove.bind( this ) );
    connection.on( 'serverSync', this._serverSync.bind( this ) );
    connection.on( 'userState', this._userState.bind( this ) );
    connection.on( 'channelState', this._channelState.bind( this ) );
    connection.on( 'permissionQuery', this._permissionQuery.bind( this ) );
    connection.on( 'textMessage', this._textMessage.bind( this ) );
}
474421
function (conn, opts) {
            var self = this;
            return this.__setTransactionIsolation(conn, opts).chain(function () {
                return self.__logConnectionExecute(conn, self.beginTransactionSql);
            });
        }
96566
public function startTransaction($which_connection='')
    {
        if ($which_connection == '') {
            $which_connection = $this->default_db;
        }

        return $this->connections[$which_connection]->BeginTrans();
    }
790447
def _handle_event(self, connection, event):
        
        with self.mutex:
            matching_handlers = sorted(
                self.handlers.get("all_events", [])
                + self.handlers.get(event.type, [])
            )
            for handler in matching_handlers:
                result = handler.callback(connection, event)
                if result == "NO MORE":
                    return
865338
function setRequestHeaders(connection, req) {
  if(_.isObject(connection.headers)){
    req.set(connection.headers);
  }
}
357138
def on_connection_open(self, connection):
        
        LOGGER.debug('Connection opened')
        connection.add_on_connection_blocked_callback(
            self.on_connection_blocked)
        connection.add_on_connection_unblocked_callback(
            self.on_connection_unblocked)
        connection.add_backpressure_callback(self.on_back_pressure_detected)
        self.channel = self._open_channel()
69838
def __start_connection(self, context, node, ccallbacks=None):
        """"""

        _logger.debug("Creating connection object: CONTEXT=[%s] NODE=[%s]", 
                      context, node)

        c = nsq.connection.Connection(
                context,
                node, 
                self.__identify, 
                self.__message_handler,
                self.__quit_ev,
                ccallbacks,
                ignore_quit=self.__connection_ignore_quit)

        g = gevent.spawn(c.run)

        # Now, wait for the thread to finish the connection.

        timeout_s = nsq.config.client.NEW_CONNECTION_NEGOTIATE_TIMEOUT_S
        if c.connected_ev.wait(timeout_s) is False:
            _logger.error("New connection to server [%s] timed-out. Cleaning-"
                          "up thread.", node)

            g.kill()
            g.join()

            # We'll try again on the next audit.

            raise EnvironmentError("Connection to server [%s] failed." % 
                                   (node,))

        self.__connections.append((node, c, g))
1325625
@SuppressWarnings("unchecked")
  private InputConnection setupConnection(InputConnection connection) {
    log.debug(String.format("%s - Setting up connection: %s", this, connection));
    connection.messageHandler(messageHandler);
    for (Handler<InputBatch> handler : batchHandlers) {
      connection.batchHandler(handler);
    }
    if (groupHandler != null) {
      connection.groupHandler(groupHandler);
    }
    for (Map.Entry<String, Handler<InputGroup>> entry : groupHandlers.entrySet()) {
      connection.groupHandler(entry.getKey(), entry.getValue());
    }
    if (paused) {
      connection.pause();
    }
    return connection;
  }
140185
def setConnection(self, connection):
        
        # define custom properties
        if not isinstance(connection, orb.Connection):
            conn = orb.Connection.byName(connection)
            if not conn:
                raise orb.errors.BackendNotFound(connection)
            connection = conn(self)
        else:
            connection.setDatabase(self)

        self.__connection = connection
735750
static void rollback(Connection connection) {
        if (connection != null)
            try {
                connection.rollback();
                log.debug("rolled back");
            } catch (SQLException e) {
                throw new SQLRuntimeException(e);
            }
    }
310867
function ReconnectingConnection(id, connection) {
  this.id = id;
  this.connection = null;
  this.closed = false;
  this.queue = [];

  this.setConnection(connection);
}
210890
def _on_connection_open(self, connection):
        
        _log.info("Successfully opened connection to %s", connection.params.host)
        self._channel = connection.channel(on_open_callback=self._on_channel_open)
998136
public function collectTransactionEvent($event, $connection)
    {
        $source = [];

        if ($this->findSource) {
            try {
                $source = $this->findSource();
            } catch (\Exception $e) {
            }
        }

        $this->queries[] = [
            'query' => $event,
            'type' => 'transaction',
            'bindings' => [],
            'time' => 0,
            'source' => $source,
            'explain' => [],
            'connection' => $connection->getDatabaseName(),
            'hints' => null,
        ];
    }
891246
public static void startTransaction() {
        Connection connection = tl_conn.get();
        if (connection != null) {
            throw new RuntimeException(
                    "You have started a Transaction and can not start transaction repeatedly for the same connection!");
        }

        try {
            connection = JDBCUtils.getConnection();
            connection.setAutoCommit(false);
            tl_conn.set(connection);
            tl_sp.set(new Stack<Savepoint>());
        } catch (SQLException e) {
            throw new RuntimeException(e);
        }
    }
1298553
private function isTransactionalEvent(ConnectionInterface $connection, $event)
    {
        if ($this->isPrepared($connection) && $this->transactionLevel > 0) {
            return $this->shouldHandle($event);
        }

        return false;
    }