Registers a SelectableChannel for polling on all events.

@param channel   the registering channel.
@param handler   the events handler for this channel
@return true if registered, otherwise false
763709
public final boolean register(final SelectableChannel channel, final EventsHandler handler)
    {
        return register(channel, handler, IN | OUT | ERR);
    }
589869
@Handler(priority = 1000)
    public void onProtocolSwitchAccepted(
            ProtocolSwitchAccepted event, IOSubchannel channel) {
        event.requestEvent().associated(Session.class)
            .ifPresent(session -> {
                channel.setAssociated(Session.class, session);
            });
    }
931235
@Handler
    public void onInput(Input<ByteBuffer> event, Channel channel) {
        Writer writer = inputWriters.get(channel);
        if (writer != null) {
            writer.write(event.buffer());
        }
    }
1121899
public void registerCommandHandler(String key, CommandHandler handler) {
        if (TraceComponent.isAnyTracingEnabled()
            && tc.isEntryEnabled())
            SibTr.entry(tc, "registerCommandHandler", new Object[] { key,
                                                                    handler });

        // Add handler to table
        // Note that if there was already a handler with this key it's table
        // entry will
        // be overwritten
        synchronized (_registeredHandlers) {
            _registeredHandlers.put(key, handler);
        }

        if (TraceComponent.isAnyTracingEnabled()
            && tc.isEntryEnabled())
            SibTr.exit(tc, "registerCommandHandler");
    }
371168
public HandlerRegistration addIconClickHandler(final ClickHandler handler) {

        final HandlerRegistration internalHandlerRegistration = m_iconPanel.addDomHandler(
            handler,
            ClickEvent.getType());
        m_iconClickHandlers.add(handler);
        HandlerRegistration result = new HandlerRegistration() {

            public void removeHandler() {

                internalHandlerRegistration.removeHandler();
                m_iconClickHandlers.remove(handler);
            }
        };
        return result;
    }
438722
@RequestHandler(patterns = "/form,/form/**")
    public void onPost(Request.In.Post event, IOSubchannel channel) {
        FormContext ctx = channel
            .associated(this, FormContext::new);
        ctx.request = event.httpRequest();
        ctx.session = event.associated(Session.class).get();
        event.setResult(true);
        event.stop();
    }
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);
                }
            });
    }
949450
@Override
    public void handlerAdded(ChannelHandlerContext ctx) throws Exception {
        if (ctx.channel().isRegistered()) {
            // This should always be true with our current DefaultChannelPipeline implementation.
            // The good thing about calling initChannel(...) in handlerAdded(...) is that there will be no ordering
            // surprises if a ChannelInitializer will add another ChannelInitializer. This is as all handlers
            // will be added in the expected order.
            if (initChannel(ctx)) {

                // We are done with init the Channel, removing the initializer now.
                removeState(ctx);
            }
        }
    }
802397
public function subscribe($channel, callable $handler)
    {
        $loop = $this->client->pubSubLoop();

        $loop->subscribe($channel);

        foreach ($loop as $message) {
            /** @var \stdClass $message */
            if ($message->kind === 'message') {
                call_user_func($handler, Utils::unserializeMessagePayload($message->payload));
            }
        }

        unset($loop);
    }
831774
private void probeChannel() {
    if (isStopped()) return;

    try {
      if (selector.selectNow() > 0) {
        final Iterator<SelectionKey> iterator = selector.selectedKeys().iterator();

        while (iterator.hasNext()) {
          final SelectionKey key = iterator.next();
          iterator.remove();

          if (key.isValid()) {
            if (key.isAcceptable()) {
              accept(key);
            }
          }
        }
      }
    } catch (Exception e) {
      e.printStackTrace();
      logger().log("Failed to accept client channel for '" + name + "' because: " + e.getMessage(), e);
    }
  }
700827
public boolean isSharable(Map<String, com.ibm.websphere.channelfw.ChannelData> channelConfiguration) {
        return false;
    }
561054
public HandlerRegistration setSelectLocationHandler(SelectLocationHandler handler) {
		if (handlerManager.getHandlerCount(SelectLocationHandler.TYPE) > 0) {
			SelectLocationHandler previous = handlerManager.getHandler(SelectLocationHandler.TYPE, 0);
			handlerManager.removeHandler(SelectLocationHandler.TYPE, previous);
		}
		return handlerManager.addHandler(SelectLocationHandler.TYPE, handler);
	}
278112
public boolean unregisterBlockListener(String handle) throws InvalidArgumentException {

        if (shutdown) {
            throw new InvalidArgumentException(format("Channel %s has been shutdown.", name));
        }

        checkHandle(BLOCK_LISTENER_TAG, handle);
        logger.trace(format("Unregister BlockListener with handle %s.", handle));

        LinkedHashMap<String, BL> lblockListeners = blockListeners;
        if (lblockListeners == null) {
            return false;
        }

        synchronized (lblockListeners) {

            return null != lblockListeners.remove(handle);

        }
    }
1254452
private static void registerMiddlewareHandler(Object handler) {
		if(handler instanceof MiddlewareHandler) {
			// register the middleware handler if it is enabled.
			if(((MiddlewareHandler) handler).isEnabled()) {
				((MiddlewareHandler) handler).register();
			}
		}
	}
1372305
@Handler
    public void onNioRegistration(NioRegistration event)
            throws IOException {
        SelectableChannel channel = event.ioChannel();
        channel.configureBlocking(false);
        SelectionKey key;
        synchronized (selectorGate) {
            selector.wakeup(); // make sure selector isn't blocking
            key = channel.register(
                selector, event.ops(), event.handler());
        }
        event.setResult(new Registration(key));
    }
552757
def _bind_channels(self, events, channels):
        
        for channel_name in channels:
            if channel_name in self.channels:
                channel = self.pusher.subscribe(channel_name)
                if isinstance(events, list):
                    for event in events:
                        channel.bind(event, channels[channel_name])
                else:
                    channel.bind(events, channels[channel_name])
1058479
public B handler(ChannelHandler handler) {
        if (handler == null) {
            throw new NullPointerException("handler");
        }
        this.handler = handler;
        return self();
    }