Results 1 to 2 of 2

Thread: VHost.getApplication() freezes module when called in HTTPProvider

  1. #1
    Join Date
    Mar 2014
    Posts
    2

    Default VHost.getApplication() freezes module when called in HTTPProvider

    Hi,

    I'm having an issue with my HTTPProvider. I've setup a HTTPProvider to communicate between applications. In the client module I do a request to the HTTPProvider in the onAppStart. For testing purposes this is done on the same server. When the HTTPProvider.onHTTPRequest is called and tries to get the application from the vHost wowza freezes. If I wrap the http request in a TimerTask and perform it 1ms later, everything is fine. Any suggestions how to make sure I can get the application without using ugly timers?

    Data Module
    public void onAppStart(IApplicationInstance appInstance) 
    {
    	super.onAppStart( appInstance );
    	String response = null;
    	String method= "test";
    
    	byte[] resp = HTTPUtils.HTTPRequestToByteArray( "http://localhost:8086/olsa-streamer/"+_module.getSeminarId()+"/"+method, "POST", null, null );
    	try {
    		response = new String( resp, "UTF-8" );
    		JSONObject jsonResponse = new JSONObject( response );
    		return OLSAStreamerResponse.fromJSON(jsonResponse);
    	} catch (UnsupportedEncodingException e) {
    		// TODO Auto-generated catch block
    		e.printStackTrace();
    	} catch (JSONException e) {
    		// TODO Auto-generated catch block
    		e.printStackTrace();
    	}
    
    }
    HTTPProvider
    public void onHTTPRequest( IVHost inVhost, IHTTPRequest req, IHTTPResponse resp ) 
    {
    	String appName = "olsa-streamer";
    	log.info( "has app " +appName+" "+Boolean.toString( inVhost.applicationExists( appName ) ) );
    	IApplication application = inVhost.getApplication( appName );
    	log.info( "fetched app " +appName );
    }

  2. #2
    Join Date
    May 2013
    Posts
    680

    Default

    In this scenario the application reference will be locked (WMSReadWriteLock) and will prevent you from accessing it in this manner. You would have to create a thread to execute after the release of the lock (probably why your 1ms thread works). You might possible consider a later event i.e. onConnect etc.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •