jayway/maven-android-plugin — pull request #304 by royclarkson (2014-03-06 21:27:54+00:00)
Title: Add parameter to configure number of threads used in device operations

Some platforms may not be able to support a large number of concurrent
device operations. Set 'android.deviceThreads' to limit the number
threads available in the thread pool. By default the thread pool size
is based on the number of attached devices.

I consistently experience a `java.io.IOException` when attempting to deploy and test on more than four attached devices. This is any combination of physical devices and emulators. If there are more than four devices reported by the Android Debug Bridge, then the parallel execution of device functions will fail with the following exception. I've tested on three different macs running various versions of Java. Unfortunately, I don't have a windows or linux machine available for testing.

```
Install of test.apk failed.
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:108)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:76)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:116)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:361)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:213)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:157)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: 20080411413fc082_Contel_TAB-730 : Install of /Users/rclarkson/Projects/spring-projects/spring-android/test/spring-android-core-test/target/spring-android-core-test.apk failed.
at com.jayway.maven.plugins.android.AbstractAndroidMojo$1.doWithDevice(AbstractAndroidMojo.java:654)
at com.jayway.maven.plugins.android.AbstractAndroidMojo$2.runDo(AbstractAndroidMojo.java:763)
at com.jayway.maven.plugins.android.AbstractAndroidMojo$DoThread.run(AbstractAndroidMojo.java:1324)
Caused by: com.android.ddmlib.InstallException: Broken pipe
at com.android.ddmlib.Device.installPackage(Device.java:880)
at com.jayway.maven.plugins.android.AbstractAndroidMojo$1.doWithDevice(AbstractAndroidMojo.java:641)
... 2 more
Caused by: java.io.IOException: Broken pipe
at sun.nio.ch.FileDispatcherImpl.write0(Native Method)
at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:47)
at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:93)
at sun.nio.ch.IOUtil.write(IOUtil.java:65)
at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:487)
at com.android.ddmlib.AdbHelper.write(AdbHelper.java:731)
at com.android.ddmlib.AdbHelper.write(AdbHelper.java:709)
at com.android.ddmlib.AdbHelper.setDevice(AdbHelper.java:770)
at com.android.ddmlib.SyncService.openSync(SyncService.java:168)
at com.android.ddmlib.Device.getSyncService(Device.java:514)
at com.android.ddmlib.Device.syncPackageToDevice(Device.java:901)
at com.android.ddmlib.Device.installPackage(Device.java:875)
... 3 more
```