Method retrieveCallbackFromConnectionIndex

Retrieves an existing callback from the callback index.

@param topicExpression
@param isWildcarded
@param callback
@return
356467
public TopicRecord retrieveCallbackFromConnectionIndex(
    ConnectionImpl connection,
    ConsumerSetChangeCallback callback)
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
        SibTr.entry(
          tc,
          "retrieveCallbackFromConnectionIndex",
          new Object[] {connection, callback });

    TopicRecord tRecord = null;

    if(_callbackIndex.containsKey(connection))
    {
      // Have found registered callbacks for this connection
      Map connMap = (HashMap)_callbackIndex.get(connection);

      // Locate the specific callback
      tRecord = (TopicRecord)connMap.get(callback);
    }

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "retrieveCallbackFromConnectionIndex", tRecord);

    return tRecord;
  }
983743
public static <T extends AVObject> CollectionObserver<T> buildSingleObserver(FindCallback<T> callback) {
    return new CollectionObserver<T>(callback);
  }
777812
function isCallback(node) {
            return containsOnlyIdentifiers(node.callee) && callbacks.indexOf(sourceCode.getText(node.callee)) > -1;
        }
58508
function getCallbackInfo(node) {
    const retv = { isCallback: false, isLexicalThis: false };
    let currentNode = node;
    let parent = node.parent;

    while (currentNode) {
        switch (parent.type) {

            // Checks parents recursively.

            case "LogicalExpression":
            case "ConditionalExpression":
                break;

            // Checks whether the parent node is `.bind(this)` call.
            case "MemberExpression":
                if (parent.object === currentNode &&
                    !parent.property.computed &&
                    parent.property.type === "Identifier" &&
                    parent.property.name === "bind" &&
                    parent.parent.type === "CallExpression" &&
                    parent.parent.callee === parent
                ) {
                    retv.isLexicalThis = (
                        parent.parent.arguments.length === 1 &&
                        parent.parent.arguments[0].type === "ThisExpression"
                    );
                    parent = parent.parent;
                } else {
                    return retv;
                }
                break;

            // Checks whether the node is a callback.
            case "CallExpression":
            case "NewExpression":
                if (parent.callee !== currentNode) {
                    retv.isCallback = true;
                }
                return retv;

            default:
                return retv;
        }

        currentNode = parent;
        parent = parent.parent;
    }

    /* istanbul ignore next */
    throw new Error("unreachable");
}
1282456
public void list(String line, DispatchCallback callback) {
    int index = 0;
    DatabaseConnections databaseConnections = sqlLine.getDatabaseConnections();
    sqlLine.info(
        sqlLine.loc("active-connections", databaseConnections.size()));

    for (DatabaseConnection databaseConnection : databaseConnections) {
      boolean closed;
      try {
        closed = databaseConnection.connection.isClosed();
      } catch (Exception e) {
        closed = true;
      }

      sqlLine.output(
          sqlLine.getColorBuffer()
              .pad(" #" + index++ + "", 5)
              .pad(closed ? sqlLine.loc("closed") : sqlLine.loc("open"), 9)
              .pad(databaseConnection.getNickname(), 20)
              .append(" " + databaseConnection.getUrl()));
    }

    callback.setToSuccess();
  }
892006
public <T> AskFuture<T> ask(ActorSelection selection, long timeout, AskCallback<T> callback) {
        return askPattern.ask(system().actorOf(selection), timeout, callback);
    }
295270
@SuppressWarnings("unchecked")
  public <C extends CDACallback<SynchronizedSpace>> C fetch(C callback) {
    return (C) Callbacks.subscribeAsync(observe(), callback, client);
  }
1211868
@Override
    public synchronized void addCallBack(RecoveryLogCallBack callback) {
        if (tc.isEntryEnabled())
            Tr.entry(tc, "addCallBack", callback);

        if (_registeredCallbacks == null) {
            _registeredCallbacks = new HashSet<RecoveryLogCallBack>();
        }

        _registeredCallbacks.add(callback);

        if (tc.isEntryEnabled())
            Tr.exit(tc, "addCallBack");
    }
443415
public void readAlways(UDPReadCompletedCallbackThreaded callback, boolean enable) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.entry(tc, "readAlways(enable=" + enable + ")");
        }
        if (enable) {
            this.readAlwaysCallback = callback;
        } else {
            this.readAlwaysCallback = null;
        }

        getWorkQueueManager().processWork(this);

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.exit(tc, "readAlways()");
        }
    }
934926
async def answerCallbackQuery(self, callback_query_id,
                                  text=None,
                                  show_alert=None,
                                  url=None,
                                  cache_time=None):
        
        p = _strip(locals())
        return await self._api_request('answerCallbackQuery', _rectify(p))
72666
public void getData(final String path, Watcher watcher, DataCallback cb,
            Object ctx) {
        verbotenThreadCheck();
        final String clientPath = path;
        PathUtils.validatePath(clientPath);

        // the watch contains the un-chroot path
        WatchRegistration wcb = null;
        if (watcher != null) {
            wcb = new DataWatchRegistration(watcher, clientPath);
        }

        final String serverPath = prependChroot(clientPath);

        RequestHeader h = new RequestHeader();
        h.setType(ZooDefs.OpCode.getData);
        GetDataRequest request = new GetDataRequest();
        request.setPath(serverPath);
        request.setWatch(watcher != null);
        GetDataResponse response = new GetDataResponse();
        cnxn.queuePacket(h, new ReplyHeader(), request, response, cb,
                clientPath, serverPath, ctx, wcb);
    }
1075485
public void getMemberCount(AVIMConversationMemberCountCallback callback) {
    if (StringUtil.isEmpty(getConversationId())) {
      if (null != callback) {
        callback.internalDone(new AVException(AVException.INVALID_QUERY, "ConversationId is empty"));
      } else {
        LOGGER.w("ConversationId is empty");
      }
      return;
    }
    InternalConfiguration.getOperationTube().processMembers(client.getClientId(), conversationId, getType(), null,
            Conversation.AVIMOperation.CONVERSATION_MEMBER_COUNT_QUERY, callback);
  }
1225374
function invokeCallback(expression, event, dropEffect, itemType, index, item) {
        return $parse(expression)(scope, {
          callback: dndState.callback,
          dropEffect: dropEffect,
          event: event,
          external: !dndState.isDragging,
          index: index !== undefined ? index : getPlaceholderIndex(),
          item: item || undefined,
          type: itemType
        });
      }
545868
public void loadNewElementInfo(final AsyncCallback<Void> callback) {

        CmsRpcAction<List<CmsNewResourceInfo>> newResourceInfoAction = new CmsRpcAction<List<CmsNewResourceInfo>>() {

            @Override
            public void execute() {

                start(200, true);

                getService().getNewElementInfo(m_data.getRoot().getSitePath(), this);
            }

            @Override
            protected void onResponse(List<CmsNewResourceInfo> result) {

                stop(false);

                m_data.setNewElementInfos(result);
                if (callback != null) {
                    callback.onSuccess(null);
                }
            }

        };
        newResourceInfoAction.execute();
    }
639925
protected MCWrapper getSharedConnection(
                                            Object affinity,
                                            Subject subject,
                                            ConnectionRequestInfo cri,
                                            boolean enforceSerialReuse,
                                            String pmiName,
                                            int commitPriority,
                                            int branchCoupling) {

        final boolean isTracingEnabled = TraceComponent.isAnyTracingEnabled();

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

        MCWrapper mcWrapper = null;
        boolean affinityIsEqual = false;
        boolean cmConfigDataIsCompatible = false;
        boolean dumpLTCMessage = true; // We want to only dump one of 86 trace message for every getSharedConnection

        /*
         * Dirty read the size of the mcWrapperList. There are no mcWrappers in the
         * list if mcWrapperListSize is zero and it is imposible for a matching
         * mcWrapper and affinity id to be added to this list since this thread has
         * to do the adding.
         */
        if (mcWrapperListSize > 0) {

            MCWrapper mcWrapperTemp = null;
            /*
             * We have one or more mcWrapper(s). We need to synchronize.
             */
            synchronized (sharedLockObject) {
                if (mcWrapperListSize > 0) {

                    /*
                     * Look for a matching affinity id and commit priority.
                     */
                    mcWrapperTemp = mcWrapperList[0];

                    if (affinity != null && affinity.equals(mcWrapperTemp.getSharedPoolCoordinator())) {
                        affinityIsEqual = true;

                        ConnectionManager cm = ((com.ibm.ejs.j2c.MCWrapper) mcWrapperTemp).getCm();
                        ResourceRefInfo resRefInfo = cm.getResourceRefInfo();
                        if (resRefInfo.getCommitPriority() == commitPriority) {
                            int tempBranchCoupling = resRefInfo.getBranchCoupling();
                            if (branchCoupling == tempBranchCoupling) { // Check if they match first for performance
                                cmConfigDataIsCompatible = true;
                            } else {
                                cmConfigDataIsCompatible = cm.matchBranchCoupling(branchCoupling, tempBranchCoupling,
                                                                                  ((com.ibm.ejs.j2c.MCWrapper) mcWrapperTemp).get_managedConnectionFactory());
                            }
                        }

                    }

                }

            } // Lets be really optimistic and release the lock

            if (affinityIsEqual && cmConfigDataIsCompatible) {

                // When the new transaction code is drop, we will want to use
                // the following if test for comparing Coordinators
                // if (mcWrapperTemp.getSharedPoolCoordinator() == affinity) {

                /*
                 * We have a matching affinity id, now we need a matching user data
                 */
                boolean subjectMatch = false;
                Subject mcWrapperSubject = mcWrapperTemp.getSubject();

                if ((subject == null) && (mcWrapperSubject == null)) {
                    subjectMatch = true;
                } else {

                    if ((subject != null) && (mcWrapperSubject != null)) {

                        Equals e = new Equals();
                        e.setSubjects(subject, mcWrapperTemp.getSubject());

                        if (AccessController.doPrivileged(e)) {
                            subjectMatch = true;
                        }

                    }

                }

                ManagedConnection mc = mcWrapperTemp.getManagedConnection();
                ConnectionRequestInfo mcWrapperCRI = mc instanceof WSManagedConnection ? ((WSManagedConnection) mc).getConnectionRequestInfo() : mcWrapperTemp.getCRI();
                // The cri can be null, so we need to check for null.
                boolean criMatch = cri == mcWrapperCRI || cri != null && cri.equals(mcWrapperCRI);

                if (criMatch && subjectMatch) {

                    /*
                     * We have a matching affinity id and user data, but we have one more
                     * test. The following if checks the serial reuse rule.
                     */
                    if (enforceSerialReuse && (mcWrapperTemp.getHandleCount() >= 1)) {

                        /*
                         * We can not use this connections. We need to look for a shared
                         * connection with the handle count of zero or we need to get a new
                         * shareable connection.
                         */

                        if (isTracingEnabled && tc.isDebugEnabled()) {
                            Tr.debug(this, tc, "allocateConnection_Common:  HandleCount = " + mcWrapperTemp.getHandleCount());
                        }

                        if (_pm.logSerialReuseMessage) {
                            Tr.info(tc, "ATTEMPT_TO_SHARE_LTC_CONNECTION_J2CA0086", mcWrapperTemp, pmiName);
                            _pm.logSerialReuseMessage = false;
                        }

                        if (dumpLTCMessage) {
                            if (isTracingEnabled && tc.isDebugEnabled()) {
                                dumpLTCMessage = false; // only dump this info once for every getSharedConnection
                                                        // request.
                                Tr.debug(this, tc, "Attempt to share connection within LTC (J2CA0086)");
                                Tr.debug(this, tc, "mcWrapper = " + mcWrapperTemp);
                                Tr.debug(this, tc, "pmiName   = " + pmiName);
                                Tr.debug(this, tc, "LTC stack information = " + dumpLTCInformation(mcWrapperTemp, pmiName, affinity));
                            }
                        }

                    } // end enforceSerialReuse && (mcWrapperTemp.getHandleCount() >= 1)

                    else {

                        /*
                         * We have a shareable connection to use
                         */
                        if ((isTracingEnabled && tc.isDebugEnabled())) {
                            /*
                             * This is used for tracking shared pool usage data
                             */
                            ++sop_gets;
                        }

                        mcWrapper = mcWrapperTemp;

                    }

                } // end criMatch && subjectMatch

                else {

                    if ((isTracingEnabled && tc.isDebugEnabled())) {
                        /*
                         * This is used for tracking shared pool usage data
                         */
                        ++snop_gets_notfound;
                    }

                } // end else (cri, subj don't both match)

            } // end affinityIsEqual && commitPriorityIsEqual

            else {

                if ((isTracingEnabled && tc.isDebugEnabled())) {
                    /*
                     * This is used for tracking shared pool usage data
                     */
                    ++snop_gets_notfound;
                }

            }

            if (mcWrapper == null) {
                synchronized (sharedLockObject) {
                    /*
                     * If the mcWrapperListSize > 0, we may have a connection that will
                     * match. We most likely already checked one of the connections, but
                     * we released the shared lock, so we need to check all of them again,
                     * no more perf tricks.
                     */
                    for (int i = 0; i < mcWrapperListSize; ++i) {

                        mcWrapperTemp = mcWrapperList[i];

                        /*
                         * Look for a matching affinity id and user data.
                         */

                        if (affinity != null && affinity.equals(mcWrapperTemp.getSharedPoolCoordinator())) {

                            // When the new transaction code is drop, we will want to use
                            // the following if test for comparing Coordinators
                            // if (mcWrapperTemp.getSharedPoolCoordinator() == affinity) {

                            /*
                             * We have a matching affinity id, now we need a matching user
                             * data
                             */
                            boolean subjectMatch = false;
                            Subject mcWrapperSubject = mcWrapperTemp.getSubject();

                            if ((subject == null) && (mcWrapperSubject == null)) {
                                subjectMatch = true;
                            } else {

                                if ((subject != null) && (mcWrapperSubject != null)) {

                                    Equals e = new Equals();
                                    e.setSubjects(subject, mcWrapperTemp.getSubject());
                                    if ((AccessController.doPrivileged(e)).booleanValue()) {
                                        subjectMatch = true;
                                    }

                                }

                            }

                            ManagedConnection mc = mcWrapperTemp.getManagedConnection();
                            ConnectionRequestInfo mcWrapperCRI = mc instanceof WSManagedConnection ? ((WSManagedConnection) mc).getConnectionRequestInfo() : mcWrapperTemp.getCRI();
                            // The cri can be null, so we need to check for null.
                            boolean criMatch = cri == mcWrapperCRI || cri != null && cri.equals(mcWrapperCRI);

                            if (criMatch && subjectMatch) {

                                /*
                                 * We have a matching affinity id and user data, but we have one
                                 * more test. The following if checks the serial reuse rule.
                                 */
                                if (enforceSerialReuse && (mcWrapperTemp.getHandleCount() >= 1)) {
                                    /*
                                     * We can not use this connections. We need to look for a
                                     * shared connection with the handle count of zero or we need
                                     * to get a new shareable connection.
                                     */
                                    if (isTracingEnabled && tc.isDebugEnabled()) {
                                        Tr.debug(this, tc, "allocateConnection_Common:  HandleCount = " + mcWrapperTemp.getHandleCount());
                                    }

                                    if (_pm.logSerialReuseMessage) {
                                        Tr.info(tc, "ATTEMPT_TO_SHARE_LTC_CONNECTION_J2CA0086", mcWrapperTemp, pmiName);
                                        _pm.logSerialReuseMessage = false;
                                    }

                                    if (dumpLTCMessage) {
                                        if (isTracingEnabled && tc.isDebugEnabled()) {
                                            dumpLTCMessage = false; // only dump this info once for every getSharedConnection
                                                                    // request.
                                            Tr.debug(this, tc, "Attempt to share connection within LTC (J2CA0086)");
                                            Tr.debug(this, tc, "mcWrapper = " + mcWrapperTemp);
                                            Tr.debug(this, tc, "pmiName   = " + pmiName);
                                            Tr.debug(this, tc, "LTC stack information = " + dumpLTCInformation(mcWrapperTemp, pmiName, affinity));
                                        }
                                    }

                                } // end enforceSerialReuse && (mcWrapperTemp.getHandleCount() >= 1)

                                else {

                                    /*
                                     * Look for a matching commitPriority/branchCoupling.
                                     */
                                    ConnectionManager cm = ((com.ibm.ejs.j2c.MCWrapper) mcWrapperTemp).getCm();
                                    ResourceRefInfo resRefInfo = cm.getResourceRefInfo();
                                    if (resRefInfo.getCommitPriority() == commitPriority) {
                                        int tempBranchCoupling = resRefInfo.getBranchCoupling();
                                        if (branchCoupling == tempBranchCoupling) { // Check if they match first for performance
                                            cmConfigDataIsCompatible = true;
                                        } else {
                                            cmConfigDataIsCompatible = cm.matchBranchCoupling(branchCoupling, tempBranchCoupling,
                                                                                              ((com.ibm.ejs.j2c.MCWrapper) mcWrapperTemp).get_managedConnectionFactory());
                                        }
                                    }

                                    if (cmConfigDataIsCompatible) {

                                        /*
                                         * We have a shareable connection to use
                                         */
                                        if ((isTracingEnabled && tc.isDebugEnabled())) {
                                            /*
                                             * This is used for tracking shared pool usage data
                                             */
                                            ++snop_gets;

                                        }
                                        mcWrapper = mcWrapperTemp;
                                        break;

                                    }

                                }

                            } // end criMatch && subjectMatch

                        } // end mcWrapperTemp.getSharedPoolCoordinator().equals(affinity)

                    } // end for loop

                } // end synchronized

                if (mcWrapper == null) {

                    if ((isTracingEnabled && tc.isDebugEnabled())) {
                        /*
                         * This is used for tracking shared pool usage data
                         */
                        ++snop_gets_notfound;
                    }

                }

            } // end mcWrapper == null

        } else {

            if ((isTracingEnabled && tc.isDebugEnabled())) {
                ++sop_gets_notfound;
            }

        }

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

        return mcWrapper;

    }
737432
def include_callback_query_chat_id(fn=pair, types='all'):
    
    @_ensure_seeders_list
    def p(seeders, delegator_factory, *args, **kwargs):
        return fn(seeders + [per_callback_query_chat_id(types=types)],
                  delegator_factory, *args, include_callback_query=True, **kwargs)
    return p
956700
protected synchronized void requestCallback(Token tokenToPrePrepare)
                    throws ObjectManagerException
    {
        throw new InvalidStateException(this, InternalTransaction.stateTerminated, InternalTransaction.stateNames[InternalTransaction.stateTerminated]);
    }