Access the current reference to the bytebuffer pool manager from channel frame work.

@return WsByteBufferPoolManager
484603
public static WsByteBufferPoolManager getBufferPoolManager() {
        if (null == chfwRef.getService()) {
            return ChannelFrameworkFactory.getBufferManager();
        }
        return chfwRef.getService().getBufferManager();
    }
696183
public synchronized byte[] getBuffer() {
        byte[] dest = new byte[buf.length];
        System.arraycopy(buf, 0, dest, 0, dest.length);
        return dest;
    }
891019
private WsByteBufferPoolManager createBufferManager(Map<String, Object> config) {
        WsBBConfigException configError = null;
        Object oClass = config.get("class");
        if (null != oClass && oClass instanceof String) {
            // bundle is specifying a custom class
            String className = (String) oClass;
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "Pool class: " + className);
            }
            config.remove("class");
            Class<?> clazz = null;
            try {
                // ClassLoader cl = Thread.currentThread().getContextClassLoader();
                ClassLoader cl = ByteBufferConfiguration.class.getClassLoader();
                if (null != cl) {
                    clazz = cl.loadClass(className);
                }
            } catch (Exception e) {
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                    Tr.debug(this, tc, "Class load failed using loader: " + e);
                }
                try {
                    clazz = Class.forName(className,
                                          true,
                                          Thread.currentThread().getContextClassLoader());
                } catch (Exception e2) {
                    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                        Tr.debug(this, tc, "Class load failed using Class.forName: " + e2);
                    }
                }
            }

            if (null != clazz) {
                try {
                    Constructor<?> c = clazz.getConstructor(new Class[] { Map.class });
                    return (WsByteBufferPoolManager) c.newInstance(new Object[] { config });
                } catch (Exception e) {
                    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                        Tr.debug(this, tc, "New instance of class " + clazz + " failed: " + e.getCause());
                    }
                    if (e.getCause() instanceof WsBBConfigException) {
                        configError = (WsBBConfigException) e.getCause();
                    }
                }
            }
        }

        // try the default class with the configuration (assuming that
        // config did not previously fail)
        if (null == configError) {
            try {
                return new WsByteBufferPoolManagerImpl(directByteBufferHelper, config);
            } catch (WsBBConfigException e) {
                if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
                    Tr.event(this, tc, "Error in configuration: " + e);
                }
            }
        }
        // if we failed to create the manager by now, it was due to bad
        // configuration
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(this, tc, "Using default pool class with default config");
        }
        try {
            return new WsByteBufferPoolManagerImpl(directByteBufferHelper);
        } catch (WsBBConfigException e) {
            // shouldn't be possible with default config...
            FFDCFilter.processException(e, getClass().getName() + ".createBufferManager", "2");
            if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
                Tr.event(this, tc, "Failure to create buffer manager: " + e);
            }
            return null;
        }
    }
461016
public static function driver() {
        $key = get_called_class();
        if($driver = Pool::get($key)) {
            return $driver;
        }

        $args = func_get_args();
        $config = static::config();
        $config and array_unshift($args,$config);
        $class =  call_user_func_array(
            'static::create',
            $args
        );

        return Pool::set($key,$class);
    }
647686
public void setPoolManagerRef(WsByteBufferPoolManagerImpl oManagerRef) {
        this.oWsByteBufferPoolManager = oManagerRef;
        this.trusted = oManagerRef.isTrustedUsers();

        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "setPoolManagerRef:  trusted=" + this.trusted);
        }
    }
1010362
public ByteBuffer getBuffer() {
        assert(isDirect == false);
        assert(buffer.b().hasArray());
        assert(!buffer.b().isDirect());
        buffer.b().flip();
        return buffer.b().asReadOnlyBuffer();
    }
333478
protected ObjectManagerByteArrayOutputStream[] getBuffers()
                    throws ObjectManagerException
    {
        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.entry(this, cclass
                        , "getBuffers"
                            );

        // Default log record behaviour.
        // -----------------------------

        // Captute the serialized Log Record.
        ObjectManagerByteArrayOutputStream serializedLogRecord = serialize(this);
        // Create an array for the header and the serialized ManagedObject.
        ObjectManagerByteArrayOutputStream[] buffers = new ObjectManagerByteArrayOutputStream[2];

        // We dont add a version to each logRecord, but use the logHeader version to enable
        // forward migration by assuming all logRecords in the log ore appropriate the the version of the
        // header.
        // Create the buffer to contain the header for this log record.
        buffers[0] = new ObjectManagerByteArrayOutputStream(4 // Log Record Type.
                                                            + 8);
        buffers[0].writeInt(LogRecord.TYPE_USER_DEFINED);
        buffers[0].writeLong(serializedLogRecord.getCount());

        // Now add a buffer containing the serialzed Log Record itself. 
        buffers[1] = serializedLogRecord;

        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.exit(this, cclass
                       , "getBuffers"
                       , "returns buffers=" + buffers + "(byte[][])"
                            );
        return buffers;
    }
9086
protected ObjectManagerByteArrayOutputStream[] getBuffers()
                    throws ObjectManagerException
    {
        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.entry(this,
                        cclass,
                        "getBuffers");

        ObjectManagerByteArrayOutputStream[] buffers = new ObjectManagerByteArrayOutputStream[1];

        // Create the buffer to contain the header for this log record.
        buffers[0] = new ObjectManagerByteArrayOutputStream(overhead);

        buffers[0].writeInt(LogRecord.TYPE_PADDING);
        buffers[0].writeInt(totalSize - overhead);

        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.exit(this,
                       cclass,
                       "getBuffers",
                       new Object[] { buffers }
                            );
        return buffers;
    }
48954
protected boolean isPooledBuffers()
   {
      if (tc.isEntryEnabled()) SibTr.entry(this, tc, "isPooledBuffers");
      if (tc.isEntryEnabled()) SibTr.exit(this, tc, "isPooledBuffers", ""+primaryHeaderFields.isPooled);
      return primaryHeaderFields.isPooled;
   }
604871
@Override
    public WsByteBuffer[] marshallLine() {
        WsByteBuffer[] firstLine = new WsByteBuffer[1];
        firstLine[0] = allocateBuffer(getOutgoingBufferSize());

        firstLine = putBytes(this.myMethod.getByteArray(), firstLine);
        firstLine = putByte(SPACE, firstLine);
        firstLine = putBytes(getMarshalledSecondToken(), firstLine);
        firstLine = putByte(SPACE, firstLine);
        firstLine = putBytes(getVersionValue().getByteArray(), firstLine);
        firstLine = putBytes(BNFHeaders.EOL, firstLine);
        // don't flip the last buffer as headers get tacked on the end
        if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
            String url = GenericUtils.nullOutPasswords(getMarshalledSecondToken(), (byte) '&');
            Tr.event(tc, "Marshalling first line: " + getMethod() + " " + url + " " + getVersion());
        }
        return firstLine;
    }
581637
public SIMPIterator getStreams()
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "getStreams");
    Iterator it = null;
    try
    {
      it = streamSet.iterator();
    }
    catch (SIResourceException e)
    {
      FFDCFilter.processException(
          e,
          "com.ibm.ws.sib.processor.runtime.TargetStreamSetControl.getStreams",
          "1:476:1.16",
          this);
      
        SIMPRuntimeOperationFailedException finalE =
          new SIMPRuntimeOperationFailedException(
            nls.getFormattedMessage(
              "INTERNAL_MESSAGING_ERROR_CWSIP0002",
              new Object[] {"TargetStreamSetControl.getStreams",
                  "1:484:1.16",
                            e},
              null), e);
            
        SibTr.exception(tc, finalE);
//        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getStreams", finalE);
//        throw finalE;
    }
    TargetStreamControllableIterator targetStreamIterator = 
      new TargetStreamControllableIterator(it, tsm);
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "getStreams", targetStreamIterator);      
    return targetStreamIterator;      
  }
1274465
protected function getReferencePool() {
        if (!$this->referencePool)
            $this->referencePool = new ReferencePool($this->label);
        return $this->referencePool;
    }
1308055
public static function getAccessControlManager()
	{
		if(self::$_instance === NULL)
			throw new SonicRuntimeException('Sonic instance not initialized');
		
		if(self::$_instance->accessControlManager != NULL)
			return self::$_instance->accessControlManager;
		else
			throw new AccessControlManagerException('AccessControlManager instance not found');
	}
147418
public ByteBuffer preProcessOneWriteBuffer() {
        // We can process the single buffer case more efficiently than if we
        // include it as a part of the multi-buffer logic
        WsByteBufferImpl wsBuffImpl = null;
        try {
            wsBuffImpl = (WsByteBufferImpl) getBuffer();
        } catch (ClassCastException cce) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "Writing with a non-WsByteBufferImpl");
            }
            return getBuffer().getWrappedByteBuffer();
        }

        if (!wsBuffImpl.isDirect() && wsBuffImpl.hasArray()) {
            wsBuffImpl.copyToDirectBuffer();
            return wsBuffImpl.oWsBBDirect;
        }
        return wsBuffImpl.getWrappedByteBufferNonSafe();
    }
236712
public synchronized CommsByteBuffer allocate()
   {
      if (tc.isEntryEnabled()) SibTr.entry(this, tc, "allocate");
   
      // Remove a CommsByteBuffer from the pool
      CommsByteBuffer buff = (CommsByteBuffer) pool.remove();
   
      // If the buffer is null then there was none available in the pool
      // So create a new one
      if (buff == null)
      {
         if (tc.isDebugEnabled()) SibTr.debug(this, tc, "No buffer available from pool - creating a new one");
      
         buff = createNew();
      }
   
      if (tc.isEntryEnabled()) SibTr.exit(this, tc, "allocate", buff);
      return buff;
   }
1257137
public WsByteBuffer wrap(com.ibm.wsspi.bytebuffer.WsByteBuffer realBuffer)
   {
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "wrap", realBuffer);

      RichByteBufferImpl returnBuffer = null;
      // Ensure here that if a null realBuffer was passed in we do not wrap that in a wrapper from
      // the pool - we must also simply return null
      if (realBuffer != null)
      {
         returnBuffer = getFromPool();
         returnBuffer.reset(realBuffer, this);
      }

      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "wrap", returnBuffer);
      return returnBuffer;
   }
515950
public SIMPIterator getPubSubDeliveryStreamSetReceiverIterator() {
		if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
			SibTr.entry(tc, "getPubSubDeliveryStreamSetReceiverIterator");

		SIMPIterator iterator = this.getInputHandler().getTargetStreamManager()
				.getTargetStreamSetControlIterator();

		if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
			SibTr.entry(tc, "getPubSubDeliveryStreamSetReceiverIterator");
		return iterator;
	}