forked from External/mage
download: reworked connection:
- added shareable code with default proxy, headers and other settings for download tasks like images, symbols, mtgjson, etc; - use XmageURLConnection.downloadText for text resources - use XmageURLConnection.downloadBinary for any file resources - added user agent with app version for all requests; - added http logs and improved error messages;
This commit is contained in:
parent
fad63389d0
commit
e1cffbde40
35 changed files with 713 additions and 464 deletions
|
|
@ -8,7 +8,7 @@ import mage.game.events.TableEvent.EventType;
|
|||
import mage.players.Player;
|
||||
import mage.players.PlayerList;
|
||||
import mage.util.ThreadUtils;
|
||||
import mage.util.XMageThreadFactory;
|
||||
import mage.util.XmageThreadFactory;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.util.*;
|
||||
|
|
@ -248,7 +248,7 @@ public abstract class DraftImpl implements Draft {
|
|||
|
||||
if (this.boosterLoadingExecutor == null) {
|
||||
this.boosterLoadingExecutor = Executors.newSingleThreadScheduledExecutor(
|
||||
new XMageThreadFactory(ThreadUtils.THREAD_PREFIX_TOURNEY_BOOSTERS_SEND)
|
||||
new XmageThreadFactory(ThreadUtils.THREAD_PREFIX_TOURNEY_BOOSTERS_SEND)
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,13 +8,13 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||
*
|
||||
* @author JayDi85
|
||||
*/
|
||||
public class XMageThreadFactory implements ThreadFactory {
|
||||
public class XmageThreadFactory implements ThreadFactory {
|
||||
|
||||
private final String prefix;
|
||||
private final AtomicInteger counter = new AtomicInteger();
|
||||
private final boolean isDaemon;
|
||||
|
||||
public XMageThreadFactory(String prefix) {
|
||||
public XmageThreadFactory(String prefix) {
|
||||
this(prefix, true);
|
||||
}
|
||||
|
||||
|
|
@ -22,7 +22,7 @@ public class XMageThreadFactory implements ThreadFactory {
|
|||
* @param prefix thread's starting name (can be changed by thread itself later)
|
||||
* @param isDaemon mark thread as daemon on non-writeable tasks (e.g. can be terminated at any time without data loss)
|
||||
*/
|
||||
public XMageThreadFactory(String prefix, boolean isDaemon) {
|
||||
public XmageThreadFactory(String prefix, boolean isDaemon) {
|
||||
this.prefix = prefix;
|
||||
this.isDaemon = isDaemon;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue