docs: void _setMessageListener(MessageListener listener, boolean checkManaged) throws JMSException {
          if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
              SibTr.entry(this, tc, "_setMessageListener", new Object[] { listener, checkManaged });
  
          synchronized (sessionSyncLock) {
              if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                  SibTr.debug(this, tc, "got lock");
  
              // throw exception if closed
              checkClosed();
  
              // throw exception if running in a managed environment
              if (checkManaged && session.isManaged()) {
                  boolean exceptionRequired = true;
                  // To support async beans, we suppress the exception if:
                  // the session is non-transacted, auto-ack, and
                  // the listener is a Proxy, and
                  // the invocation handler is from the com.ibm tree.
                  if (sessionAckMode == Session.AUTO_ACKNOWLEDGE && listener instanceof Proxy) {
                      InvocationHandler handler = Proxy.getInvocationHandler(listener);
                      String name = handler.getClass().getName();
                      if (name.startsWith("com.ibm")) {
                          if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                              SibTr.debug(this, tc, "async beans, listener accepted");
                          exceptionRequired = false;
                      }
                  }
                  if (exceptionRequired) {
                      throw (javax.jms.IllegalStateException) JmsErrorUtils.newThrowable(javax.jms.IllegalStateException.class,
                                                                                         "MGD_ENV_CWSIA0084",
                                                                                         new Object[] { "MessageConsumer.setMessageListener" },
                                                                                         tc);
                  }
              }
  
              if (listener == null) {
                  if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                      SibTr.debug(this, tc, "application has asked to deregister listener");
                  removeAsyncListener();
                  session.registerSyncConsumer(this);
              }
              else {
                  if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                      SibTr.debug(this, tc, "application has supplied a listener to register");
                  setAsyncListener(listener);
                  session.registerAsyncConsumer(this);
              }
  
          } // releases sessionSyncLock
  
          if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
              SibTr.exit(this, tc, "_setMessageListener");
      }