@David I'm aware that oneway calls don't work with Http Server (and also I
do not require one) - so I use simple TSocket() connection with
TSimpleServer instance (I am using thrift for cross language calls mostly).

I instantiate them as follows:

*$handler = new DataGrabberServer();
$processor = new DataGrabberProcessor($handler);
$transport = new TServerSocket();
$inputTransportFactory= new TTransportFactory(new
TBufferedTransport($transport,1024,1024));
$inputProtocolFactory = new TBinaryProtocolFactory(true,true);
$outputTransportFactory= new TTransportFactory(new
TBufferedTransport($transport,1024,1024));
$outputProtocolFactory = new TBinaryProtocolFactory(true,true);
$server=new TSimpleServer($processor, $transport, $inputTransportFactory,
$outputTransportFactory, $inputProtocolFactory, $outputProtocolFactory);
$server->serve();*
*
*
On Fri, Mar 18, 2011 at 2:02 AM, David Reiss <[email protected]> wrote:

> Are you using an http-based server?  http doesn't support one-way messages,
> so oneway thrift calls always wait for the (empty) http response.
>
> --David
>
> On 03/17/2011 01:30 PM, Souvik Roy wrote:
> > Thanks for the reply Bryan. I did search JIRA, but no such bugs have been
> > reported yet.
> > I took a closer look into the functionality and found out something which
> I
> > wasn't expecting.
> > It seems as though subsequent "oneway" calls block each other and happen
> in
> > a synchronized fashion - the first call does happen asynchronously and
> out
> > of order though !
> > Consider the following code (based on the previous code snippet);
> >
> > //Server snippet
> > *public function test($test_bigint){
> > echo 'before sleep '. $test_bigint;
> > sleep(10);
> > echo 'after sleep '. $test_bigint;
> > }*
> >
> > If I call the above as:
> > *echo "Start";
> > $client->test(1);
> > echo "Done";
> > $client->test(2);*
> >
> > The output of the above is:
> > *Start
> > Done
> > before sleep1
> > after sleep1
> > before sleep2
> > after sleep2*
> >
> > I wonder if this was "meant to be" this way? All I'm trying is to execute
> a
> > method multiple times, in parallel. This can be achieved with threads in
> > other languages, but I was wondering if "oneway" methods can help me in
> PHP
> > here.
> >
> > Cheers!
> >
> > On Thu, Mar 17, 2011 at 10:13 PM, Bryan Duxbury <[email protected]>
> wrote:
> >> Sounds like a bug to me. I'm not aware of any existing issue, but you
> > might
> >> want to do a search in our JIRA.
> >>
> >> On Thu, Mar 17, 2011 at 8:59 AM, Souvik Roy <[email protected]>
> wrote:
> >>
> >>> Hi
> >>> I'm aware that PHP doesn't have threading support yet, hence a
> >>> MultiThreaded thrift server is not possible with Thrift in PHP
> >>> (right?). But I was under an impression than "oneway" asynchronous
> >>> functions do work with Thrift - PHP:server. But that doesn't seem to
> >>> be the case. To reproduce it, I wrote a small function defined as
> >>> follows:
> >>>
> >>> //Server snippet
> >>> public function test($test_bigint){
> >>> echo 'before sleep '. $test_bigint;
> >>> sleep(10);
> >>> echo 'after sleep '. $test_bigint;
> >>> }
> >>>
> >>> //Client snippet
> >>> for($i=0;$i<10;$i++){
> >>>    $client->test($i);
> >>>  }
> >>>
> >>> //Thrift IDL
> >>> service someservice{
> >>> oneway void test(1:i64 test_bigint)
> >>> }
> >>>
> >>> Ideally, the above should be executed asynchronously and should not
> >>> wait for the function to finish execution (and print "before sleep"$i
> >>> all through the iterated times at first). But the actual output waits
> >>> for sleep(10) and is executed synchronously.
> >>> Is this a known feature Bug? If this topic has been already discussed
> >>> earlier, can anyone please point me to the thread URL ?
> >>>
> >>> Thanks
> >>> --
> >>> Souvik Roy
> >>> http://www.souvikroy.com
> >>>
> >>
> >
> >
> >
>



-- 
Souvik Roy
http://www.souvikroy.com

Reply via email to