Re: Adding a listener to an input pipe

"Leandro Quiroga" <[email protected]> Fri, 29 Dec 2006 12:33:11 -0300
Newsgroups gmane.comp.java.jxta.user
Message-ID <[email protected]>
------=_NextPart_000_0016_01C72B45.808D2520
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi, this would not work, because Java uses reference by value parameters =
passing.
Happy new year!!

Leandro

  ----- Original Message -----=20
  From: Ashutosh Adkar=20
  To: [email protected]=20
  Sent: Friday, December 29, 2006 12:58 AM
  Subject: Re: [JXTA user] Adding a listener to an input pipe


  Funny.I thought there was method like =
myInputPipe.addListener(....).But I just check the docs and there isn't =
one.I think one way to get around this is is to pass a null reference to =
a listener and then assign that reference to a live object when you want =
to assign a listener to that pipe.=20
  Something like this,

     PipeMsgListener listener =3D null;
  =20
     myInputPipe =3D pipeService.createInputPipe(pipeAdv,listener);
     .....
     .....=20
     listener =3D new PipeMsgListener() {
     ....
     ....=20
     };
    =20
     Think this should work though ... :-P



  On 12/27/06, Hugo Giusti <[email protected] > wrote:
    Hi everyone,


    I've been using myInputPipe =3D pipeService.createInputPipe =
(pipeAdv,listener) to create an input pipe and add a listener to it but =
I was wondering if there is a way to create the pipe and add the =
listener later, can anyone tell me how to do this?

    Thanks in advance.
    Hugo=20




    __________________________________________________
    Correo Yahoo!
    Espacio para todos tus mensajes, antivirus y antispam =A1gratis!
    =A1Abr=ED tu cuenta ya! - http://correo.yahoo.com.ar=20

    =
---------------------------------------------------------------------
    To unsubscribe, e-mail: [email protected]
    For additional commands, e-mail: [email protected]




------=_NextPart_000_0016_01C72B45.808D2520
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2900.3020" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hi, this would not work, because Java =
uses=20
reference by value parameters passing.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Happy new year!!</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Leandro</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<BLOCKQUOTE=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
  <DIV style=3D"FONT: 10pt arial">----- Original Message ----- </DIV>
  <DIV=20
  style=3D"BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: =
black"><B>From:</B>=20
  <A [email protected] =
href=3D"mailto:[email protected]">Ashutosh=20
  Adkar</A> </DIV>
  <DIV style=3D"FONT: 10pt arial"><B>To:</B> <A [email protected]=20
  href=3D"mailto:[email protected]">[email protected]</A> </DIV>
  <DIV style=3D"FONT: 10pt arial"><B>Sent:</B> Friday, December 29, 2006 =
12:58=20
  AM</DIV>
  <DIV style=3D"FONT: 10pt arial"><B>Subject:</B> Re: [JXTA user] Adding =
a=20
  listener to an input pipe</DIV>
  <DIV><BR></DIV>Funny.I thought there was method like=20
  myInputPipe.addListener(....).But I just check the docs and there =
isn't one.I=20
  think one way to get around this is is to pass a null reference to a =
listener=20
  and then assign that reference to a live object when you want to =
assign a=20
  listener to that pipe. <BR>Something like this,<BR><BR>&nbsp;&nbsp;=20
  PipeMsgListener listener =3D null;<BR>&nbsp;<BR>&nbsp;&nbsp; =
myInputPipe =3D=20
  pipeService.createInputPipe(pipeAdv,listener);<BR>&nbsp;&nbsp;=20
  .....<BR>&nbsp;&nbsp; ..... <BR>&nbsp;&nbsp; listener =3D new =
PipeMsgListener()=20
  {<BR>&nbsp;&nbsp; ....<BR>&nbsp;&nbsp; .... <BR>&nbsp;&nbsp;=20
  };<BR>&nbsp;&nbsp; <BR>&nbsp;&nbsp; Think this should work though ...=20
  :-P<BR><BR><BR>
  <DIV><SPAN class=3Dgmail_quote>On 12/27/06, <B =
class=3Dgmail_sendername>Hugo=20
  Giusti</B> &lt;<A=20
  href=3D"mailto:[email protected]">[email protected] =
</A>&gt;=20
  wrote:</SPAN>
  <BLOCKQUOTE class=3Dgmail_quote=20
  style=3D"PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: =
rgb(204,204,204) 1px solid">Hi=20
    everyone,<BR><BR><BR>I've been using myInputPipe =3D=20
    pipeService.createInputPipe (pipeAdv,listener) to create an input =
pipe and=20
    add a listener to it but I was wondering if there is a way to create =
the=20
    pipe and add the listener later, can anyone tell me how to do=20
    this?<BR><BR>Thanks in advance.<BR>Hugo=20
    =
<BR><BR><BR><BR><BR>__________________________________________________<BR=
>Correo=20
    Yahoo!<BR>Espacio para todos tus mensajes, antivirus y antispam=20
    =A1gratis!<BR>=A1Abr=ED tu cuenta ya! - <A=20
    href=3D"http://correo.yahoo.com.ar">http://correo.yahoo.com.ar=20
    =
</A><BR><BR>-------------------------------------------------------------=
--------<BR>To=20
    unsubscribe, e-mail: <A=20
    =
href=3D"mailto:[email protected]">[email protected]</A><B=
R>For=20
    additional commands, e-mail: <A=20
    =
href=3D"mailto:[email protected]">[email protected]</A><BR><BR></BLOCKQ=
UOTE></DIV><BR></BLOCKQUOTE></BODY></HTML>

------=_NextPart_000_0016_01C72B45.808D2520--