Begin a connection attempt

        Args:
            action (ConnectionAction): the action object describing what we are
                connecting to
966560
def _begin_connection_action(self, action):
        

        connection_id = action.data['connection_id']
        internal_id = action.data['internal_id']
        callback = action.data['callback']

        # Make sure we are not reusing an id that is currently connected to something
        if self._get_connection_state(connection_id) != self.Disconnected:
            callback(connection_id, self.id, False, 'Connection ID is already in use for another connection')
            return

        if self._get_connection_state(internal_id) != self.Disconnected:
            callback(connection_id, self.id, False, 'Internal ID is already in use for another connection')
            return

        conn_data = {
            'state': self.Connecting,
            'microstate': None,
            'connection_id': connection_id,
            'internal_id': internal_id,
            'action': action,
            'context': action.data['context']
        }

        self._connections[connection_id] = conn_data
        self._int_connections[internal_id] = conn_data
862556
def _add_action(self, action):
        
        kwargs = self._get_method_params()

        kwargs['action'] = action

        self._bulk_actions.append(kwargs)
1364410
def _force_disconnect_action(self, action):
        

        conn_key = action.data['id']
        if self._get_connection_state(conn_key) == self.Disconnected:
            return

        data = self._get_connection(conn_key)

        # If there are any operations in progress, cancel them cleanly
        if data['state'] == self.Connecting:
            callback = data['callback']
            callback(False, 'Unexpected disconnection')
        elif data['state'] == self.Disconnecting:
            callback = data['callback']
            callback(True, None)
        elif data['state'] == self.InProgress:
            callback = data['callback']
            if data['microstate'] == 'rpc':
                callback(False, 'Unexpected disconnection', None, None)
            elif data['microstate'] == 'open_interface':
                callback(False, 'Unexpected disconnection')
            elif data['microstate'] == 'close_interface':
                callback(False, 'Unexpected disconnection')

        int_id = data['int_id']
        conn_id = data['conn_id']
        del self._connections[conn_id]
        del self._int_connections[int_id]
820907
private static IAction createAction(String action) {
        IAction actn = null;
        
        if (!StringUtils.isEmpty(action)) {
            if ((actn = ActionRegistry.getRegisteredAction(action)) == null) {
                actn = ActionUtil.createAction(null, action);
            }
        }
        
        return actn;
    }
283611
def open_connection(request)
      connection = ConnectionAdapters.establish_connection(request, dispatcher)

      assign_connection_id connection
      register_user_connection connection

      connections[connection.id] = connection

      info "Connection opened: #{connection}"
      connection.rack_response
    end
588055
def action(self, method, action, **params) :
        """"""
        fct = getattr(self.connection.session, method.lower())
        r = fct(self.URL + "/" + action, params = params)
        return r.json()
25892
protected void executeAction(Action action) {
        ProcessContext context = new ProcessContext(getProcessInstance().getKnowledgeRuntime());
        context.setNodeInstance(this);
        try {
            action.execute(context);
        } catch (Exception e) {
            String exceptionName = e.getClass().getName();
            ExceptionScopeInstance exceptionScopeInstance = (ExceptionScopeInstance)
                resolveContextInstance(ExceptionScope.EXCEPTION_SCOPE, exceptionName);
            if (exceptionScopeInstance == null) {
                throw new WorkflowRuntimeException(this, getProcessInstance(), "Unable to execute Action: " + e.getMessage(), e);
            }
            
            exceptionScopeInstance.handleException(exceptionName, e);
            cancel();
        }
    }
513223
private void sendAction(Context context, String action) {
        Intent intent = new Intent(context, PlaybackService.class);
        intent.setAction(action);
        LocalBroadcastManager.getInstance(context).sendBroadcast(intent);
    }
822688
public void actionPerformed(ActionEvent ev) {

        String s = ev.getActionCommand();

        //  System.out.println("Action performed " + s);
        if (s.equals("ConnectOk")) {
            finishCreate();
        } else if (s.equals("ConnectCancel")) {
            dispose();
        }
    }
840173
def _begin_disconnection_action(self, action):
        

        conn_key = action.data['id']
        callback = action.data['callback']

        if self._get_connection_state(conn_key) != self.Idle:
            callback(conn_key, self.id, False, 'Cannot start disconnection, connection is not idle')
            return

        # Cannot be None since we checked above to make sure it exists
        data = self._get_connection(conn_key)
        data['state'] = self.Disconnecting
        data['microstate'] = None
        data['callback'] = callback
        data['timeout'] = action.timeout
1256809
async def connect(self, connection):
        
        if self._user_connected:
            self._log.info('User is already connected!')
            return

        self._connection = connection
        await self._connect()
        self._user_connected = True
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))
832032
def connect(self, action=None, method=None, **kwargs):
        
        return self.nest(Connect(action=action, method=method, **kwargs))
1240273
def request_connect(self, act, coro):
        ""
        result = self.try_run_act(act, perform_connect)
        if result:
            return result, coro
        else:
            self.add_token(act, coro, perform_connect)
816657
public void connect() throws Exception {
        if (connection != null && !connection.isConnected()) {
            connection.connect();
            transaction = connection.getModbusTransport().createTransaction();
            setTransaction(transaction);
        }
    }
1226255
public void beginTransaction() throws SQLException {
		final Connection conn = getConnection();
		checkTransactionSupported(conn);
		conn.setAutoCommit(false);
	}
1083156
def _sendAction(self, action, attrs=None, chan_vars=None):
        
        self._conn.write("Action: %s\r\n" % action)
        if attrs:
            for (key,val) in attrs:
                self._conn.write("%s: %s\r\n" % (key, val))
        if chan_vars:
            for (key,val) in chan_vars:
                self._conn.write("Variable: %s=%s\r\n" % (key, val))
        self._conn.write("\r\n")