This method must be implemented for PoolableAdapter
973227
@Override
    public String invoke(Object connection, String request, int timeout, Map<String,String> metainfo)
    throws ConnectionException, AdapterException {
        String response;
        try{
            if (timeout<=0) timeout = DEFAULT_TIMEOUT;
            SoccomClient client = (SoccomClient)connection;
            client.putreq(request);
            response = client.getresp(timeout);
        } catch (SoccomException ex){
            if (ex.getErrorCode()==SoccomException.POLL_TIMEOUT)
                throw new ConnectionException(ConnectionException.CONNECTION_DOWN, ex.getMessage(), ex);
            else throw new AdapterException(-1, ex.getMessage(), ex);
        }
        return response;
    }
868755
private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException {
        ObjectInputStream.GetField getField = s.readFields();

        version = getField.get("version", 1);
        resourceAdapterKey = (String) getField.get("resourceAdapterKey", null);
    }
448641
@SuppressWarnings("unchecked")
    public void setAdapter(@Nullable AdaptiveTableAdapter adapter) {
        if (mAdapter != null) {
            // remove observers from old adapter
            mAdapter.unregisterDataSetObserver(this);
        }

        if (adapter != null) {
            // wrap adapter
            mAdapter = new LinkedAdaptiveTableAdapterImpl<>(adapter, mSettings.isSolidRowHeader());
            // register notify callbacks
            mAdapter.registerDataSetObserver(this);
            adapter.registerDataSetObserver(new DataSetObserverProxy(mAdapter));
        } else {
            // remove adapter
            mAdapter = null;
        }
        initItems();
    }
955521
@Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);

        try
        {
            mCallback = (DateChangedListener) getTargetFragment();
        }
        catch (ClassCastException e)
        {
            throw new ClassCastException("Calling fragment must implement " +
                "DateFragment.DateChangedListener interface");
        }
    }
277455
public void setAdapter(SpinnerAdapter adapter) {
		if(mAdapter != null)
			mAdapter.unregisterDataSetObserver(mDataSetObserver);

        mRecycler.clear();

		mAdapter = adapter;
		mAdapter.registerDataSetObserver(mDataSetObserver);
		onDataChanged();

        if (mPopup != null)
            mPopup.setAdapter(new DropDownAdapter(adapter));
        else
            mTempAdapter = new DropDownAdapter(adapter);
	}
1004946
public void setListAdapter(ListAdapter adapter) {
        boolean hadAdapter = mAdapter != null;
        mAdapter = adapter;
        if (mList != null) {
            mList.setAdapter(adapter);
            if (!mListShown && !hadAdapter) {
                // The list was hidden, and previously didn't have an
                // adapter.  It is now time to show it.
                setListShown(true, getView().getWindowToken() != null);
            }
        }
    }
81905
public static Map<String, List<Interaction>> getPoolData(List<TraceEvent> data,
                                                            boolean ignoreDelist, boolean ignoreTracking,
                                                            boolean ignoreIncomplete)
   {
      // Pool -> Interactions
      Map<String, List<Interaction>> result = new TreeMap<String, List<Interaction>>();
      
      // Pool -> ConnectionListener -> Events
      Map<String, Map<String, List<TraceEvent>>> temp = new TreeMap<String, Map<String, List<TraceEvent>>>();

      for (int i = 0; i < data.size(); i++)
      {
         TraceEvent te = data.get(i);

         Map<String, List<TraceEvent>> m = temp.get(te.getPool());

         if (m == null)
            m = new TreeMap<String, List<TraceEvent>>();

         List<TraceEvent> l = m.get(te.getConnectionListener());

         if (l == null)
            l = new ArrayList<TraceEvent>();

         l.add(te);

         if (isEndState(te))
         {
            Interaction interaction = new Interaction(te.getThreadId(),
                                                      l.get(0).getTimestamp(),
                                                      l.get(l.size() - 1).getTimestamp(),
                                                      l,
                                                      getStatus(l, ignoreDelist, ignoreTracking, ignoreIncomplete));
            List<Interaction> pool = result.get(te.getPool());

            if (pool == null)
               pool = new ArrayList<Interaction>();

            pool.add(interaction);
            result.put(te.getPool(), pool);
            l = null;
         }
         
         m.put(te.getConnectionListener(), l);
         temp.put(te.getPool(), m);
      }

      if (!ignoreIncomplete)
      {
         for (Map.Entry<String, Map<String, List<TraceEvent>>> poolEntry : temp.entrySet())
         {
            for (Map.Entry<String, List<TraceEvent>> clEntry : poolEntry.getValue().entrySet())
            {
               List<TraceEvent> l = clEntry.getValue();

               if (l != null)
               {
                  Interaction interaction = new Interaction(l.get(0).getThreadId(),
                                                            l.get(0).getTimestamp(),
                                                            l.get(l.size() - 1).getTimestamp(),
                                                            l,
                                                            getStatus(l, ignoreDelist, ignoreTracking,
                                                                      ignoreIncomplete));
                  List<Interaction> pool = result.get(poolEntry.getKey());
               
                  if (pool == null)
                     pool = new ArrayList<Interaction>();

                  pool.add(interaction);
                  result.put(poolEntry.getKey(), pool);
               }
            }
         }
      }
      
      return result;
   }
601868
public <A extends IAdapter<Item>> FastAdapter<Item> addAdapter(int index, A adapter) {
        mAdapters.add(index, adapter);
        adapter.withFastAdapter(this);
        adapter.mapPossibleTypes(adapter.getAdapterItems());
        for (int i = 0; i < mAdapters.size(); i++) {
            mAdapters.get(i).setOrder(i);
        }
        cacheSizes();
        return this;
    }
1305099
protected void storeXaPool(XaPool pool, XMLStreamWriter writer) throws Exception
   {
      writer.writeStartElement(CommonXML.ELEMENT_XA_POOL);

      if (pool.getType() != null)
         writer.writeAttribute(CommonXML.ATTRIBUTE_TYPE,
                               pool.getValue(CommonXML.ATTRIBUTE_TYPE, pool.getType()));

      if (pool.getType() != null)
         writer.writeAttribute(CommonXML.ATTRIBUTE_JANITOR,
                               pool.getValue(CommonXML.ATTRIBUTE_JANITOR, pool.getJanitor()));

      if (pool.getMinPoolSize() != null && (pool.hasExpression(CommonXML.ELEMENT_MIN_POOL_SIZE) ||
                                            !Defaults.MIN_POOL_SIZE.equals(pool.getMinPoolSize())))
      {
         writer.writeStartElement(CommonXML.ELEMENT_MIN_POOL_SIZE);
         writer.writeCharacters(pool.getValue(CommonXML.ELEMENT_MIN_POOL_SIZE, pool.getMinPoolSize().toString()));
         writer.writeEndElement();
      }

      if (pool.getInitialPoolSize() != null)
      {
         writer.writeStartElement(CommonXML.ELEMENT_INITIAL_POOL_SIZE);
         writer.writeCharacters(pool.getValue(CommonXML.ELEMENT_INITIAL_POOL_SIZE,
                                              pool.getInitialPoolSize().toString()));
         writer.writeEndElement();
      }

      if (pool.getMaxPoolSize() != null && (pool.hasExpression(CommonXML.ELEMENT_MAX_POOL_SIZE) ||
                                            !Defaults.MAX_POOL_SIZE.equals(pool.getMaxPoolSize())))
      {
         writer.writeStartElement(CommonXML.ELEMENT_MAX_POOL_SIZE);
         writer.writeCharacters(pool.getValue(CommonXML.ELEMENT_MAX_POOL_SIZE, pool.getMaxPoolSize().toString()));
         writer.writeEndElement();
      }

      if (pool.isPrefill() != null && (pool.hasExpression(CommonXML.ELEMENT_PREFILL) ||
                                       !Defaults.PREFILL.equals(pool.isPrefill())))
      {
         writer.writeStartElement(CommonXML.ELEMENT_PREFILL);
         writer.writeCharacters(pool.getValue(CommonXML.ELEMENT_PREFILL, pool.isPrefill().toString()));
         writer.writeEndElement();
      }

      if (pool.getFlushStrategy() != null && (pool.hasExpression(CommonXML.ELEMENT_FLUSH_STRATEGY) ||
                                              !Defaults.FLUSH_STRATEGY.equals(pool.getFlushStrategy())))
      {
         writer.writeStartElement(CommonXML.ELEMENT_FLUSH_STRATEGY);
         writer.writeCharacters(pool.getValue(CommonXML.ELEMENT_FLUSH_STRATEGY, pool.getFlushStrategy().toString()));
         writer.writeEndElement();
      }

      if (pool.getCapacity() != null)
         storeCapacity(pool.getCapacity(), writer);

      if (pool.isIsSameRmOverride() != null)
      {
         writer.writeStartElement(CommonXML.ELEMENT_IS_SAME_RM_OVERRIDE);
         writer.writeCharacters(pool.getValue(CommonXML.ELEMENT_IS_SAME_RM_OVERRIDE,
                                              pool.isIsSameRmOverride().toString()));
         writer.writeEndElement();
      }

      if (pool.isPadXid() != null && (pool.hasExpression(CommonXML.ELEMENT_PAD_XID) ||
                                      !Defaults.PAD_XID.equals(pool.isPadXid())))
      {
         writer.writeStartElement(CommonXML.ELEMENT_PAD_XID);
         writer.writeCharacters(pool.getValue(CommonXML.ELEMENT_PAD_XID, pool.isPadXid().toString()));
         writer.writeEndElement();
      }

      if (pool.isWrapXaResource() != null && (pool.hasExpression(CommonXML.ELEMENT_WRAP_XA_RESOURCE) ||
                                              !Defaults.WRAP_XA_RESOURCE.equals(pool.isWrapXaResource())))
      {
         writer.writeStartElement(CommonXML.ELEMENT_WRAP_XA_RESOURCE);
         writer.writeCharacters(pool.getValue(CommonXML.ELEMENT_WRAP_XA_RESOURCE, pool.isWrapXaResource().toString()));
         writer.writeEndElement();
      }

      writer.writeEndElement();
   }
705275
public void setAdapter(RecyclerView.Adapter adapter) {
        if (mWrappedAdapter != null && mWrappedAdapter.getItemCount() > 0) {
            notifyItemRangeRemoved(getHeaderCount(), mWrappedAdapter.getItemCount());
        }
        setWrappedAdapter(adapter);
        notifyItemRangeInserted(getHeaderCount(), mWrappedAdapter.getItemCount());
    }
81321
public static void cursor2Java(MethodSpec.Builder methodBuilder, TypeName beanClass, ModelProperty property,
			String beanName, String cursorName, String indexName) {
		TypeName typeName = property.getPropertyType().getTypeName();

		if (property.hasTypeAdapter()) {
			typeName = typeName(property.typeAdapter.dataType);
		}
		SQLTransform transform = lookup(typeName);

		AssertKripton.assertTrueOrUnsupportedFieldTypeException(transform != null,
				TypeUtility.typeName(property.getElement().asType()));
		transform.generateReadPropertyFromCursor(methodBuilder, beanClass, beanName, property, cursorName, indexName);
	}
1325228
void init() {
        if (dataSource == null) {
            if (connectionType.equals(ConnectionType.POOLED)) {
                HikariConfig config = new HikariConfig();
                config.setMaximumPoolSize(maximumPoolSize);
                config.setDataSourceClassName(dataSourceClass);
                config.addDataSourceProperty("url", url);
                config.addDataSourceProperty("user", user);
                config.addDataSourceProperty("password", password);
                config.setPoolName(CONNECTION_POOL_NAME);
                config.setAutoCommit(autoCommit);
                config.setMaximumPoolSize(maximumPoolSize);
              //  config.setConnectionTestQuery("SELECT 1");
                
                if (connectionTimeout != null) {
                    config.setConnectionTimeout(connectionTimeout);
                }
                if (idleTimeout != null) {
                    config.setIdleTimeout(idleTimeout);
                }
                if (maxLifetime != null) {
                    config.setMaxLifetime(maxLifetime);
                }
                if (minimumIdle != null) {
                    config.setMinimumIdle(minimumIdle);
                }

                ds = new HikariDataSource(config);
                dataSource = ds;

            } else if (connectionType.equals(ConnectionType.JNDI)) {
                if (null == jndiDataSource) {
                    throw new InitializationException("Could not obtain the db connection: jndi data source is null");
                }
                String DATASOURCE_CONTEXT = jndiDataSource;
                try {
                    Context initialContext = new InitialContext();
                    dataSource = (DataSource) initialContext.lookup(DATASOURCE_CONTEXT);
                    if (dataSource == null) {
                        Log.error("Failed to lookup datasource.");
                        throw new InitializationException(
                                "Could not obtain the db connection: Failed to lookup datasource: " + jndiDataSource);
                    }
                } catch (NamingException ex) {
                    throw new InitializationException("Could not obtain the db connection: jndi lookup failed", ex);
                }
            }
        }
    }
637594
public Object getAdapter(Class required)
	{
		if (IShowInSource.class.equals(required))
		{
			return this;
		}
		if (IShowInTargetList.class.equals(required))
		{
			return this;
		}
		// CONTEXTLAUNCHING
		if (ILaunchConfiguration.class.equals(required))
		{
			ILaunch launch = getProcess().getLaunch();
			if (launch != null)
			{
				return launch.getLaunchConfiguration();
			}
			return null;
		}
		return null;
	}
187430
@Override
    public void registerAdapterDataObserver(RecyclerView.AdapterDataObserver observer) {
        super.registerAdapterDataObserver(observer);
        if (mAdapter != null) {
            mAdapter.registerAdapterDataObserver(observer);
        }
    }
321842
private void registerModelAdapter() {
        Dictionary<String, Object> properties = createResourceToModelAdapterProperties();
        String serviceClassName = AdapterFactory.class.getName();
        this.resourceToModelAdapterRegistration = this.context.registerService(serviceClassName, this.adapter, properties);
    }
621583
@Override
  protected Bitmap decodeByteArrayAsPurgeable(
      CloseableReference<PooledByteBuffer> bytesRef, BitmapFactory.Options options) {
    final PooledByteBuffer pooledByteBuffer = bytesRef.get();
    final int length = pooledByteBuffer.size();
    final CloseableReference<byte[]> encodedBytesArrayRef = mFlexByteArrayPool.get(length);
    try {
      final byte[] encodedBytesArray = encodedBytesArrayRef.get();
      pooledByteBuffer.read(0, encodedBytesArray, 0, length);
      Bitmap bitmap = BitmapFactory.decodeByteArray(
          encodedBytesArray,
          0,
          length,
          options);
      return Preconditions.checkNotNull(bitmap, "BitmapFactory returned null");
    } finally {
      CloseableReference.closeSafely(encodedBytesArrayRef);
    }
  }
38058
void indexPool() {
        poolIdx = new int[nextChar()];
        poolObj = new Object[poolIdx.length];
        int i = 1;
        while (i < poolIdx.length) {
            poolIdx[i++] = bp;
            byte tag = buf[bp++];
            switch (tag) {
            case CONSTANT_Utf8: case CONSTANT_Unicode: {
                int len = nextChar();
                bp = bp + len;
                break;
            }
            case CONSTANT_Class:
            case CONSTANT_String:
            case CONSTANT_MethodType:
                bp = bp + 2;
                break;
            case CONSTANT_MethodHandle:
                bp = bp + 3;
                break;
            case CONSTANT_Fieldref:
            case CONSTANT_Methodref:
            case CONSTANT_InterfaceMethodref:
            case CONSTANT_NameandType:
            case CONSTANT_Integer:
            case CONSTANT_Float:
            case CONSTANT_InvokeDynamic:
                bp = bp + 4;
                break;
            case CONSTANT_Long:
            case CONSTANT_Double:
                bp = bp + 8;
                i++;
                break;
            default:
                throw badClassFile("bad.const.pool.tag.at",
                                   Byte.toString(tag),
                                   Integer.toString(bp -1));
            }
        }
    }