0

i have got module and this module only read config from server via async callbacK:

@Singleton
public class Config {

private ConnectionSettings connectionSettings;

@Inject
protected Config(final MainRPCAsync mainRpc) {  

      configureConnection(mainRpc);
}

private void configureConnection(MainRPCAsync mainRpc) {

    Log.debug("****Configure connection..");

    mainRpc.getConfig(new AsyncCallback<Configuration>() {

        @Override
        public void onSuccess(Configuration result) {
            Log.debug("-----------Get config");
                                 //initialize configuration settings

            });             

        }

    });

and next this class Config is injected to another module but when i need to get configSettings from that module i get only null ....

and in log console i read info that line Log.debug("-----------Get config"); show info after all ...

Its possible be sure that connection settings will be initialized by rpc async before injection that class to another module ?

enrybo
  • 1,787
  • 1
  • 12
  • 20
Łukasz Woźniczka
  • 1,625
  • 3
  • 28
  • 51

1 Answers1

0

I have the same need. I want to pass the result into a widget created with GIN.

UPDATE I resolved with Assisted Injection. So, I create my widget into success method of async service, and I use the result for create my widget.

vimterd
  • 191
  • 3
  • 16