Java 8 WeakReference - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 WeakReference class.

This code example shows how to use the following methods:
  private final WeakReference<HistoryManager> historyManagerRef;
  private final List<Spannable> newContents;
  private final List<String[]> newHistories;
 
  SupplementalInfoRetriever(TextView textView, HistoryManager historyManager) {
    textViewRef = new WeakReference<TextView>(textView);
    historyManagerRef = new WeakReference<HistoryManager>(historyManager);
    newContents = new ArrayList<Spannable>();
    newHistories = new ArrayList<String[]>();
  } 
 
  @Override 
  public final Object doInBackground(Object... args) {
    try { 
      retrieveSupplementalInfo(); 
    } catch (IOException e) {
      Log.w(TAG, e);
    } 
    return null; 
  } 
9
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:get
        this.loader = new WeakReference<>(loader);
    } 
 
    @Override 
    public ClassLoader getClassLoader() {
        return this.loader.get();
    } 
 
    @Override 
    public int getCurrentVersion() { 
        return this.configuration.getCurrentMarshallingVersion();
    } 
 
    @Override 
    public Unmarshaller createUnmarshaller(int version) throws IOException {
        return this.factory.createUnmarshaller(this.getMarshallingConfiguration(version));
    } 
 
    @Override 
    public Marshaller createMarshaller(int version) throws IOException {
8
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
        super(delegate); 
    } 
 
    @Override 
    Reference<V> fold(V value) { 
        return new WeakReference<V>(value); 
    } 
 
} 
8
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:get
    private final ImageView mImageView;
 
    private WeakReference<Bitmap> bitmapReference;
 
    public BitmapFromURL(ImageView iv) {
        imageViewReference = new WeakReference<ImageView>(iv);
        mImageView = imageViewReference.get();
    } 
 
    @Override 
    protected Bitmap doInBackground(String... params) {
        bitmapReference = new WeakReference<Bitmap>(ApolloUtils.getBitmapFromURL(params[0]));
        return bitmapReference.get();
    } 
 
    @Override 
    protected void onPostExecute(Bitmap result) {
        if (result != null && mImageView != null)
            ApolloUtils.runnableBackground(mImageView, result);
        super.onPostExecute(result);
8
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:get
    @Override 
    public ClassLoader getServerIntegrationClassLoader() {
        if (integrationClassLoader == null || integrationClassLoader.get() == null) {
            try { 
                Module module = Module.getBootModuleLoader().loadModule(ASIL);
                integrationClassLoader = new WeakReference<ClassLoader>(module.getClassLoader());
            } catch (ModuleLoadException e) {
                throw new RuntimeException(e);
            } 
        } 
        return integrationClassLoader.get();
    } 
 
    @Override 
    public ClassLoader getServerJAXRPCIntegrationClassLoader() {
        throw new UnsupportedOperationException();
    } 
 
    public static void register() { 
        ClassLoaderProvider.setDefaultProvider(new ModuleClassLoaderProvider()); 
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
      // someone else put a queue in the map before we did 
      if (prev != null) {
        list = prev;
      } 
    } 
    list.add(new WeakReference<ByteBuffer>(buf));
  } 
   
  /** 
   * Return the number of available buffers of a given size. 
   * This is used only for tests. 
   */ 
  @VisibleForTesting 
  int countBuffersOfSize(int size) {
    Queue<WeakReference<ByteBuffer>> list = buffersBySize.get(size);
    if (list == null) {
      return 0; 
    } 
     
    return list.size();
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
 * @since 1.5.3 
 */ 
public class WeakMemoryCache extends BaseMemoryCache<String, Bitmap> { 
	@Override 
	protected Reference<Bitmap> createReference(Bitmap value) { 
		return new WeakReference<Bitmap>(value); 
	} 
} 
8
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:get
    private final AQuery aq;
 
    private final WeakReference<Context> contextReference;
 
    public LastfmGetArtistImages(Context context) {
        contextReference = new WeakReference<Context>(context);
 
        // Initiate AQuery 
        aq = new AQuery(contextReference.get());
    } 
 
    @Override 
    protected String doInBackground(String... artistname) {
        if (ApolloUtils.isOnline(contextReference.get()) && artistname[0] != null) {
            try { 
                artist = Artist.getImages(artistname[0], 1, 1, LASTFM_API_KEY);
                Iterator<Image> iterator = artist.getPageResults().iterator();
                while (iterator.hasNext()) {
                    Image mTemp = iterator.next();
                    url = mTemp.getImageURL(ImageSize.LARGESQUARE);
8
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:get
    public boolean isUseUnprefixedChildTypes() { 
        return useUnprefixedChildTypes;
    } 
 
    public StandardResourceDescriptionResolver getChildResolver(String key){
        return new StandardResourceDescriptionResolver(keyPrefix+"."+key,bundleBaseName,bundleLoader.get(),reuseAttributesForAdd,useUnprefixedChildTypes);
    } 
 
    /** {@inheritDoc} */ 
    @Override 
    public ResourceBundle getResourceBundle(Locale locale) {
        if (locale == null) {
            locale = Locale.getDefault();
        } 
        return ResourceBundle.getBundle(bundleBaseName, locale, bundleLoader.get());
    } 
 
    /** {@inheritDoc} */ 
    @Override 
    public String getResourceDescription(Locale locale, ResourceBundle bundle) {
8
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
			instance = applicationContext.getBean(name, ref.getClazz());
			singleton = applicationContext.isSingleton(name);
			// if singleton put into cache with clazz and bean name key 
			if (singleton)
			{ 
				instanceRef = new WeakReference<T>(instance);
				singletonCache.put(singletonCacheKey, instanceRef);
			} 
		} 
 
		// if singleton and originally name was not given (eg. clazz based only 
		// lookup) put into cache with clazz name 
		if (ref.isClazzBasedOnlyLookup() && singleton)
			singletonCache.put(clazzName, instanceRef);
 
		ref.setInstanceRef(instanceRef);
 
		return instance;
	} 
 
	/** 
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java

Related Java 8 WeakReference Questions & Answers:

See Code Examples for Java 8 WeakReference Methods: