Hi Chuck,
The propertyChangeEvent has a "source" that you want to be the
AsteriskChannel class. For example:
public void propertyChange(PropertyChangeEvent propertyChangeEvent)
{
Object src =3D propertyChangeEvent.getSource();
if(!(src instanceof AsteriskChannel) || src =3D=3D null)
return;
AsteriskChannel channel =3D (AsteriskChannel)src;
// do some stuff
}
If I only want channel events, I typically check that the source is what
I expect -- as sometimes I will (ab)use the property change methods with
my own objects.
Take care,
Martin Smith, Systems Developer
ma...@be...
Bureau of Economic and Business Research
University of Florida
(352) 392-0171 Ext. 221=20
=20
> -----Original Message-----
> From: ast...@li...=20
> [mailto:ast...@li...] On=20
> Behalf Of CHUCK SYPERSKI
> Sent: Thursday, July 19, 2007 8:05 AM
> To: ast...@li...
> Subject: [Asterisk-java-users] Who is firing the propertyChange?
>=20
> I am sorry this may be a simple questions but I am stuggling=20
> to figure it out. I have a multi threaded app that is using=20
> the live classes. It makes new calls and then monitors thier=20
> progress towards completion. The problem is when the=20
> propertyChange event fires how can I identify which channel=20
> or for example which Channel the ChannelState=20
> "propertyChange" is refering too? Below is a piece of code=20
> to show what I am talking about. =20
>=20
> Thanks again, this list has been very helpful!
>=20
> Each thread that runs has this method, but it seems that the=20
> events for all calls broadcast to all propertyChange functions.
>=20
> public void propertyChange(PropertyChangeEvent=20
> propertyChangeEvent)
> {
> try
> {
> if ( propertyChangeEvent.getNewValue()=20
> instanceof ChannelState )
> {
> ChannelState c =3D=20
> (ChannelState)(propertyChangeEvent.getNewValue());
> handleStateChange( c );
> }
> =09
> }
> catch( Exception e )
> {
> lg( e.getMessage() );
> e.printStackTrace() ;
> }
> }
>=20
> Thanks,
> Chuck Syperski
>=20
>=20
> --------------------------------------------------------------
> -----------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> Asterisk-java-users mailing list
> Ast...@li...
> https://lists.sourceforge.net/lists/listinfo/asterisk-java-users
>=20
|