TimeoutException in MediaRecorder.finalize() after 10 seconds

stacktrace0=java.util.concurrent.TimeoutException:
android.media.MediaRecorder.finalize() timed out after 10
seconds
    at android.media.MediaRecorder.native_finalize(Native Method)
    at android.media.MediaRecorder.finalize(MediaRecorder.java:1200)
    at java.lang.Daemons$FinalizerDaemon.doFinalize(Daemons.java:187)
    at java.lang.Daemons$FinalizerDaemon.run(Daemons.java:170)
    at java.lang.Thread.run(Thread.java:841)

if (isDirectoryExists) 
{
MediaRecorder recorder= new MediaRecorder();
recorder.reset();
recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
recorder.setOutputFormat(MediaRecorder.OutputFormat.RAW_AMR);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
recorder.setOutputFile(path);
recorder.setMaxDuration(30*60*1000);

if(recorder!=null)
{
    recorder.prepare();
}
try
{
    if(recorder!=null)
    {
        recorder.start();
        isRecordingStarted=true;
    }
}
catch (IllegalStateException ilse) 
{
    try
    {
        if(recorder!=null)
        {
            recorder.prepare();
        }
    }
    catch(Exception e)
    {
        e.printStackTrace();
    }
    try
    {
        if(recorder!=null)
        {
            recorder.start();
        }
    }
    catch(Exception e)
    {
        e.printStackTrace();
    }
}

}

Detail : This problem is mainly arrived in android 4.3 when first time exception occur when we again going for prepare and start media recorder. this logic successfully work in 4.0.. i dont understand why this exception occur.

Answers


It seems that if device decide to sleep, and GC decide to run, then this will be happen.

See below:

Sometimes (very rarely) the System will decide to Sleep in the middle of the GC run.

If the sleep time was long - over 10 seconds, the concurrent.timeout exception will be thrown.

How to handle :java.util.concurrent.TimeoutException: android.os.BinderProxy.finalize() timed out after 10 seconds errors?


Need Your Help

Assign percentage to PercentFrameLayout with databinding

android android-databinding android-percent-library percent-support-library

Trying to create simple graph with layout using percent support library, but I'm not able to figure out, how to assign percents to view through databinding. Tried returning String "60%", float 0.6f,

Want to use LIKE clause

sql drupal drupal-7

I have written a query which gets the node title according to 'term ID' for a 'portfolio' content type.Now I want to get the 'node title' according to the character that means I want to use 'LIKE' ...