Hi,
i'm trying to handle the connection of my application automatically.
So, i created a thread that checks each 10seconds if strategy class is connected, and if it's connected show me OK, else try to connect again.
I use this method in my class, where stg is Strategy attribute:
public boolean isConnected(){
boolean isConnected=false;
try{
isConnected=stg.isConnected();
}catch(Exception e){
isConnected=false;
}
return isConnected;
}
So, in thread, if(!isConnected()), the strategy is connected, else show me "OK".
I tryed to do some tests:
1) i tryed to close terminal using close_all_nj4x_terminals.bat:
Using stg.setRreconnect(true),i have this behaviour: for about 4/5 minutes,i have "java.lang.RuntimeException:
2088800058 is already connecting to Armada-DemoUK" and (using SW_HIDE false) i can see terminal went open and closed continuosly. After this time, i can see stg.connect() hang for some seconds, and at the end all came back ok and isConnected() answered true.
Using stg.setRreconnect(false), i have this behaviour:
the connect() hang up for about 20-30second, and after give me this:
java.lang.NullPointerException
at com.jfx.strategy.Strategy.startCoordination(Strategy.java:947)
at com.jfx.strategy.Strategy.connect(Strategy.java:926)
at com.jfx.strategy.Strategy.connect(Strategy.java:603)
After this exception, isConnected() is true!
2) i tryed to stop internet connection for some time. At restart internet connecion i had this behaviour:
Using stg.setRreconnect(true), at some point stg.connect() hang up one time for more than 5 minutes... than i stopped my application because i have no more answer from connect() method!
Using stg.setRreconnect(false), stg.connect() hang up about 5/6 times, for about 2 minutes each one, i can see terminal went opened and closed, but nothing happened and i stop my application.
So in both point 2's cases, never more isConnected() return me true!
Please, can you clarify how we can do the correct check?
More, when internet connection went down, seems the strategy doesn't want connect anymore...