Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

399
Vistas
How to convert asynchronous call to synchronous for firebase access Amazon web service Lambda function in java

I want to call a AWS lambda function within which I am connecting to a Firebase database. The problem is that the handler executes before I get the needed data from Firebase.

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

A recipe to convert an asynchronous call into a synchronous one:

Let's assume the async call is called fooAsync(), and that you have some way to check a result condition when the operation is completed. You can introduce your own volatile boolean fooComplete to track this.

Then:

public void fooSyncWrapper() {
    volatile boolean fooComplete = false;

    Thread thread = new Thread() {
        @Override
        public void run() {
            fooAsync();

            while (!fooComplete) {
                // busy wait on completion condition
                fooComplete = checkIfComplete();
            }

            // task is completed, thread will join
        }
    };

    thread.start();
    thread.join();
}
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda