use of java.util.concurrent.Executor in project flyway by flyway.
the class FlywayPerformanceMediumTest method generateLotsOfInstallerScripts.
@Before
public void generateLotsOfInstallerScripts() throws IOException {
//noinspection ResultOfMethodCallIgnored
new File(DIR).mkdirs();
Executor executor = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors() * 2);
for (int i = (scriptCount - 500); i < scriptCount; i++) {
final int j = i;
executor.execute(new Runnable() {
@Override
public void run() {
try {
IOUtils.write("SELECT " + j + " FROM DUAL", new FileOutputStream(DIR + "/V" + j + "__Test.sql"));
} catch (IOException e) {
e.printStackTrace();
}
}
});
}
}
use of java.util.concurrent.Executor in project facebook-android-sdk by facebook.
the class FacebookSdkPowerMockTest method testSetExecutor.
@Test
public void testSetExecutor() {
final ConditionVariable condition = new ConditionVariable();
final Runnable runnable = new Runnable() {
@Override
public void run() {
}
};
final Executor executor = new Executor() {
@Override
public void execute(Runnable command) {
assertEquals(runnable, command);
command.run();
condition.open();
}
};
Executor original = FacebookSdk.getExecutor();
try {
FacebookSdk.setExecutor(executor);
FacebookSdk.getExecutor().execute(runnable);
boolean success = condition.block(5000);
assertTrue(success);
} finally {
FacebookSdk.setExecutor(original);
}
}
use of java.util.concurrent.Executor in project fresco by facebook.
the class AbstractDataSource method notifyProgressUpdate.
protected void notifyProgressUpdate() {
for (Pair<DataSubscriber<T>, Executor> pair : mSubscribers) {
final DataSubscriber<T> subscriber = pair.first;
Executor executor = pair.second;
executor.execute(new Runnable() {
@Override
public void run() {
subscriber.onProgressUpdate(AbstractDataSource.this);
}
});
}
}
use of java.util.concurrent.Executor in project agera by google.
the class CompiledRepository method runGoTo.
private int runGoTo(@NonNull final Object[] directives, final int index) {
Executor executor = (Executor) directives[index + 1];
executor.execute(this);
return -1;
}
use of java.util.concurrent.Executor in project hazelcast by hazelcast.
the class DelegateAndSkipOnConcurrentExecutionDecoratorTest method toString_contains_runnables_info.
@Test
public void toString_contains_runnables_info() throws Exception {
ResumableCountingRunnable runnable = new ResumableCountingRunnable();
Executor executor = new Executor() {
@Override
public void execute(Runnable command) {
}
};
String stringified = new DelegateAndSkipOnConcurrentExecutionDecorator(runnable, executor).toString();
assertTrue(stringified.contains("ResumableCountingRunnable"));
}
Aggregations