Re: Adding a listener to an input pipe

"Ashutosh Adkar" <[email protected]> Fri, 29 Dec 2006 23:04:51 +0530
Newsgroups gmane.comp.java.jxta.user
Message-ID <[email protected]>
------=_Part_102256_18207150.1167413691836
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Okay.Maybe it wont.
BTW Hugo why do you want to add the listener later?I mean whats wrong with
assigning it as it is...

On 12/29/06, Leandro Quiroga <[email protected]> wrote:
>
>  Hi, this would not work, because Java uses reference by value parameters
> passing.
> Happy new year!!
>
> Leandro
>
>
> ----- Original Message -----
> *From:* Ashutosh Adkar <[email protected]>
> *To:* [email protected]
> *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 thi=
s
> is is to pass a null reference to a listener and then assign that referen=
ce
> to a live object when you want to assign a listener to that pipe.
> Something like this,
>
>    PipeMsgListener listener =3D null;
>
>    myInputPipe =3D pipeService.createInputPipe(pipeAdv,listener);
>    .....
>    .....
>    listener =3D new PipeMsgListener() {
>    ....
>    ....
>    };
>
>    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,lis=
tener) 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
> >
> >
> >
> >
> > __________________________________________________
> > Correo Yahoo!
> > Espacio para todos tus mensajes, antivirus y antispam =A1gratis!
> > =A1Abr=ED tu cuenta ya! - http://correo.yahoo.com.ar
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [email protected]
> > For additional commands, e-mail: [email protected]
> >
> >
>

------=_Part_102256_18207150.1167413691836
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Okay.Maybe it wont.<br>BTW Hugo why do you want to add the listener later?I=
 mean whats wrong with assigning it as it is...<br><br><div><span class=3D"=
gmail_quote">On 12/29/06, <b class=3D"gmail_sendername">Leandro Quiroga</b>=
 &lt;
<a href=3D"mailto:[email protected]">[email protected]</a>&gt; wrote:</sp=
an><blockquote class=3D"gmail_quote" style=3D"border-left: 1px solid rgb(20=
4, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">





<div bgcolor=3D"#ffffff">
<div><font face=3D"Arial" size=3D"2">Hi, this would not work, because Java =
uses=20
reference by value parameters passing.</font></div>
<div><font face=3D"Arial" size=3D"2">Happy new year!!</font></div><span cla=
ss=3D"sg">
<div><font face=3D"Arial" size=3D"2"></font>&nbsp;</div>
<div><font face=3D"Arial" size=3D"2">Leandro</font></div></span><div><span =
class=3D"e" id=3D"q_10fced7fd0f5ec55_2">
<div><font face=3D"Arial" size=3D"2"></font>&nbsp;</div>
<blockquote style=3D"border-left: 2px solid rgb(0, 0, 0); padding-right: 0p=
x; padding-left: 5px; margin-left: 5px; margin-right: 0px;">
  <div style=3D"font-family: arial; font-style: normal; font-variant: norma=
l; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adj=
ust: none; font-stretch: normal;">----- Original Message ----- </div>
  <div style=3D"background: rgb(228, 228, 228) none repeat scroll 0% 50%; -=
moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -m=
oz-background-inline-policy: -moz-initial; font-family: arial; font-style: =
normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-he=
ight: normal; font-size-adjust: none; font-stretch: normal;">
<b>From:</b>=20
  <a title=3D"[email protected]" href=3D"mailto:[email protected]" ta=
rget=3D"_blank" onclick=3D"return top.js.OpenExtLink(window,event,this)">As=
hutosh=20
  Adkar</a> </div>
  <div style=3D"font-family: arial; font-style: normal; font-variant: norma=
l; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adj=
ust: none; font-stretch: normal;"><b>To:</b> <a title=3D"[email protected]" hre=
f=3D"mailto:[email protected]" target=3D"_blank" onclick=3D"return top.js.OpenE=
xtLink(window,event,this)">
[email protected]</a> </div>
  <div style=3D"font-family: arial; font-style: normal; font-variant: norma=
l; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adj=
ust: none; font-stretch: normal;"><b>Sent:</b> Friday, December 29, 2006 12=
:58=20
  AM</div>
  <div style=3D"font-family: arial; font-style: normal; font-variant: norma=
l; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adj=
ust: none; font-stretch: normal;"><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&#39=
;t one.I=20
  think one way to get around this is is to pass a null reference to a list=
ener=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 PipeMsgList=
ener()=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=3D"gmail_quote">On 12/27/06, <b class=3D"gmail_sendernam=
e">Hugo=20
  Giusti</b> &lt;<a href=3D"mailto:[email protected]" target=3D"_blan=
k" onclick=3D"return top.js.OpenExtLink(window,event,this)">giustihugo@yaho=
o.com.ar </a>&gt;=20
  wrote:</span>
  <blockquote class=3D"gmail_quote" style=3D"border-left: 1px solid rgb(204=
, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi=20
    everyone,<br><br><br>I&#39;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 th=
e=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 href=3D"http://correo.yahoo.=
com.ar" target=3D"_blank" onclick=3D"return top.js.OpenExtLink(window,event=
,this)">http://correo.yahoo.com.ar=20
    </a><br><br>-----------------------------------------------------------=
----------<br>To=20
    unsubscribe, e-mail: <a href=3D"mailto:[email protected]" targe=
t=3D"_blank" onclick=3D"return top.js.OpenExtLink(window,event,this)">user-=
[email protected]</a><br>For=20
    additional commands, e-mail: <a href=3D"mailto:[email protected]" targ=
et=3D"_blank" onclick=3D"return top.js.OpenExtLink(window,event,this)">user=
[email protected]</a><br><br></blockquote></div><br></blockquote></span></div>=
</div>


</blockquote></div><br>

------=_Part_102256_18207150.1167413691836--