Re: [Asterisk-java-devel] timoute on sending actions ...
Brought to you by:
srt
|
From: Daniel G. <da...@gr...> - 2007-02-16 09:11:46
|
This problem was fixed with using different threads for sendin actions.
I really do net get why but must be some thread issues that I just didnt
see right now ...
My code :
Future<String> task = actionExecutorService.submit(new Callable<String>(){
@Override
public String call(){
ManagerResponse resp = null;
try {
resp =
serverImpl.getManagerConnection().sendAction(action);
} catch (IOException e) {
log.error("communication problem", e);
return "server communication problem";
} catch (TimeoutException e) {
log.error("timeout on sending action : the
action could still be sent");
//return "timeout on sending action : the action
could still be sent";
} catch (Throwable e){
log.error("unexpected error occured", e);
return "unexpected error : "+e.getMessage();
}
if( resp != null && resp instanceof ManagerError
){
return "response error : "+resp.getMessage();
}else if ( resp == null ){
return "response error : null";
} else{
return "success";
}
}
});
Now there is a the same TimeoutException when I wait for the thread to
be finished like that ...
try {
return task.get();
} catch (InterruptedException e1) {
log.warn("interrupted", e1);
return "failed : interruption";
} catch (ExecutionException e1) {
log.error("execution failed", e1);
return "failed : execution failed";
}
This is really strange. Actually, when I run a simple program as
standalone it works fine without Timeout but as I am using
Tomcat/Liferay/Portlets/Spring/DWR there might be
a threading issue, but I just do not get why asterisk java would break
on that.
Daniel.
Daniel Gradecak wrote:
> Hi Stefan,
>
> do you know why these lines of code throws TimeoutException all the time ?
>
> try {
>
> ManagerResponse re =
> serverImpl.getManagerConnection().sendAction(new QueueStatusAction());
> }catch (TimeoutException e) {
> log.warn("timeout on queue status action", e);
> } catch (IOException e) {
> log.error("communication problem", e);
> return;
> }
>
> I laso did try to send the action via sendEventGeneratingAction as it is
> done in org.asteriskjava.live.internal.QueueManager#initialize but I
> still receive the timeoute, even
> if the events are correctly sent by asterisk, so the action has been
> also received by asterisk. I am using asterisk 1.4.
>
>
> So in this first case it is ok, because i know the bug ... but here ...
> as you suggested to me in a previous thread I just want to see if i
> receive the peer context ... i also receive the TimeoutException.
> Whatever i do, event setting the timeout to 20 seconds ... there is no
> help.
>
> CommandAction act = new CommandAction("sip show peer
> "+event.getObjectName());
> CommandResponse response = (CommandResponse)
> serverImpl.getManagerConnection().sendAction(act,15000);
> for (String line : response.getResult()){
> System.out.println("RESP : "+line);
> }
>
> Do you know for what reason? Everything else is fine but sending any
> actions cause a TimeoutException.
>
> Another example is this also ...
>
> OriginateAction o = new OriginateAction();
> o.setContext(context.getOutgoingContext());
> o.setCallerId(from);
> o.setChannel("SIP/"+from);
> o.setExten(to);
> o.setPriority(1);
> //o.setTimeout(new Long(30000));
>
> ManagerResponse resp = null;
> try {
> resp = serverImpl.getManagerConnection().sendAction(o);
>
> } catch (TimeoutException e) {
> //FIXME : there is a problem with timeout
> log.warn("Timeout for call from " + from + " to " + to+".
> Message : "+e.getMessage());
> //return "";
> } catch (IOException e) {
> e.printStackTrace();
> log.error("dial error : server communication",e);
> return "dial error : server communication";
> }
>
> Regards,
> Daniel
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys-and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Asterisk-java-devel mailing list
> Ast...@li...
> https://lists.sourceforge.net/lists/listinfo/asterisk-java-devel
>
|