<p>This method is used to create a new MQLinkHandler and register it.</p>
971567
private MQLinkHandler createMQLinkHandler(
                                              MQLinkDefinition mqld,
                                              VirtualLinkDefinition virtualLinkDefinition,
                                              LocalTransaction transaction) throws SIResourceException
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(
                        tc,
                        "createMQLinkHandler",
                        new Object[] { mqld, virtualLinkDefinition, transaction });

        MQLinkHandler mqLinkHandler = null;

        // Create a new LinkHandler, which is created locked
        try
        {
            mqLinkHandler =
                            new MQLinkHandler(
                                            mqld,
                                            virtualLinkDefinition,
                                            messageProcessor,
                                            this,
                                            transaction,
                                            durableSubscriptions);
        } catch (OutOfCacheSpace e)
        {
            // No FFDC code needed
            SibTr.exception(tc, e);
            if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                SibTr.exit(tc, "createMQLinkHandler", "SIResourceException");
            throw new SIResourceException(e);
        } catch (MessageStoreException e)
        {
            // MessageStoreException shouldn't occur so FFDC.
            FFDCFilter.processException(
                                        e,
                                        "com.ibm.ws.sib.processor.impl.DestinationManager.createMQLinkHandler",
                                        "1:6948:1.508.1.7",
                                        this);

            SibTr.exception(tc, e);
            if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                SibTr.exit(tc, "createMQLinkHandler", "SIResourceException");
            throw new SIResourceException(e);
        }

        mqLinkHandler.setLocal();
        LinkIndex.Type type = new LinkIndex.Type();
        type.local = Boolean.TRUE; //new Boolean(mqLinkHandler.hasLocal());
        type.mqLink = Boolean.TRUE;
        type.remote = Boolean.FALSE;
        type.state = State.ACTIVE;
        linkIndex.put(mqLinkHandler, type);

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "createMQLinkHandler", mqLinkHandler);

        return mqLinkHandler;
    }
904845
public <H extends EventHandler> HandlerRegistration addHandler(GwtEvent.Type<H> type, final H handler) {
		if (type != null && handler != null) {
			return new LegacyHandlerWrapper(this.eventBus.addHandler(type, handler));
		}
		return null;
	}
984993
public AutoCloseable registerHandler(
      final Class<? extends T> messageType,
      final EventHandler<RemoteMessage<? extends T>> theHandler) {

    this.msgTypeToHandlerMap.put(messageType, theHandler);

    LOG.log(Level.FINER, "Add handler for class: {0}", messageType.getCanonicalName());

    return new SubscriptionHandler<>(messageType, this.unsubscribeClass);
  }
731535
protected void addRequestHandler(I_CmsRequestHandler handler) {

        if (handler == null) {
            return;
        }
        String[] names = handler.getHandlerNames();
        for (int i = 0; i < names.length; i++) {
            String name = names[i];
            if (m_requestHandlers.get(name) != null) {
                CmsLog.INIT.error(Messages.get().getBundle().key(Messages.LOG_DUPLICATE_REQUEST_HANDLER_1, name));
                continue;
            }
            m_requestHandlers.put(name, handler);
            if (CmsLog.INIT.isInfoEnabled()) {
                CmsLog.INIT.info(
                    Messages.get().getBundle().key(
                        Messages.INIT_ADDED_REQUEST_HANDLER_2,
                        name,
                        handler.getClass().getName()));
            }
        }
    }
718260
private void reconstituteMQLink(int startMode) throws MessageStoreException, SIResourceException
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "reconstituteMQLink", new Object[] { Integer.valueOf(startMode), this });

        int localisationCount = 0;
        MQLinkMessageItemStream mqlinkMessageItemStream = null;

        // There can be one or more localisations in the BaseDestinationHandler.
        NonLockingCursor cursor =
                        _baseDestinationHandler.newNonLockingItemStreamCursor(
                                        new ClassEqualsFilter(MQLinkMessageItemStream.class));

        do
        {
            mqlinkMessageItemStream = (MQLinkMessageItemStream) cursor.next();

            if (mqlinkMessageItemStream != null)
            {
                localisationCount++;
                mqlinkMessageItemStream.reconstitute(_baseDestinationHandler);

                attachLocalPtoPLocalisation(mqlinkMessageItemStream);

                /* Feature 176658.3.2 */
                //TODO: Check need all this for MQLinks
                assignQueuePointOutputHandler(
                                              mqlinkMessageItemStream.getOutputHandler(),
                                              mqlinkMessageItemStream.getLocalizingMEUuid());
                ConsumerDispatcher consumerDispatcher =
                                (ConsumerDispatcher) mqlinkMessageItemStream.getOutputHandler();
                consumerDispatcher.setReadyForUse();

                //If the local queue point is awaiting deletion ensure it is correctly configured
                if (mqlinkMessageItemStream.isToBeDeleted())
                {
                    dereferenceLocalisation(mqlinkMessageItemStream);
                }
            }
        } while (mqlinkMessageItemStream != null);

        cursor.finished();

        // Sanity - There should never be more than one mediation itemstream
        if (localisationCount > 1)
        {
            SIErrorException e =
                            new SIErrorException(
                                            nls.getFormattedMessage(
                                                                    "INTERNAL_MESSAGING_ERROR_CWSIP0005",
                                                                    new Object[] {
                                                                                  "com.ibm.ws.sib.processor.impl.destination.JSPtoPRealization",
                                                                                  "1:458:1.24.1.7",
                                                                                  _baseDestinationHandler.getName() },
                                                                    null));

            FFDCFilter.processException(
                                        e,
                                        "com.ibm.ws.sib.processor.impl.destination.JSPtoPRealization.reconstituteMQLink",
                                        "1:454:1.24.1.25",
                                        this);

            SibTr.exception(tc, e);
            SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0005",
                        new Object[] {
                                      "com.ibm.ws.sib.processor.impl.destination.JSPtoPRealization",
                                      "1:461:1.24.1.25",
                                      _baseDestinationHandler.getName() });

            if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                SibTr.exit(tc, "reconstituteMQLink", e);
            throw e;
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "reconstituteMQLink");
    }
215727
@IocBean(name = "mqttClient", depose = "close")
    public MqttClient createMqttClient(@Inject MqttConnectOptions mqttConnectOptions, @Inject MqttClientPersistence mqttClientPersistence) throws MqttException {
        String clientId = conf.get(PROP_CLIENT_ID);
        if (Strings.isBlank(clientId)) {
            clientId = MqttClient.generateClientId();
        }
        log.info("Client Id = " + clientId);
        MqttClient client = new MqttClient(conf.get(PROP_URL, "tcp://127.0.0.1:1883"), clientId, mqttClientPersistence);
        if (ioc.has("mqttCallback")) {
            client.setCallback(ioc.get(MqttCallback.class, "mqttCallback"));
        }
        client.setTimeToWait(conf.getLong(PROP_TIME_TO_WAIT, -1));
        if (conf.getBoolean(PROP_CONNECT_ON_START, true)) {
            IMqttToken token = client.connectWithResult(mqttConnectOptions);
            if (token.getException() != null)
                throw token.getException();
        }
        return client;
    }
41320
public static ConnectionHandler register(final String id, 
                                             final ConnectionHandler handler) {

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

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

        // ---

        return handlers.put(id, handler);
    }
1309893
@Override
	public QueueSender createSender(Queue queue) throws JMSException
    {
    	externalAccessLock.readLock().lock();
    	try
		{
	        checkNotClosed();
	        
	        RemoteQueueSender sender =  new RemoteQueueSender(this,
	                                                          DestinationTools.asRef(queue),
	                                                          idProvider.createID());
	        registerProducer(sender);
	        return sender;
		}
    	finally
    	{
    		externalAccessLock.readLock().unlock();
    	}
    }
112421
protected MCWrapper createManagedConnectionWithMCWrapper(
                                                             ManagedConnectionFactory managedConnectionFactory,
                                                             Subject subject,
                                                             ConnectionRequestInfo cri,
                                                             boolean connectionSharing, int hashCode) throws ResourceAllocationException { // This method is called within a synchronize block
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.entry(this, tc, "createManagedConnectionWithMCWrapper");
        }

        ManagedConnection mc = null;
        MCWrapper mcWrapper = null;
        try {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                Tr.debug(this, tc, "raClassLoader", raClassLoader);

            JcaServiceUtilities jcasu = new JcaServiceUtilities();
            if (raClassLoader == null) {
                mc = managedConnectionFactory.createManagedConnection(subject, cri);
            } else {
                ClassLoader previousClassLoader = jcasu.beginContextClassLoader(raClassLoader);
                try {
                    mc = managedConnectionFactory.createManagedConnection(subject, cri);
                } finally {
                    jcasu.endContextClassLoader(raClassLoader, previousClassLoader);
                }
            }
            mcWrapper = new com.ibm.ejs.j2c.MCWrapper(pm, gConfigProps);
            mcWrapper.setManagedConnection(mc);

            /*
             * Many threads can hit the following code at the same time. What I a
             * expect to happen is that several threads will hit the synchronized
             * call until the checkForNoPoolingException is set to false.
             */
            if (pm.gConfigProps.checkManagedConnectionInstanceof) {
                /*
                 * Allow only one thread at a time through the following code
                 */
                /*
                 * Double-checked locking works for 32-bit primitive values. I am
                 * using a boolean primitive value.
                 */
                synchronized (pm.gConfigProps.checkManagedConnectionInstanceofLock) {
                    if (pm.gConfigProps.checkManagedConnectionInstanceof) {
                        /*
                         * Call matchManagedConnections
                         */
                        Set<ManagedConnection> s = new HashSet<ManagedConnection>();
                        s.add(mc);
                        try {
                            int poolState = mcWrapper.getPoolState();
                            mcWrapper.setPoolState(50);
                            managedConnectionFactory.matchManagedConnections(s, subject, cri);
                            mcWrapper.setPoolState(poolState);
                        } catch (NotSupportedException e) {
                            /*
                             * If we catch a the NotSupportedException, we need
                             * to turn off connection pooling.
                             */
                            gConfigProps.setConnectionPoolingEnabled(false);
                        }

                        if (mc instanceof DissociatableManagedConnection) {
                            /*
                             * set smart handle supported
                             */
                            pm.gConfigProps.setSmartHandleSupport(true);
                            pm.createParkedConnection = false;
                            pm.gConfigProps.setInstanceOfDissociatableManagedConnection(true);
                        }

                        if (mc instanceof DissociatableManagedConnection) {
                            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                                Tr.debug(this, tc, "Managed connection is an instance of DissociatableManagedConnection");
                            }
                            pm.gConfigProps.setInstanceOfDissociatableManagedConnection(true);
                        }

                        /*
                         * Deferred enlistment
                         */
                        if (mc instanceof LazyEnlistableManagedConnection) {
                            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                                Tr.debug(this, tc, "Managed connection is an instance of LazyEnlistableManagedConnection");
                            }
                            pm.gConfigProps.setDynamicEnlistmentSupported(true);
                        }

                        /*
                         * Create the writer for the managed connection.
                         */
                        pm.writer = new TraceWriter(mc.getClass().getName());
                        pm.traceWriter = (TraceWriter) pm.writer;
                        pm.printWriter = new PrintWriter(pm.writer);

                        /*
                         * We only want to execute this code once
                         * Set this value last in this synchronized block.
                         */
                        pm.gConfigProps.setCheckManagedConnectionInstanceof(false);

                    } // moved brace to include above call to setCheckManagedConnectionInstanceof
                } // end synchronize
            }

            if (tc.isDebugEnabled()) {
                ++freePoolCreateManagedConnection;
            }

            mcWrapper.setFatalErrorValue(fatalErrorNotificationTime + 1);
            mcWrapper.setSubjectCRIHashCode(hashCode);
            mcWrapper.setSubject(subject);
            ((com.ibm.ejs.j2c.MCWrapper) mcWrapper).set_managedConnectionFactory(managedConnectionFactory);
            mcWrapper.setCRI(cri);
            mcWrapper.setSupportsReAuth(gConfigProps.raSupportsReauthentication);
            mcWrapper.setConnectionSynchronizationProvider(gConfigProps.connectionSynchronizationProvider);

            /*
             * Check to see if trace has been turned on for
             * the managed connection.
             */
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(this, tc, "pm = ", pm);
                Tr.debug(this, tc, "traceWriter = ", pm.traceWriter);
            }
            if (pm.traceWriter.isTraceEnabled()) {
                /*
                 * Set the log writer on mc
                 */
                mc.setLogWriter(pm.printWriter);
                mcWrapper.setLogWriterSet(true);
            }

            /*
             * Make sure conneciton pooling is enabled. The reaper is not needed for
             * non poolable resource adapters.
             *
             * First check to see if reaper time is set. We will not be starting the reaper thread unless
             * its set.
             *
             * Next, check to see if its already running.
             */
            if (gConfigProps.isConnectionPoolingEnabled()) {
                if ((pm.reapTime > 0)) {
                    if (pm.alarmThreadCounter.get() == 0) {
                        synchronized (pm.amLockObject) {
                            if (pm.alarmThreadCounter.get() == 0) {
                                /*
                                 * If totalConnectionCount is > minConnections and agedTimeout is not set, start
                                 * the reaper thread.
                                 *
                                 * If agedTimeout is set and totalConnectionCount is > 0 start the reaper
                                 * thread.
                                 */
                                if (pm.agedTimeout < 1) {
                                    if ((pm.totalConnectionCount.get() > pm.minConnections)) {
                                        if (pm.nonDeferredReaperAlarm) {
                                            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                                                Tr.debug(this, tc, "Creating non-deferrable alarm for reaper");
                                            }
                                            pm.alarmThreadCounter.incrementAndGet();
                                            try {
                                                pm.am = pm.connectorSvc.nonDeferrableSchedXSvcRef.getServiceWithException().schedule(pm, pm.reapTime, TimeUnit.SECONDS);
                                            } catch (Exception e) {
                                                pm.alarmThreadCounter.decrementAndGet();
                                                throw e;
                                            }
                                        } else {
                                            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                                                Tr.debug(this, tc, "Creating deferrable alarm for reaper");
                                            }
                                            pm.alarmThreadCounter.incrementAndGet();
                                            try {
                                                pm.am = pm.connectorSvc.deferrableSchedXSvcRef.getServiceWithException().schedule(pm, pm.reapTime, TimeUnit.SECONDS);
                                            } catch (Exception e) {
                                                pm.alarmThreadCounter.decrementAndGet();
                                                throw e;
                                            }
                                        }
                                    }
                                } else {
                                    if (pm.totalConnectionCount.get() > 0) {
                                        if (pm.nonDeferredReaperAlarm) {
                                            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                                                Tr.debug(this, tc, "Creating non-deferrable alarm for reaper");
                                            }
                                            pm.alarmThreadCounter.incrementAndGet();
                                            try {
                                                pm.am = pm.connectorSvc.nonDeferrableSchedXSvcRef.getServiceWithException().schedule(pm, pm.reapTime, TimeUnit.SECONDS);
                                            } catch (Exception e) {
                                                pm.alarmThreadCounter.decrementAndGet();
                                                throw e;
                                            }
                                        } else {
                                            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                                                Tr.debug(this, tc, "Creating deferrable alarm for reaper");
                                            }
                                            pm.alarmThreadCounter.incrementAndGet();
                                            try {
                                                pm.am = pm.connectorSvc.deferrableSchedXSvcRef.getServiceWithException().schedule(pm, pm.reapTime, TimeUnit.SECONDS);
                                            } catch (Exception e) {
                                                pm.alarmThreadCounter.decrementAndGet();
                                                throw e;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        } catch (ResourceException exn) {
            com.ibm.ws.ffdc.FFDCFilter.processException(
                                                        exn,
                                                        "com.ibm.ejs.j2c.poolmanager.FreePool.createManagedConnectionWithMCWrapper",
                                                        "199",
                                                        this);
            // call exceptionList method to print stack traces of current and linked exceptions
            Object[] parms = new Object[] { "createManagedConnectionWithMCWrapper", CommonFunction.exceptionList(exn), "ResourceAllocationException", gConfigProps.cfName };
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(this, tc, "POOL_MANAGER_EXCP_CCF2_0002_J2CA0046", parms);
            }
            ResourceAllocationException throwMe = new ResourceAllocationException(exn.getMessage(), exn.getErrorCode());
            throwMe.initCause(exn.getCause());
            pm.activeRequest.decrementAndGet();
            if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                Tr.exit(this, tc, "createManagedConnectionWithMCWrapper", throwMe);
            throw (throwMe);

        } catch (Exception e) {
            com.ibm.ws.ffdc.FFDCFilter.processException(
                                                        e,
                                                        "com.ibm.ejs.j2c.poolmanager.FreePool.createManagedConnectionWithMCWrapper",
                                                        "545",
                                                        this);
            // call exceptionList method to print stack traces of current and linked exceptions
            Object[] parms = new Object[] { "createManagedConnectionWithMCWrapper", CommonFunction.exceptionList(e), "ResourceAllocationException", gConfigProps.cfName };
            Tr.error(tc, "POOL_MANAGER_EXCP_CCF2_0002_J2CA0046", parms);
            ResourceAllocationException throwMe = new ResourceAllocationException(e.getMessage());
            throwMe.initCause(e);
            pm.activeRequest.decrementAndGet();
            if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                Tr.exit(this, tc, "createManagedConnectionWithMCWrapper", throwMe);
            throw (throwMe);
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.exit(this, tc, "createManagedConnectionWithMCWrapper", mcWrapper);
        }
        return mcWrapper;

    }
1031890
@Process(actionType = CreateHandler.class)
    public void createHandler(final CreateHandler action, final Dispatcher.Channel channel) {
        operationDelegate.onCreateResource(action.getAddressTemplate(), action.getInstanceName(), action.getNewModel(),
            new CrudOperationDelegate.Callback() {
                @Override
                public void onFailure(AddressTemplate template, String name, Throwable t) {
                    channel.nack(t);
                }

                @Override
                public void onSuccess(AddressTemplate addressTemplate, String name) {
                    lastModifiedInstance = action.getInstanceName();
                    // we must strip the pre-handler-chain suffix to reload a single configuration. 
                    readConfig(action.getAddressTemplate().subTemplate(0, 3), channel);
                }
            });
    }
183502
public void createControlAdapter()
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) 
      SibTr.entry(tc, "createControlAdapter");
    
    controlAdapter = new MQLinkQueuePoint(destinationHandler.getMessageProcessor(), this);
    
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) 
      SibTr.exit(tc, "createControlAdapter");
  }
269749
public synchronized EventScope<T> register(final Class<? extends T> eventClass, final Object receiver,
			final Method handler) {

		this.registerInternal(receiver, handler, eventClass);
		return this;

	}
211810
public MethodMetaArgs createCreateMethod(HandlerMetaDef handlerMetaDef, EventModel em) {

		String p_methodName = handlerMetaDef.getCreateMethod();
		if (p_methodName == null) {
			Debug.logError("[JdonFramework] not configure the createMethod parameter: <createMethod name=XXXXX /> ", module);
		}
		return createCRUDMethodMetaArgs(p_methodName, em);
	}
841650
public void reconcileMQLinks()
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "reconcileMQLinks");

        // Set reconciling flag to false
        reconciling = false;

        LinkTypeFilter filter = new LinkTypeFilter();
        filter.MQLINK = Boolean.TRUE;
        filter.UNRECONCILED = Boolean.TRUE;
        SIMPIterator itr = linkIndex.iterator(filter);

        //  Get the MQLinkManager
        MQLinkManager mqlinkManager = getMQLinkManager();

        while (itr.hasNext())
        {
            MQLinkHandler dh = (MQLinkHandler) itr.next();

            // Retrieve the uuid for the Handler.
            String mqLinkUuid = dh.getMqLinkUuid().toString();

            // Call MQLink Component to alert it to create appropriate resources for
            // a link that previously existed
            MQLinkObject mqlinkObj = null;
            try
            {
                mqlinkObj = mqlinkManager.create(messageProcessor.createMQLinkDefinition(mqLinkUuid),
                                                 (MQLinkLocalization) dh,
                                                 (ControllableRegistrationService) messageProcessor.getMEInstance(SIMPConstants.JS_MBEAN_FACTORY),
                                                 true); // We've reconciled and this destination is to be deleted
            } catch (SIResourceException e)
            {
                // No FFDC code needed

                SibTr.exception(tc, e);
            } catch (SIException e)
            {
                // No FFDC code needed

                SibTr.exception(tc, e);
            }

            // Store mqlinkObj in the handler
            dh.setMQLinkObject(mqlinkObj);
            // remove from the list - we won't attempt to delete it until requested
            // by the MQLink component
            linkIndex.cleanup(dh);
            linkIndex.defer(dh);
        }
        itr.finished();

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "reconcileMQLinks");
    }
641342
public void addHandler(Handler handler) {
        if (null == handlers) {
            handlers = new ArrayList<>();
        }
        handlers.add(handler);
    }
1229247
void addMessageHandler(SubscriptionMessageHandler messageHandler)
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "addMessageHandler", messageHandler);

    final boolean inserted = _subscriptionMessagePool.add(messageHandler);
    // If the message wasn't inserted, then the pool was exceeded
    if (!inserted)
      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
        SibTr.debug(
          tc,
         "SubscriptionObjectPool size exceeded");

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "addMessageHandler");
  }
1240676
static public MessageHandler.Whole<byte[]> createBinaryHandler(final MessageHandler.Whole proxy) {
        return new MessageHandler.Whole<byte[]>() {
            public void onMessage(byte[] msg) {
                proxy.onMessage(msg);
            }};
    }