mirror of https://github.com/kurisufriend/Clover
This is to keep the listViewIndex, listViewTop and lastViewed the same Shit solution but it worksmultisite
parent
3ac7a1a348
commit
edd60126e6
@ -0,0 +1,33 @@ |
||||
package org.floens.chan.core.pool; |
||||
|
||||
import org.floens.chan.core.model.Loadable; |
||||
|
||||
import java.util.HashMap; |
||||
import java.util.Map; |
||||
|
||||
public class LoadablePool { |
||||
private static final LoadablePool instance = new LoadablePool(); |
||||
|
||||
private Map<Loadable, Loadable> pool = new HashMap<>(); |
||||
|
||||
private LoadablePool() { |
||||
} |
||||
|
||||
public static LoadablePool getInstance() { |
||||
return instance; |
||||
} |
||||
|
||||
public Loadable obtain(Loadable searchLoadable) { |
||||
if (searchLoadable.isThreadMode()) { |
||||
Loadable poolLoadable = pool.get(searchLoadable); |
||||
if (poolLoadable == null) { |
||||
poolLoadable = searchLoadable; |
||||
pool.put(poolLoadable, poolLoadable); |
||||
} |
||||
|
||||
return poolLoadable; |
||||
} else { |
||||
return searchLoadable; |
||||
} |
||||
} |
||||
} |
Loading…
Reference in new issue