Removed AssetsMojangOldLoader.java

This commit is contained in:
huanghongxun
2015-12-07 13:41:13 +08:00
parent d3ad805ad3
commit 8e2fa57868
11 changed files with 134 additions and 282 deletions

View File

@@ -0,0 +1,38 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package rx.concurrency;
import java.awt.EventQueue;
import java.util.concurrent.TimeUnit;
import rx.Subscription;
import rx.util.functions.Func0;
/**
*
* @author huangyuhui
*/
public class EventQueueScheduler extends AbstractScheduler {
private static final EventQueueScheduler INSTANCE = new EventQueueScheduler();
public static EventQueueScheduler getInstance() {
return INSTANCE;
}
@Override
public Subscription schedule(Func0<Subscription> action) {
final DiscardableAction discardableAction = new DiscardableAction(action);
EventQueue.invokeLater(discardableAction::call);
return discardableAction;
}
@Override
public Subscription schedule(Func0<Subscription> action, long dueTime, TimeUnit unit) {
return schedule(new SleepingAction(action, this, dueTime, unit));
}
}

View File

@@ -62,6 +62,15 @@ public class Schedulers {
return NewThreadScheduler.getInstance();
}
/**
* {@link Scheduler} that queues work on the EventQueue thread to be executed on the Swing UI Thread.
*
* @return {@link NewThreadScheduler} instance
*/
public static Scheduler eventQueue() {
return EventQueueScheduler.getInstance();
}
/**
* {@link Scheduler} that queues work on an {@link Executor}.
* <p>

View File

@@ -21,14 +21,7 @@ public class Subscriptions {
* @return {@link Subscription}
*/
public static Subscription create(final Action0 unsubscribe) {
return new Subscription() {
@Override
public void unsubscribe() {
unsubscribe.call();
}
};
return unsubscribe::call;
}
/**
@@ -38,21 +31,11 @@ public class Subscriptions {
*/
public static Subscription create(final Object unsubscribe) {
final FuncN<?> f = Functions.from(unsubscribe);
return new Subscription() {
@Override
public void unsubscribe() {
f.call();
}
};
return f::call;
}
/**
* A {@link Subscription} that does nothing when its unsubscribe method is called.
*/
private static Subscription EMPTY = new Subscription() {
public void unsubscribe() {
}
};
private static final Subscription EMPTY = () -> { };
}